mirror of
https://github.com/actions/setup-python.git
synced 2026-01-19 19:38:56 +08:00
Add support of unstable Python versions
This commit is contained in:
parent
654aa00a6e
commit
8fbc418d76
9 changed files with 4179 additions and 4088 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue