3
0
Fork 0
mirror of https://gitea.com/actions/setup-python.git synced 2024-11-26 12:09:35 +01:00

update dist file (#166)

This commit is contained in:
Maxim Lobanov 2020-12-08 19:00:17 +03:00 committed by GitHub
parent accf675719
commit da8703fb23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

6
dist/index.js vendored
View file

@ -6417,7 +6417,7 @@ function binDir(installDir) {
// For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha. // For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
// We only care about the Python version, so we don't use the PyPy version for the tool cache. // We only care about the Python version, so we don't use the PyPy version for the tool cache.
function usePyPy(majorVersion, architecture) { function usePyPy(majorVersion, architecture) {
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString()); const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion);
let installDir = findPyPy(architecture); let installDir = findPyPy(architecture);
if (!installDir && IS_WINDOWS) { if (!installDir && IS_WINDOWS) {
// PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64. // PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
@ -6513,9 +6513,9 @@ function findPythonVersion(version, architecture) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
switch (version.toUpperCase()) { switch (version.toUpperCase()) {
case 'PYPY2': case 'PYPY2':
return usePyPy(2, architecture); return usePyPy('2', architecture);
case 'PYPY3': case 'PYPY3':
return usePyPy(3, architecture); return usePyPy('3.6', architecture);
default: default:
return yield useCpythonVersion(version, architecture); return yield useCpythonVersion(version, architecture);
} }

View file

@ -51,8 +51,11 @@ function binDir(installDir: string): string {
// A particular version of PyPy may contain one or more versions of the Python interpreter. // A particular version of PyPy may contain one or more versions of the Python interpreter.
// For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha. // For example, PyPy 7.0 contains Python 2.7, 3.5, and 3.6-alpha.
// We only care about the Python version, so we don't use the PyPy version for the tool cache. // We only care about the Python version, so we don't use the PyPy version for the tool cache.
function usePyPy(majorVersion: 2 | 3, architecture: string): InstalledVersion { function usePyPy(
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString()); majorVersion: '2' | '3.6',
architecture: string
): InstalledVersion {
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion);
let installDir: string | null = findPyPy(architecture); let installDir: string | null = findPyPy(architecture);
if (!installDir && IS_WINDOWS) { if (!installDir && IS_WINDOWS) {
@ -186,9 +189,10 @@ export async function findPythonVersion(
): Promise<InstalledVersion> { ): Promise<InstalledVersion> {
switch (version.toUpperCase()) { switch (version.toUpperCase()) {
case 'PYPY2': case 'PYPY2':
return usePyPy(2, architecture); return usePyPy('2', architecture);
case 'PYPY3': case 'PYPY3':
return usePyPy(3, architecture); // keep pypy3 pointing to 3.6 for backward compatibility
return usePyPy('3.6', architecture);
default: default:
return await useCpythonVersion(version, architecture); return await useCpythonVersion(version, architecture);
} }