Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Update "pypy3" keyword to point to 3.6 for backward compatibility #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions 21 .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,24 @@ jobs:

- name: Run simple code
run: python -c 'import math; print(math.factorial(5))'

setup-pypy:
name: Setup PyPy ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-16.04, ubuntu-18.04]
steps:
- name: Checkout
uses: actions/checkout@v2

- name: setup-python pypy3
uses: ./
with:
python-version: 'pypy3'

- name: setup-python pypy2
uses: ./
with:
python-version: 'pypy2'
13 changes: 8 additions & 5 deletions 13 dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6445,7 +6445,7 @@ function installPython(workingDirectory) {
return __awaiter(this, void 0, void 0, function* () {
const options = {
cwd: workingDirectory,
env: Object.assign(Object.assign({}, process.env), IS_LINUX && { 'LD_LIBRARY_PATH': path.join(workingDirectory, 'lib') }),
env: Object.assign(Object.assign({}, process.env), (IS_LINUX && { LD_LIBRARY_PATH: path.join(workingDirectory, 'lib') })),
silent: true,
listeners: {
stdout: (data) => {
Expand Down Expand Up @@ -6718,7 +6718,7 @@ function binDir(installDir) {
// 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.
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);
if (!installDir && IS_WINDOWS) {
// PyPy only precompiles binaries for x86, but the architecture parameter defaults to x64.
Expand Down Expand Up @@ -6765,7 +6765,9 @@ function useCpythonVersion(version, architecture) {
}
core.exportVariable('pythonLocation', installDir);
if (IS_LINUX) {
const libPath = (process.env.LD_LIBRARY_PATH) ? `:${process.env.LD_LIBRARY_PATH}` : '';
const libPath = process.env.LD_LIBRARY_PATH
? `:${process.env.LD_LIBRARY_PATH}`
: '';
const pyLibPath = path.join(installDir, 'lib');
if (!libPath.split(':').includes(pyLibPath)) {
core.exportVariable('LD_LIBRARY_PATH', pyLibPath + libPath);
Expand Down Expand Up @@ -6819,9 +6821,10 @@ function findPythonVersion(version, architecture) {
return __awaiter(this, void 0, void 0, function* () {
switch (version.toUpperCase()) {
case 'PYPY2':
return usePyPy(2, architecture);
return usePyPy('2', architecture);
case 'PYPY3':
return usePyPy(3, architecture);
// keep pypy3 pointing to 3.6 for backward compatibility
return usePyPy('3.6', architecture);
default:
return yield useCpythonVersion(version, architecture);
}
Expand Down
12 changes: 8 additions & 4 deletions 12 src/find-python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ function binDir(installDir: string): string {
// 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.
// 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 {
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion.toString());
function usePyPy(
majorVersion: '2' | '3.6',
architecture: string
): InstalledVersion {
const findPyPy = tc.find.bind(undefined, 'PyPy', majorVersion);
let installDir: string | null = findPyPy(architecture);

if (!installDir && IS_WINDOWS) {
Expand Down Expand Up @@ -188,9 +191,10 @@ export async function findPythonVersion(
): Promise<InstalledVersion> {
switch (version.toUpperCase()) {
case 'PYPY2':
return usePyPy(2, architecture);
return usePyPy('2', architecture);
case 'PYPY3':
return usePyPy(3, architecture);
// keep pypy3 pointing to 3.6 for backward compatibility
return usePyPy('3.6', architecture);
default:
return await useCpythonVersion(version, architecture);
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.