Allow pypyX.Y

This commit is contained in:
mayeut 2022-03-05 19:15:18 +01:00
parent e621a16884
commit 070ce4509c
No known key found for this signature in database
GPG key ID: 8B03CED67D3ABFBA
4 changed files with 33 additions and 12 deletions

View file

@ -22,6 +22,7 @@ jobs:
pypy:
- 'pypy-2.7'
- 'pypy-3.7'
- 'pypy3.9'
- 'pypy-2.7-v7.3.4'
- 'pypy-3.7-v7.3.5'
- 'pypy-3.7-v7.3.4'
@ -29,6 +30,7 @@ jobs:
- 'pypy-3.7-v7.x'
- 'pypy-2.7-v7.3.4rc1'
- 'pypy-3.7-nightly'
- 'pypy3.8-v7.3.7'
steps:
- name: Checkout

22
dist/setup/index.js vendored
View file

@ -2128,14 +2128,24 @@ function findPyPyToolCache(pythonVersion, pypyVersion, architecture) {
}
exports.findPyPyToolCache = findPyPyToolCache;
function parsePyPyVersion(versionSpec) {
const versions = versionSpec.split('-').filter(item => !!item);
if (versions.length < 2 || versions[0] != 'pypy') {
let versionsString;
if (versionSpec.length > 4 && versionSpec[4] == '-') {
versionsString = versionSpec.slice(5);
}
else if (versionSpec.length > 3) {
versionsString = versionSpec.slice(4);
}
else {
versionsString = '';
}
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;
if (versions.length > 2) {
pypyVersion = pypyInstall.pypyVersionToSemantic(versions[2]);
if (versions.length > 1) {
pypyVersion = pypyInstall.pypyVersionToSemantic(versions[1]);
}
else {
pypyVersion = 'x';
@ -6684,7 +6694,7 @@ const os = __importStar(__webpack_require__(87));
const cache_factory_1 = __webpack_require__(633);
const utils_1 = __webpack_require__(163);
function isPyPyVersion(versionSpec) {
return versionSpec.startsWith('pypy-');
return versionSpec.startsWith('pypy');
}
function cacheDependencies(cache, pythonVersion) {
return __awaiter(this, void 0, void 0, function* () {

View file

@ -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';
}

View file

@ -7,7 +7,7 @@ import {getCacheDistributor} from './cache-distributions/cache-factory';
import {isGhes} from './utils';
function isPyPyVersion(versionSpec: string) {
return versionSpec.startsWith('pypy-');
return versionSpec.startsWith('pypy');
}
async function cacheDependencies(cache: string, pythonVersion: string) {