8000 Create missing `pypyX.Y` symlinks (#347) · python-machine-lrn/setup-python@1ce3088 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ce3088

Browse files
authored
Create missing pypyX.Y symlinks (actions#347)
`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 actions#346
1 parent c36dc43 commit 1ce3088

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
@@ -10283,11 +10283,14 @@ function createPyPySymlink(pypyBinaryPath, pythonVersion) {
1028310283
return __awaiter(this, void 0, void 0, function* () {
1028410284
const version = semver.coerce(pythonVersion);
1028510285
const pythonBinaryPostfix = semver.major(version);
10286+
const pythonMinor = semver.minor(version);
1028610287
const pypyBinaryPostfix = pythonBinaryPostfix === 2 ? '' : '3';
10288+
const pypyMajorMinorBinaryPostfix = `${pythonBinaryPostfix}.${pythonMinor}`;
1028710289
let binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
1028810290
core.info('Creating symlinks...');
1028910291
utils_1.createSymlinkInFolder(pypyBinaryPath, `pypy${pypyBinaryPostfix}${binaryExtension}`, `python${pythonBinaryPostfix}${binaryExtension}`, true);
1029010292
utils_1.createSymlinkInFolder(pypyBinaryPath, `pypy${pypyBinaryPostfix}${binaryExtension}`, `python${binaryExtension}`, true);
10293+
utils_1.createSymlinkInFolder(pypyBinaryPath, `pypy${pypyBinaryPostfix}${binaryExtension}`, `pypy${pypyMajorMinorBinaryPostfix}${binaryExtension}`, true);
1029110294
});
1029210295
}
1029310296
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