diff --git a/.github/workflows/test-pypy.yml b/.github/workflows/test-pypy.yml index f6362069..b661ba0f 100644 --- a/.github/workflows/test-pypy.yml +++ b/.github/workflows/test-pypy.yml @@ -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 diff --git a/dist/setup/index.js b/dist/setup/index.js index 4563d733..8430df2b 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -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-'. 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* () { diff --git a/src/find-pypy.ts b/src/find-pypy.ts index 0894ab64..dd42536f 100644 --- a/src/find-pypy.ts +++ b/src/find-pypy.ts @@ -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-'. 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'; } diff --git a/src/setup-python.ts b/src/setup-python.ts index b37d5835..50285bd9 100644 --- a/src/setup-python.ts +++ b/src/setup-python.ts @@ -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) {