From cb9573b913b94894201cf129d7f50fe1997881fb Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 16:00:25 +0300 Subject: [PATCH 01/11] test for pypy new version notation --- .github/workflows/test-pypy.yml | 6 +----- src/find-pypy.ts | 4 ++-- src/install-pypy.ts | 19 +++++++++++++++---- src/utils.ts | 2 ++ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-pypy.yml b/.github/workflows/test-pypy.yml index 4041440d4..bd06e5786 100644 --- a/.github/workflows/test-pypy.yml +++ b/.github/workflows/test-pypy.yml @@ -23,13 +23,9 @@ jobs: - 'pypy-2.7' - 'pypy-3.6' - 'pypy-3.7' - - 'pypy-2.7-v7.3.2' - - 'pypy-3.6-v7.3.2' - - 'pypy-3.7-v7.3.2' - - 'pypy-3.6-v7.3.x' - - 'pypy-3.7-v7.x' - 'pypy-3.6-v7.3.3rc1' - 'pypy-3.7-nightly' + - 'pypy-2.7-v7.3.4rc1' steps: - name: Checkout diff --git a/src/find-pypy.ts b/src/find-pypy.ts index 700ce9ee5..850311ddc 100644 --- a/src/find-pypy.ts +++ b/src/find-pypy.ts @@ -28,9 +28,9 @@ export async function findPyPyVersion( const pypyVersionSpec = parsePyPyVersion(versionSpec); // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64. - if (IS_WINDOWS && architecture === 'x64') { + /*if (IS_WINDOWS && architecture === 'x64') { architecture = 'x86'; - } + }*/ ({installDir, resolvedPythonVersion, resolvedPyPyVersion} = findPyPyToolCache( pypyVersionSpec.pythonVersion, diff --git a/src/install-pypy.ts b/src/install-pypy.ts index 99d603000..f2ab85ae7 100644 --- a/src/install-pypy.ts +++ b/src/install-pypy.ts @@ -8,6 +8,8 @@ import fs from 'fs'; import { IS_WINDOWS, + WINDOWS_ARCHS, + WINDOWS_PLATFORMS, IPyPyManifestRelease, createSymlinkInFolder, isNightlyKeyword, @@ -142,10 +144,7 @@ export function findRelease( isPyPyNightly || semver.satisfies(pypyVersionToSemantic(item.pypy_version), pypyVersion); const isArchPresent = - item.files && - item.files.some( - file => file.arch === architecture && file.platform === process.platform - ); + item.files && (IS_WINDOWS ? isArchPresentForWindows(item) : isArchPresentForMacOrLinux(item, architecture, process.platform)); return isPythonVersionSatisfied && isPyPyVersionSatisfied && isArchPresent; }); @@ -191,3 +190,15 @@ export function pypyVersionToSemantic(versionSpec: string) { const prereleaseVersion = /(\d+\.\d+\.\d+)((?:a|b|rc))(\d*)/g; return versionSpec.replace(prereleaseVersion, '$1-$2.$3'); } + +export function isArchPresentForWindows(item: any) { + return item.files.some( + file => WINDOWS_ARCHS.includes(file.arch) && WINDOWS_PLATFORMS.includes( file.platform) + ); +} + +export function isArchPresentForMacOrLinux(item: any, architecture: string, platform: string) { + return item.files.some( + file => file.arch === architecture && file.platform === platform + ); +} diff --git a/src/utils.ts b/src/utils.ts index e96d5b230..c15fe3d05 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -4,6 +4,8 @@ import * as semver from 'semver'; export const IS_WINDOWS = process.platform === 'win32'; export const IS_LINUX = process.platform === 'linux'; +export const WINDOWS_ARCHS = ['x86', 'x64']; +export const WINDOWS_PLATFORMS = ['win32', 'win64']; const PYPY_VERSION_FILE = 'PYPY_VERSION'; export interface IPyPyManifestAsset { From 42c2a27b6379a9318650d1f76e9830f5dab20a97 Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 16:06:51 +0300 Subject: [PATCH 02/11] formatting --- dist/index.js | 21 +++++++++++++++++---- src/install-pypy.ts | 17 +++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/dist/index.js b/dist/index.js index f0939428b..23decb238 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1109,9 +1109,9 @@ function findPyPyVersion(versionSpec, architecture) { let installDir; const pypyVersionSpec = parsePyPyVersion(versionSpec); // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64. - if (utils_1.IS_WINDOWS && architecture === 'x64') { - architecture = 'x86'; - } + /*if (IS_WINDOWS && architecture === 'x64') { + architecture = 'x86'; + }*/ ({ installDir, resolvedPythonVersion, resolvedPyPyVersion } = findPyPyToolCache(pypyVersionSpec.pythonVersion, pypyVersionSpec.pypyVersion, architecture)); if (!installDir) { ({ @@ -2327,6 +2327,8 @@ const path = __importStar(__webpack_require__(622)); const semver = __importStar(__webpack_require__(876)); exports.IS_WINDOWS = process.platform === 'win32'; exports.IS_LINUX = process.platform === 'linux'; +exports.WINDOWS_ARCHS = ['x86', 'x64']; +exports.WINDOWS_PLATFORMS = ['win32', 'win64']; const PYPY_VERSION_FILE = 'PYPY_VERSION'; /** create Symlinks for downloaded PyPy * It should be executed only for downloaded versions in runtime, because @@ -2893,7 +2895,9 @@ function findRelease(releases, pythonVersion, pypyVersion, architecture) { const isPyPyVersionSatisfied = isPyPyNightly || semver.satisfies(pypyVersionToSemantic(item.pypy_version), pypyVersion); const isArchPresent = item.files && - item.files.some(file => file.arch === architecture && file.platform === process.platform); + (utils_1.IS_WINDOWS + ? isArchPresentForWindows(item) + : isArchPresentForMacOrLinux(item, architecture, process.platform)); return isPythonVersionSatisfied && isPyPyVersionSatisfied && isArchPresent; }); if (filterReleases.length === 0) { @@ -2926,6 +2930,15 @@ function pypyVersionToSemantic(versionSpec) { return versionSpec.replace(prereleaseVersion, '$1-$2.$3'); } exports.pypyVersionToSemantic = pypyVersionToSemantic; +function isArchPresentForWindows(item) { + return item.files.some((file) => utils_1.WINDOWS_ARCHS.includes(file.arch) && + utils_1.WINDOWS_PLATFORMS.includes(file.platform)); +} +exports.isArchPresentForWindows = isArchPresentForWindows; +function isArchPresentForMacOrLinux(item, architecture, platform) { + return item.files.some((file) => file.arch === architecture && file.platform === platform); +} +exports.isArchPresentForMacOrLinux = isArchPresentForMacOrLinux; /***/ }), diff --git a/src/install-pypy.ts b/src/install-pypy.ts index f2ab85ae7..12e95ce19 100644 --- a/src/install-pypy.ts +++ b/src/install-pypy.ts @@ -144,7 +144,10 @@ export function findRelease( isPyPyNightly || semver.satisfies(pypyVersionToSemantic(item.pypy_version), pypyVersion); const isArchPresent = - item.files && (IS_WINDOWS ? isArchPresentForWindows(item) : isArchPresentForMacOrLinux(item, architecture, process.platform)); + item.files && + (IS_WINDOWS + ? isArchPresentForWindows(item) + : isArchPresentForMacOrLinux(item, architecture, process.platform)); return isPythonVersionSatisfied && isPyPyVersionSatisfied && isArchPresent; }); @@ -193,12 +196,18 @@ export function pypyVersionToSemantic(versionSpec: string) { export function isArchPresentForWindows(item: any) { return item.files.some( - file => WINDOWS_ARCHS.includes(file.arch) && WINDOWS_PLATFORMS.includes( file.platform) + (file: any) => + WINDOWS_ARCHS.includes(file.arch) && + WINDOWS_PLATFORMS.includes(file.platform) ); } -export function isArchPresentForMacOrLinux(item: any, architecture: string, platform: string) { +export function isArchPresentForMacOrLinux( + item: any, + architecture: string, + platform: string +) { return item.files.some( - file => file.arch === architecture && file.platform === platform + (file: any) => file.arch === architecture && file.platform === platform ); } From 63259a14e3ad5ead4cc5aed7100d220b8fead8b3 Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 16:10:38 +0300 Subject: [PATCH 03/11] uncommented condition --- dist/index.js | 6 +++--- src/find-pypy.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/index.js b/dist/index.js index 23decb238..7e0a61430 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1109,9 +1109,9 @@ function findPyPyVersion(versionSpec, architecture) { let installDir; const pypyVersionSpec = parsePyPyVersion(versionSpec); // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64. - /*if (IS_WINDOWS && architecture === 'x64') { - architecture = 'x86'; - }*/ + if (utils_1.IS_WINDOWS && architecture === 'x64') { + architecture = 'x86'; + } ({ installDir, resolvedPythonVersion, resolvedPyPyVersion } = findPyPyToolCache(pypyVersionSpec.pythonVersion, pypyVersionSpec.pypyVersion, architecture)); if (!installDir) { ({ diff --git a/src/find-pypy.ts b/src/find-pypy.ts index 850311ddc..700ce9ee5 100644 --- a/src/find-pypy.ts +++ b/src/find-pypy.ts @@ -28,9 +28,9 @@ export async function findPyPyVersion( const pypyVersionSpec = parsePyPyVersion(versionSpec); // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64. - /*if (IS_WINDOWS && architecture === 'x64') { + if (IS_WINDOWS && architecture === 'x64') { architecture = 'x86'; - }*/ + } ({installDir, resolvedPythonVersion, resolvedPyPyVersion} = findPyPyToolCache( pypyVersionSpec.pythonVersion, From 65839cc49997fb7fe32ecff76ae06506c69ee1c8 Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 16:16:44 +0300 Subject: [PATCH 04/11] test --- .github/workflows/test-pypy.yml | 6 +----- dist/index.js | 1 + src/install-pypy.ts | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-pypy.yml b/.github/workflows/test-pypy.yml index bd06e5786..0791dfc19 100644 --- a/.github/workflows/test-pypy.yml +++ b/.github/workflows/test-pypy.yml @@ -18,13 +18,9 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04] + os: [windows-latest, ubuntu-20.04] pypy: - 'pypy-2.7' - - 'pypy-3.6' - - 'pypy-3.7' - - 'pypy-3.6-v7.3.3rc1' - - 'pypy-3.7-nightly' - 'pypy-2.7-v7.3.4rc1' steps: diff --git a/dist/index.js b/dist/index.js index 7e0a61430..7a46933dd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2931,6 +2931,7 @@ function pypyVersionToSemantic(versionSpec) { } exports.pypyVersionToSemantic = pypyVersionToSemantic; function isArchPresentForWindows(item) { + core.info(item); return item.files.some((file) => utils_1.WINDOWS_ARCHS.includes(file.arch) && utils_1.WINDOWS_PLATFORMS.includes(file.platform)); } diff --git a/src/install-pypy.ts b/src/install-pypy.ts index 12e95ce19..770ef17c0 100644 --- a/src/install-pypy.ts +++ b/src/install-pypy.ts @@ -195,6 +195,7 @@ export function pypyVersionToSemantic(versionSpec: string) { } export function isArchPresentForWindows(item: any) { + core.info(item); return item.files.some( (file: any) => WINDOWS_ARCHS.includes(file.arch) && From cc3f7d530b7981cc35c0f2df37029f63b2cd7f85 Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 16:19:35 +0300 Subject: [PATCH 05/11] added pypy to test matrix --- __tests__/data/pypy.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/__tests__/data/pypy.json b/__tests__/data/pypy.json index 95e06bbb1..cd3069d2f 100644 --- a/__tests__/data/pypy.json +++ b/__tests__/data/pypy.json @@ -41,7 +41,13 @@ "arch": "s390x", "platform": "linux", "download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3-s390x.tar.bz2" - } + }, + { + "filename": "pypy2.7-v7.3.4rc1-win64.zip", + "arch": "x64", + "platform": "win64", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-win64.zip" + } ] }, { From 99e5bb374b7dea142db7b3a5936d4b8e85197df8 Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 16:23:19 +0300 Subject: [PATCH 06/11] test --- __tests__/data/pypy.json | 47 ++++++++++++++++++++++++++++++++++------ dist/index.js | 2 +- src/install-pypy.ts | 2 +- 3 files changed, 42 insertions(+), 9 deletions(-) diff --git a/__tests__/data/pypy.json b/__tests__/data/pypy.json index cd3069d2f..8a9922c19 100644 --- a/__tests__/data/pypy.json +++ b/__tests__/data/pypy.json @@ -41,13 +41,7 @@ "arch": "s390x", "platform": "linux", "download_url": "https://test.download.python.org/pypy/pypy3.6-v7.3.3-s390x.tar.bz2" - }, - { - "filename": "pypy2.7-v7.3.4rc1-win64.zip", - "arch": "x64", - "platform": "win64", - "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-win64.zip" - } + } ] }, { @@ -95,6 +89,45 @@ } ] }, + { + "pypy_version": "7.3.4rc1", + "python_version": "2.7.18", + "stable": false, + "latest_pypy": false, + "date": "2021-03-19", + "files": [ + { + "filename": "pypy2.7-v7.3.4rc1-aarch64.tar.bz2", + "arch": "aarch64", + "platform": "linux", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-aarch64.tar.bz2" + }, + { + "filename": "pypy2.7-v7.3.4rc1-linux32.tar.bz2", + "arch": "i686", + "platform": "linux", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-linux32.tar.bz2" + }, + { + "filename": "pypy2.7-v7.3.4rc1-linux64.tar.bz2", + "arch": "x64", + "platform": "linux", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-linux64.tar.bz2" + }, + { + "filename": "pypy2.7-v7.3.4rc1-osx64.tar.bz2", + "arch": "x64", + "platform": "darwin", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-osx64.tar.bz2" + }, + { + "filename": "pypy2.7-v7.3.4rc1-win64.zip", + "arch": "x64", + "platform": "win64", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-win64.zip" + } + ] + }, { "pypy_version": "7.3.3rc2", "python_version": "3.7.7", diff --git a/dist/index.js b/dist/index.js index 7a46933dd..929af416a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2931,7 +2931,7 @@ function pypyVersionToSemantic(versionSpec) { } exports.pypyVersionToSemantic = pypyVersionToSemantic; function isArchPresentForWindows(item) { - core.info(item); + core.info(JSON.stringify(item)); return item.files.some((file) => utils_1.WINDOWS_ARCHS.includes(file.arch) && utils_1.WINDOWS_PLATFORMS.includes(file.platform)); } diff --git a/src/install-pypy.ts b/src/install-pypy.ts index 770ef17c0..f7f05c070 100644 --- a/src/install-pypy.ts +++ b/src/install-pypy.ts @@ -195,7 +195,7 @@ export function pypyVersionToSemantic(versionSpec: string) { } export function isArchPresentForWindows(item: any) { - core.info(item); + core.info(JSON.stringify(item)); return item.files.some( (file: any) => WINDOWS_ARCHS.includes(file.arch) && From 32dc6a05e55fb254be76460018ee873f03d17b0e Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 16:30:24 +0300 Subject: [PATCH 07/11] test --- dist/index.js | 13 ++++++++++++- src/install-pypy.ts | 24 +++++++++++++++++++++--- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 929af416a..700467159 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2908,7 +2908,9 @@ function findRelease(releases, pythonVersion, pypyVersion, architecture) { semver.compare(semver.coerce(current.python_version), semver.coerce(previous.python_version))); }); const foundRelease = sortedReleases[0]; - const foundAsset = foundRelease.files.find(item => item.arch === architecture && item.platform === process.platform); + const foundAsset = utils_1.IS_WINDOWS + ? findAssetForWindows(foundRelease) + : findAssetForMacOrLinux(foundRelease, architecture, process.platform); return { foundAsset, resolvedPythonVersion: foundRelease.python_version, @@ -2940,6 +2942,15 @@ function isArchPresentForMacOrLinux(item, architecture, platform) { return item.files.some((file) => file.arch === architecture && file.platform === platform); } exports.isArchPresentForMacOrLinux = isArchPresentForMacOrLinux; +function findAssetForWindows(releases) { + return releases.files.find((item) => utils_1.WINDOWS_ARCHS.includes(item.arch) && + utils_1.WINDOWS_PLATFORMS.includes(item.platform)); +} +exports.findAssetForWindows = findAssetForWindows; +function findAssetForMacOrLinux(releases, architecture, platform) { + return releases.files.find((item) => item.arch === architecture && item.platform === platform); +} +exports.findAssetForMacOrLinux = findAssetForMacOrLinux; /***/ }), diff --git a/src/install-pypy.ts b/src/install-pypy.ts index f7f05c070..405275152 100644 --- a/src/install-pypy.ts +++ b/src/install-pypy.ts @@ -169,9 +169,9 @@ export function findRelease( }); const foundRelease = sortedReleases[0]; - const foundAsset = foundRelease.files.find( - item => item.arch === architecture && item.platform === process.platform - ); + const foundAsset = IS_WINDOWS + ? findAssetForWindows(foundRelease) + : findAssetForMacOrLinux(foundRelease, architecture, process.platform); return { foundAsset, @@ -212,3 +212,21 @@ export function isArchPresentForMacOrLinux( (file: any) => file.arch === architecture && file.platform === platform ); } + +export function findAssetForWindows(releases: any) { + return releases.files.find( + (item: any) => + WINDOWS_ARCHS.includes(item.arch) && + WINDOWS_PLATFORMS.includes(item.platform) + ); +} + +export function findAssetForMacOrLinux( + releases: any, + architecture: string, + platform: string +) { + return releases.files.find( + (item: any) => item.arch === architecture && item.platform === platform + ); +} From 401fc93a1b9d8275c57aa56c935a07b69bab994a Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 16:34:15 +0300 Subject: [PATCH 08/11] restored all tests --- .github/workflows/test-pypy.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-pypy.yml b/.github/workflows/test-pypy.yml index 0791dfc19..65bd64873 100644 --- a/.github/workflows/test-pypy.yml +++ b/.github/workflows/test-pypy.yml @@ -18,9 +18,18 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest, ubuntu-20.04] + os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-latest] pypy: - 'pypy-2.7' + - 'pypy-3.6' + - 'pypy-3.7' + - 'pypy-2.7-v7.3.2' + - 'pypy-3.6-v7.3.2' + - 'pypy-3.7-v7.3.2' + - 'pypy-3.6-v7.3.x' + - 'pypy-3.7-v7.x' + - 'pypy-3.6-v7.3.3rc1' + - 'pypy-3.7-nightly' - 'pypy-2.7-v7.3.4rc1' steps: From 6767fd0bec4e7800f41903af18ad059f2d09a8fc Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 17:31:12 +0300 Subject: [PATCH 09/11] removed logs, added multiarch support for toolcache --- __tests__/data/pypy.json | 62 ++++++++++++++++++++-------------------- dist/index.js | 11 +++++-- src/find-pypy.ts | 16 ++++++++++- src/install-pypy.ts | 1 - 4 files changed, 55 insertions(+), 35 deletions(-) diff --git a/__tests__/data/pypy.json b/__tests__/data/pypy.json index 8a9922c19..c8889a3b5 100644 --- a/__tests__/data/pypy.json +++ b/__tests__/data/pypy.json @@ -96,38 +96,38 @@ "latest_pypy": false, "date": "2021-03-19", "files": [ - { - "filename": "pypy2.7-v7.3.4rc1-aarch64.tar.bz2", - "arch": "aarch64", - "platform": "linux", - "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-aarch64.tar.bz2" - }, - { - "filename": "pypy2.7-v7.3.4rc1-linux32.tar.bz2", - "arch": "i686", - "platform": "linux", - "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-linux32.tar.bz2" - }, - { - "filename": "pypy2.7-v7.3.4rc1-linux64.tar.bz2", - "arch": "x64", - "platform": "linux", - "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-linux64.tar.bz2" - }, - { - "filename": "pypy2.7-v7.3.4rc1-osx64.tar.bz2", - "arch": "x64", - "platform": "darwin", - "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-osx64.tar.bz2" - }, - { - "filename": "pypy2.7-v7.3.4rc1-win64.zip", - "arch": "x64", - "platform": "win64", - "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-win64.zip" - } + { + "filename": "pypy2.7-v7.3.4rc1-aarch64.tar.bz2", + "arch": "aarch64", + "platform": "linux", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-aarch64.tar.bz2" + }, + { + "filename": "pypy2.7-v7.3.4rc1-linux32.tar.bz2", + "arch": "i686", + "platform": "linux", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-linux32.tar.bz2" + }, + { + "filename": "pypy2.7-v7.3.4rc1-linux64.tar.bz2", + "arch": "x64", + "platform": "linux", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-linux64.tar.bz2" + }, + { + "filename": "pypy2.7-v7.3.4rc1-osx64.tar.bz2", + "arch": "x64", + "platform": "darwin", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-osx64.tar.bz2" + }, + { + "filename": "pypy2.7-v7.3.4rc1-win64.zip", + "arch": "x64", + "platform": "win64", + "download_url": "https://test.downloads.python.org/pypy/pypy2.7-v7.3.4rc1-win64.zip" + } ] - }, + }, { "pypy_version": "7.3.3rc2", "python_version": "3.7.7", diff --git a/dist/index.js b/dist/index.js index 700467159..151dcba4b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1133,7 +1133,9 @@ exports.findPyPyVersion = findPyPyVersion; function findPyPyToolCache(pythonVersion, pypyVersion, architecture) { let resolvedPyPyVersion = ''; let resolvedPythonVersion = ''; - let installDir = tc.find('PyPy', pythonVersion, architecture); + let installDir = utils_1.IS_WINDOWS + ? findPyPyInstallDirForWindows(pythonVersion) + : tc.find('PyPy', pythonVersion, architecture); if (installDir) { // 'tc.find' finds tool based on Python version but we also need to check // whether PyPy version satisfies requested version. @@ -1177,6 +1179,12 @@ function parsePyPyVersion(versionSpec) { }; } exports.parsePyPyVersion = parsePyPyVersion; +function findPyPyInstallDirForWindows(pythonVersion) { + let installDir = ''; + utils_1.WINDOWS_ARCHS.forEach(architecture => (installDir = installDir || tc.find('PyPy', pythonVersion, architecture))); + return installDir; +} +exports.findPyPyInstallDirForWindows = findPyPyInstallDirForWindows; /***/ }), @@ -2933,7 +2941,6 @@ function pypyVersionToSemantic(versionSpec) { } exports.pypyVersionToSemantic = pypyVersionToSemantic; function isArchPresentForWindows(item) { - core.info(JSON.stringify(item)); return item.files.some((file) => utils_1.WINDOWS_ARCHS.includes(file.arch) && utils_1.WINDOWS_PLATFORMS.includes(file.platform)); } diff --git a/src/find-pypy.ts b/src/find-pypy.ts index 700ce9ee5..d809a4f27 100644 --- a/src/find-pypy.ts +++ b/src/find-pypy.ts @@ -2,6 +2,7 @@ import * as path from 'path'; import * as pypyInstall from './install-pypy'; import { IS_WINDOWS, + WINDOWS_ARCHS, validateVersion, getPyPyVersionFromPath, readExactPyPyVersionFile, @@ -67,7 +68,9 @@ export function findPyPyToolCache( ) { let resolvedPyPyVersion = ''; let resolvedPythonVersion = ''; - let installDir: string | null = tc.find('PyPy', pythonVersion, architecture); + let installDir: string | null = IS_WINDOWS + ? findPyPyInstallDirForWindows(pythonVersion) + : tc.find('PyPy', pythonVersion, architecture); if (installDir) { // 'tc.find' finds tool based on Python version but we also need to check @@ -129,3 +132,14 @@ export function parsePyPyVersion(versionSpec: string): IPyPyVersionSpec { pythonVersion: pythonVersion }; } + +export function findPyPyInstallDirForWindows(pythonVersion: string): string { + let installDir = ''; + + WINDOWS_ARCHS.forEach( + architecture => + (installDir = installDir || tc.find('PyPy', pythonVersion, architecture)) + ); + + return installDir; +} diff --git a/src/install-pypy.ts b/src/install-pypy.ts index 405275152..402525ab3 100644 --- a/src/install-pypy.ts +++ b/src/install-pypy.ts @@ -195,7 +195,6 @@ export function pypyVersionToSemantic(versionSpec: string) { } export function isArchPresentForWindows(item: any) { - core.info(JSON.stringify(item)); return item.files.some( (file: any) => WINDOWS_ARCHS.includes(file.arch) && From 96cc2da1ea97645f56e87486eed28ff1da69c40b Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Thu, 8 Apr 2021 18:18:23 +0300 Subject: [PATCH 10/11] reduced test matrix --- .github/workflows/test-pypy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-pypy.yml b/.github/workflows/test-pypy.yml index 65bd64873..547d03419 100644 --- a/.github/workflows/test-pypy.yml +++ b/.github/workflows/test-pypy.yml @@ -28,9 +28,8 @@ jobs: - 'pypy-3.7-v7.3.2' - 'pypy-3.6-v7.3.x' - 'pypy-3.7-v7.x' - - 'pypy-3.6-v7.3.3rc1' - - 'pypy-3.7-nightly' - 'pypy-2.7-v7.3.4rc1' + - 'pypy-3.7-nightly' steps: - name: Checkout From d5b8d9b7549fec2a8c0eb09a3770dcd34d10e837 Mon Sep 17 00:00:00 2001 From: AlyonaSviridenko Date: Fri, 9 Apr 2021 12:56:20 +0300 Subject: [PATCH 11/11] removed extra condition about arch --- dist/index.js | 4 ---- src/find-pypy.ts | 5 ----- 2 files changed, 9 deletions(-) diff --git a/dist/index.js b/dist/index.js index 151dcba4b..16cab2276 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1108,10 +1108,6 @@ function findPyPyVersion(versionSpec, architecture) { let resolvedPythonVersion = ''; let installDir; const pypyVersionSpec = parsePyPyVersion(versionSpec); - // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64. - if (utils_1.IS_WINDOWS && architecture === 'x64') { - architecture = 'x86'; - } ({ installDir, resolvedPythonVersion, resolvedPyPyVersion } = findPyPyToolCache(pypyVersionSpec.pythonVersion, pypyVersionSpec.pypyVersion, architecture)); if (!installDir) { ({ diff --git a/src/find-pypy.ts b/src/find-pypy.ts index d809a4f27..eb8dfac65 100644 --- a/src/find-pypy.ts +++ b/src/find-pypy.ts @@ -28,11 +28,6 @@ export async function findPyPyVersion( const pypyVersionSpec = parsePyPyVersion(versionSpec); - // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64. - if (IS_WINDOWS && architecture === 'x64') { - architecture = 'x86'; - } - ({installDir, resolvedPythonVersion, resolvedPyPyVersion} = findPyPyToolCache( pypyVersionSpec.pythonVersion, pypyVersionSpec.pypyVersion,