removed logs, added multiarch support for toolcache

This commit is contained in:
AlyonaSviridenko 2021-04-08 17:31:12 +03:00
parent 401fc93a1b
commit 6767fd0bec
4 changed files with 55 additions and 35 deletions

11
dist/index.js vendored
View file

@ -1133,7 +1133,9 @@ exports.findPyPyVersion = findPyPyVersion;
function findPyPyToolCache(pythonVersion, pypyVersion, architecture) { function findPyPyToolCache(pythonVersion, pypyVersion, architecture) {
let resolvedPyPyVersion = ''; let resolvedPyPyVersion = '';
let resolvedPythonVersion = ''; let resolvedPythonVersion = '';
let installDir = tc.find('PyPy', pythonVersion, architecture); let installDir = utils_1.IS_WINDOWS
? findPyPyInstallDirForWindows(pythonVersion)
: tc.find('PyPy', pythonVersion, architecture);
if (installDir) { if (installDir) {
// 'tc.find' finds tool based on Python version but we also need to check // 'tc.find' finds tool based on Python version but we also need to check
// whether PyPy version satisfies requested version. // whether PyPy version satisfies requested version.
@ -1177,6 +1179,12 @@ function parsePyPyVersion(versionSpec) {
}; };
} }
exports.parsePyPyVersion = parsePyPyVersion; 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; exports.pypyVersionToSemantic = pypyVersionToSemantic;
function isArchPresentForWindows(item) { function isArchPresentForWindows(item) {
core.info(JSON.stringify(item));
return item.files.some((file) => utils_1.WINDOWS_ARCHS.includes(file.arch) && return item.files.some((file) => utils_1.WINDOWS_ARCHS.includes(file.arch) &&
utils_1.WINDOWS_PLATFORMS.includes(file.platform)); utils_1.WINDOWS_PLATFORMS.includes(file.platform));
} }

View file

@ -2,6 +2,7 @@ import * as path from 'path';
import * as pypyInstall from './install-pypy'; import * as pypyInstall from './install-pypy';
import { import {
IS_WINDOWS, IS_WINDOWS,
WINDOWS_ARCHS,
validateVersion, validateVersion,
getPyPyVersionFromPath, getPyPyVersionFromPath,
readExactPyPyVersionFile, readExactPyPyVersionFile,
@ -67,7 +68,9 @@ export function findPyPyToolCache(
) { ) {
let resolvedPyPyVersion = ''; let resolvedPyPyVersion = '';
let resolvedPythonVersion = ''; 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) { if (installDir) {
// 'tc.find' finds tool based on Python version but we also need to check // '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 pythonVersion: pythonVersion
}; };
} }
export function findPyPyInstallDirForWindows(pythonVersion: string): string {
let installDir = '';
WINDOWS_ARCHS.forEach(
architecture =>
(installDir = installDir || tc.find('PyPy', pythonVersion, architecture))
);
return installDir;
}

View file

@ -195,7 +195,6 @@ export function pypyVersionToSemantic(versionSpec: string) {
} }
export function isArchPresentForWindows(item: any) { export function isArchPresentForWindows(item: any) {
core.info(JSON.stringify(item));
return item.files.some( return item.files.some(
(file: any) => (file: any) =>
WINDOWS_ARCHS.includes(file.arch) && WINDOWS_ARCHS.includes(file.arch) &&