10000 Create missing `pypyX.Y` symlinks · actions/setup-python@156f48c · GitHub
[go: up one dir, main page]

Skip to content

Commit 156f48c

Browse files
committed
Create missing pypyX.Y symlinks
`pypyX.Y.exe` executables are missing from PyPy archives on Windows before v7.3.9 (X.Y < 3.9) `pypy2.7` symlinks are also missing from macOS/Linux PyPy archives before v7.3.9 relates to #346
1 parent 9c644ca commit 156f48c

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

.github/workflows/test-pypy.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,17 @@ jobs:
4444

4545
- name: Run simple code
4646
run: python -c 'import math; print(math.factorial(5))'
47+
48+
- name: Assert PyPy is running
49+
run: |
50+
import platform
51+
assert platform.python_implementation().lower() == "pypy"
52+
shell: python
53+
54+
- name: Assert expected binaries (or symlinks) are present
55+
run: |
56+
EXECUTABLE=${{ matrix.pypy }}
57+
EXECUTABLE=${EXECUTABLE/-/} # remove the first '-' in "pypy-X.Y" -> "pypyX.Y" to match executable name
58+
EXECUTABLE=${EXECUTABLE%%-*} # remove any -* suffixe
59+
${EXECUTABLE} --version
60+
shell: bash

dist/setup/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10270,11 +10270,14 @@ function createPyPySymlink(pypyBinaryPath, pythonVersion) {
1027010270
return __awaiter(this, void 0, void 0, function* () {
1027110271
const version = semver.coerce(pythonVersion);
1027210272
const pythonBinaryPostfix = semver.major(version);
10273+
const pythonMinor = semver.minor(version);
1027310274
const pypyBinaryPostfix = pythonBinaryPostfix === 2 ? '' : '3';
10275+
const pypyMajorMinorBinaryPostfix = `${pythonBinaryPostfix}.${pythonMinor}`;
1027410276
let binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
1027510277
core.info('Creating symlinks...');
1027610278
utils_1.createSymlinkInFolder(pypyBinaryPath, `pypy${pypyBinaryPostfix}${binaryExtension}`, `python${pythonBinaryPostfix}${binaryExtension}`, true);
1027710279
utils_1.createSymlinkInFolder(pypyBinaryPath, `pypy${pypyBinaryPostfix}${binaryExtension}`, `python${binaryExtension}`, true);
10280+
utils_1.createSymlinkInFolder(pypyBinaryPath, `pypy${pypyBinaryPostfix}${binaryExtension}`, `pypy${pypyMajorMinorBinaryPostfix}${binaryExtension}`, true);
1027810281
});
1027910282
}
1028010283
function installPip(pythonLocation) {

src/install-pypy.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ async function createPyPySymlink(
9898
) {
9999
const version = semver.coerce(pythonVersion)!;
100100
const pythonBinaryPostfix = semver.major(version);
101+
const pythonMinor = semver.minor(version);
101102
const pypyBinaryPostfix = pythonBinaryPostfix === 2 ? '' : '3';
103+
const pypyMajorMinorBinaryPostfix = `${pythonBinaryPostfix}.${pythonMinor}`;
102104
let binaryExtension = IS_WINDOWS ? '.exe' : '';
103105

104106
core.info('Creating symlinks...');
@@ -115,6 +117,13 @@ async function createPyPySymlink(
115117
`python${binaryExtension}`,
116118
true
117119
);
120+
121+
createSymlinkInFolder(
122+
pypyBinaryPath,
123+
`pypy${pypyBinaryPostfix}${binaryExtension}`,
124+
`pypy${pypyMajorMinorBinaryPostfix}${binaryExtension}`,
125+
true
126+
);
118127
}
119128

120129
async function installPip(pythonLocation: string) {

0 commit comments

Comments
 (0)
0