mirror of
https://github.com/actions/setup-python.git
synced 2026-01-20 12:48:54 +08:00
Allow pypyX.Y
This commit is contained in:
parent
e621a16884
commit
070ce4509c
4 changed files with 33 additions and 12 deletions
|
|
@ -118,18 +118,27 @@ export function findPyPyToolCache(
|
|||
}
|
||||
|
||||
export function parsePyPyVersion(versionSpec: string): IPyPyVersionSpec {
|
||||
const versions = versionSpec.split('-').filter(item => !!item);
|
||||
let versionsString: string;
|
||||
if (versionSpec.length > 4 && versionSpec[4] == '-') {
|
||||
versionsString = versionSpec.slice(5);
|
||||
} else if (versionSpec.length > 3) {
|
||||
versionsString = versionSpec.slice(4);
|
||||
} else {
|
||||
versionsString = '';
|
||||
}
|
||||
|
||||
if (versions.length < 2 || versions[0] != 'pypy') {
|
||||
const versions = versionsString.split('-').filter(item => !!item);
|
||||
|
||||
if (!versionSpec.startsWith('pypy') || versions.length == 0) {
|
||||
throw new Error(
|
||||
"Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy-<python-version>'. See README for examples and documentation."
|
||||
);
|
||||
}
|
||||
|
||||
const pythonVersion = versions[1];
|
||||
const pythonVersion = versions[0];
|
||||
let pypyVersion: string;
|
||||
if (versions.length > 2) {
|
||||
pypyVersion = pypyInstall.pypyVersionToSemantic(versions[2]);
|
||||
if (versions.length > 1) {
|
||||
pypyVersion = pypyInstall.pypyVersionToSemantic(versions[1]);
|
||||
} else {
|
||||
pypyVersion = 'x';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue