Add support of unstable Python versions

This commit is contained in:
MaksimZhukov 2020-07-15 17:57:44 +03:00
parent 654aa00a6e
commit 8fbc418d76
9 changed files with 4179 additions and 4088 deletions

View file

@ -71,7 +71,8 @@ function usePyPy(majorVersion: 2 | 3, architecture: string): InstalledVersion {
async function useCpythonVersion(
version: string,
architecture: string
architecture: string,
stable: boolean
): Promise<InstalledVersion> {
const desugaredVersionSpec = desugarDevVersion(version);
const semanticVersionSpec = pythonVersionToSemantic(desugaredVersionSpec);
@ -88,7 +89,8 @@ async function useCpythonVersion(
);
const foundRelease = await installer.findReleaseFromManifest(
semanticVersionSpec,
architecture
architecture,
stable
);
if (foundRelease && foundRelease.files && foundRelease.files.length > 0) {
@ -171,7 +173,8 @@ export function pythonVersionToSemantic(versionSpec: string) {
export async function findPythonVersion(
version: string,
architecture: string
architecture: string,
stable: boolean
): Promise<InstalledVersion> {
switch (version.toUpperCase()) {
case 'PYPY2':
@ -179,6 +182,6 @@ export async function findPythonVersion(
case 'PYPY3':
return usePyPy(3, architecture);
default:
return await useCpythonVersion(version, architecture);
return await useCpythonVersion(version, architecture, stable);
}
}

View file

@ -15,7 +15,8 @@ const IS_WINDOWS = process.platform === 'win32';
export async function findReleaseFromManifest(
semanticVersionSpec: string,
architecture: string
architecture: string,
stable: boolean
): Promise<tc.IToolRelease | undefined> {
const manifest: tc.IToolRelease[] = await tc.getManifestFromRepo(
MANIFEST_REPO_OWNER,
@ -25,7 +26,7 @@ export async function findReleaseFromManifest(
);
return await tc.findFromManifest(
semanticVersionSpec,
true,
stable,
manifest,
architecture
);

View file

@ -8,7 +8,8 @@ async function run() {
let version = core.getInput('python-version');
if (version) {
const arch: string = core.getInput('architecture') || os.arch();
const installed = await finder.findPythonVersion(version, arch);
let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
const installed = await finder.findPythonVersion(version, arch, stable);
core.info(`Successfully setup ${installed.impl} (${installed.version})`);
}
const matchersPath = path.join(__dirname, '..', '.github');