8000 Fix PyPy installation on Windows to adopt new parameters format by AlenaSviridenko · Pull Request #201 · actions/setup-python · GitHub
[go: up one dir, main page]

Skip to content

Fix PyPy installation on Windows to adopt new parameters format #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed logs, added multiarch support for toolcache
  • Loading branch information
AlenaSviridenko committed Apr 8, 2021
commit 6767fd0bec4e7800f41903af18ad059f2d09a8fc
62 changes: 31 additions & 31 deletions __tests__/data/pypy.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 9 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;


/***/ }),
Expand Down Expand Up @@ -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));
}
Expand Down
16 changes: 15 additions & 1 deletion src/find-pypy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as path from 'path';
import * as pypyInstall from './install-pypy';
import {
IS_WINDOWS,
WINDOWS_ARCHS,
validateVersion,
getPyPyVersionFromPath,
readExactPyPyVersionFile,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
1 change: 0 additions & 1 deletion src/install-pypy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down
0