mirror of
https://github.com/actions/setup-python.git
synced 2025-04-24 15:32:13 +00:00
test for pypy new version notation
This commit is contained in:
parent
a1121449a2
commit
cb9573b913
4 changed files with 20 additions and 11 deletions
6
.github/workflows/test-pypy.yml
vendored
6
.github/workflows/test-pypy.yml
vendored
|
@ -23,13 +23,9 @@ jobs:
|
||||||
- 'pypy-2.7'
|
- 'pypy-2.7'
|
||||||
- 'pypy-3.6'
|
- 'pypy-3.6'
|
||||||
- 'pypy-3.7'
|
- '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.6-v7.3.3rc1'
|
||||||
- 'pypy-3.7-nightly'
|
- 'pypy-3.7-nightly'
|
||||||
|
- 'pypy-2.7-v7.3.4rc1'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
|
@ -28,9 +28,9 @@ export async function findPyPyVersion(
|
||||||
const pypyVersionSpec = parsePyPyVersion(versionSpec);
|
const pypyVersionSpec = parsePyPyVersion(versionSpec);
|
||||||
|
|
||||||
// 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.
|
||||||
if (IS_WINDOWS && architecture === 'x64') {
|
/*if (IS_WINDOWS && architecture === 'x64') {
|
||||||
architecture = 'x86';
|
architecture = 'x86';
|
||||||
}
|
}*/
|
||||||
|
|
||||||
({installDir, resolvedPythonVersion, resolvedPyPyVersion} = findPyPyToolCache(
|
({installDir, resolvedPythonVersion, resolvedPyPyVersion} = findPyPyToolCache(
|
||||||
pypyVersionSpec.pythonVersion,
|
pypyVersionSpec.pythonVersion,
|
||||||
|
|
|
@ -8,6 +8,8 @@ import fs from 'fs';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IS_WINDOWS,
|
IS_WINDOWS,
|
||||||
|
WINDOWS_ARCHS,
|
||||||
|
WINDOWS_PLATFORMS,
|
||||||
IPyPyManifestRelease,
|
IPyPyManifestRelease,
|
||||||
createSymlinkInFolder,
|
createSymlinkInFolder,
|
||||||
isNightlyKeyword,
|
isNightlyKeyword,
|
||||||
|
@ -142,10 +144,7 @@ export function findRelease(
|
||||||
isPyPyNightly ||
|
isPyPyNightly ||
|
||||||
semver.satisfies(pypyVersionToSemantic(item.pypy_version), pypyVersion);
|
semver.satisfies(pypyVersionToSemantic(item.pypy_version), pypyVersion);
|
||||||
const isArchPresent =
|
const isArchPresent =
|
||||||
item.files &&
|
item.files && (IS_WINDOWS ? isArchPresentForWindows(item) : isArchPresentForMacOrLinux(item, architecture, process.platform));
|
||||||
item.files.some(
|
|
||||||
file => file.arch === architecture && file.platform === process.platform
|
|
||||||
);
|
|
||||||
return isPythonVersionSatisfied && isPyPyVersionSatisfied && isArchPresent;
|
return isPythonVersionSatisfied && isPyPyVersionSatisfied && isArchPresent;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -191,3 +190,15 @@ export function pypyVersionToSemantic(versionSpec: string) {
|
||||||
const prereleaseVersion = /(\d+\.\d+\.\d+)((?:a|b|rc))(\d*)/g;
|
const prereleaseVersion = /(\d+\.\d+\.\d+)((?:a|b|rc))(\d*)/g;
|
||||||
return versionSpec.replace(prereleaseVersion, '$1-$2.$3');
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import * as semver from 'semver';
|
||||||
|
|
||||||
export const IS_WINDOWS = process.platform === 'win32';
|
export const IS_WINDOWS = process.platform === 'win32';
|
||||||
export const IS_LINUX = process.platform === 'linux';
|
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';
|
const PYPY_VERSION_FILE = 'PYPY_VERSION';
|
||||||
|
|
||||||
export interface IPyPyManifestAsset {
|
export interface IPyPyManifestAsset {
|
||||||
|
|
Loading…
Add table
Reference in a new issue