mirror of
https://github.com/actions/setup-python.git
synced 2025-07-22 11:08:21 +02:00
add check-latest for pypy
This commit is contained in:
parent
4841389b47
commit
73adf61d1f
8 changed files with 165 additions and 31 deletions
|
@ -6,7 +6,8 @@ import {
|
|||
validateVersion,
|
||||
getPyPyVersionFromPath,
|
||||
readExactPyPyVersionFile,
|
||||
validatePythonVersionFormatForPyPy
|
||||
validatePythonVersionFormatForPyPy,
|
||||
IPyPyManifestRelease
|
||||
} from './utils';
|
||||
|
||||
import * as semver from 'semver';
|
||||
|
@ -20,14 +21,36 @@ interface IPyPyVersionSpec {
|
|||
|
||||
export async function findPyPyVersion(
|
||||
versionSpec: string,
|
||||
architecture: string
|
||||
architecture: string,
|
||||
checkLatest: boolean
|
||||
): Promise<{resolvedPyPyVersion: string; resolvedPythonVersion: string}> {
|
||||
let resolvedPyPyVersion = '';
|
||||
let resolvedPythonVersion = '';
|
||||
let installDir: string | null;
|
||||
let releases: IPyPyManifestRelease[] | undefined;
|
||||
|
||||
const pypyVersionSpec = parsePyPyVersion(versionSpec);
|
||||
|
||||
if (checkLatest) {
|
||||
releases = await pypyInstall.getAvailablePyPyVersions();
|
||||
if (releases && releases.length > 0) {
|
||||
const releaseData = pypyInstall.findRelease(
|
||||
releases,
|
||||
pypyVersionSpec.pythonVersion,
|
||||
pypyVersionSpec.pypyVersion,
|
||||
architecture
|
||||
);
|
||||
|
||||
if(releaseData) {
|
||||
core.info(`Resolved as PyPy ${releaseData.resolvedPyPyVersion} with Python (${releaseData.resolvedPythonVersion})`);
|
||||
pypyVersionSpec.pythonVersion = releaseData.resolvedPythonVersion;
|
||||
pypyVersionSpec.pypyVersion = releaseData.resolvedPyPyVersion;
|
||||
} else {
|
||||
core.info(`Failed to resolve PyPy ${pypyVersionSpec.pypyVersion} with Python (${pypyVersionSpec.pythonVersion}) from manifest`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
({installDir, resolvedPythonVersion, resolvedPyPyVersion} = findPyPyToolCache(
|
||||
pypyVersionSpec.pythonVersion,
|
||||
pypyVersionSpec.pypyVersion,
|
||||
|
@ -42,7 +65,8 @@ export async function findPyPyVersion(
|
|||
} = await pypyInstall.installPyPy(
|
||||
pypyVersionSpec.pypyVersion,
|
||||
pypyVersionSpec.pythonVersion,
|
||||
architecture
|
||||
architecture,
|
||||
releases
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue