Skip to content

Commit 0055e58

Browse files
committed
Add pypy3.7 7.3.4
Fix pypa#1099
1 parent adc51c0 commit 0055e58

File tree

5 files changed

+94
-14
lines changed

5 files changed

+94
-14
lines changed

README.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ Image content
146146

147147
All images currently contain:
148148

149-
- CPython 3.5, 3.6, 3.7, 3.8 and 3.9, installed in
149+
- CPython 3.6, 3.7, 3.8 and 3.9, PyPy 3.7 installed in
150150
``/opt/python/<python tag>-<abi tag>``. The directories are named
151151
after the PEP 425 tags for each environment --
152152
e.g. ``/opt/python/cp37-cp37m`` contains a CPython 3.7 build, and
@@ -165,6 +165,8 @@ default ``sys.abiflags`` became an empty string: the ``m`` flag for pymalloc
165165
became useless (builds with and without pymalloc are ABI compatible) and so has
166166
been removed. (e.g. ``/opt/python/cp38-cp38``)
167167

168+
Note that PyPy is not available on ppc64le & s390x.
169+
168170
Building Docker images
169171
----------------------
170172

docker/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ COPY build_scripts/cpython-pubkey-310-311.txt /build_scripts/cpython-pubkeys.txt
131131
RUN manylinux-entrypoint /build_scripts/build-cpython.sh 3.10.0b1
132132

133133

134-
FROM build_cpython AS all_cpython
134+
FROM build_cpython AS all_python
135+
COPY build_scripts/install-pypy.sh /build_scripts/install-pypy.sh
136+
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.7 7.3.4
135137
COPY --from=build_cpython36 /opt/_internal /opt/_internal/
136138
COPY --from=build_cpython37 /opt/_internal /opt/_internal/
137139
COPY --from=build_cpython38 /opt/_internal /opt/_internal/
@@ -144,7 +146,7 @@ FROM runtime_base
144146
COPY --from=build_git /manylinux-rootfs /
145147
COPY --from=build_swig /manylinux-rootfs /
146148
COPY --from=build_cpython /manylinux-rootfs /
147-
COPY --from=all_cpython /opt/_internal /opt/_internal/
149+
COPY --from=all_python /opt/_internal /opt/_internal/
148150
COPY build_scripts/finalize.sh build_scripts/update-system-packages.sh build_scripts/python-tag-abi-tag.py build_scripts/requirements.txt build_scripts/requirements-tools.txt /build_scripts/
149151
RUN manylinux-entrypoint /build_scripts/finalize.sh && rm -rf /build_scripts
150152

docker/build_scripts/finalize.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MY_DIR=$(dirname "${BASH_SOURCE[0]}")
1010
source $MY_DIR/build_utils.sh
1111

1212
mkdir /opt/python
13-
for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 -name 'cpython*'); do
13+
for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 \( -name 'cpython*' -o -name 'pypy*' \)); do
1414
# Some python's install as bin/python3. Make them available as
1515
# bin/python.
1616
if [ -e ${PREFIX}/bin/python3 ] && [ ! -e ${PREFIX}/bin/python ]; then
@@ -28,8 +28,12 @@ for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 -name 'cpython*');
2828
ln -s ${PREFIX} /opt/python/${ABI_TAG}
2929
# Make versioned python commands available directly in environment.
3030
PYVERS=$(${PREFIX}/bin/python -c "import sys; print('.'.join(map(str, sys.version_info[:2])))")
31-
ln -s ${PREFIX}/bin/python /usr/local/bin/python${PYVERS}
32-
ln -s ${PREFIX}/bin/pip /usr/local/bin/pip${PYVERS}
31+
if [[ "${PREFIX}" == *"/pypy"* ]]; then
32+
ln -s ${PREFIX}/bin/python /usr/local/bin/pypy${PYVERS}
33+
else
34+
ln -s ${PREFIX}/bin/python /usr/local/bin/python${PYVERS}
35+
ln -s ${PREFIX}/bin/pip /usr/local/bin/pip${PYVERS}
36+
fi
3337
done
3438

3539
# Create venv for auditwheel & certifi

docker/build_scripts/install-pypy.sh

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
# Stop at any error, show all commands
4+
set -exuo pipefail
5+
6+
# Get script directory
7+
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
8+
9+
# Get build utilities
10+
source $MY_DIR/build_utils.sh
11+
12+
13+
PYTHON_VERSION=$1
14+
PYPY_VERSION=$2
15+
PYPY_DOWNLOAD_URL=https://downloads.python.org/pypy
16+
17+
18+
function get_shortdir {
19+
local exe=$1
20+
$exe -c 'import sys; print("pypy%d.%d-%d.%d.%d" % (sys.version_info[:2]+sys.pypy_version_info[:3]))'
21+
}
22+
23+
24+
mkdir -p /tmp
25+
cd /tmp
26+
27+
case ${AUDITWHEEL_ARCH} in
28+
x86_64) PYPY_ARCH=linux64;;
29+
i686) PYPY_ARCH=linux32;;
30+
aarch64) PYPY_ARCH=aarch64;;
31+
*) echo "No PyPy for ${AUDITWHEEL_ARCH}"; exit 0;;
32+
esac
33+
34+
TARBALL=pypy${PYTHON_VERSION}-v${PYPY_VERSION}-${PYPY_ARCH}.tar.bz2
35+
TMPDIR=/tmp/${TARBALL/.tar.bz2//}
36+
PREFIX="/opt/_internal"
37+
38+
mkdir -p ${PREFIX}
39+
40+
fetch_source ${TARBALL} ${PYPY_DOWNLOAD_URL}
41+
42+
tar -xf ${TARBALL}
43+
44+
# the new PyPy 3 distributions don't have pypy symlinks to pypy3
45+
if [ ! -f "${TMPDIR}/bin/pypy" ]; then
46+
ln -s pypy3 ${TMPDIR}/bin/pypy
47+
fi
48+
49+
# rename the directory to something shorter like pypy3.7-7.3.4
50+
PREFIX=${PREFIX}/$(get_shortdir ${TMPDIR}/bin/pypy)
51+
mv ${TMPDIR} ${PREFIX}
52+
53+
# add a generic "python" symlink
54+
if [ ! -f "${PREFIX}/bin/python" ]; then
55+
ln -s pypy ${PREFIX}/bin/python
56+
fi
57+
58+
# remove debug symbols
59+
rm ${PREFIX}/bin/*.debug
60+
61+
# We do not need the Python test suites
62+
find ${PREFIX} -depth \( -type d -a -name test -o -name tests \) | xargs rm -rf
63+
64+
# We do not need precompiled .pyc and .pyo files.
65+
clean_pyc ${PREFIX}

tests/run_tests.sh

+15-8
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,24 @@ for PYTHON in /opt/python/*/bin/python; do
2424
$PYTHON $MY_DIR/manylinux-check.py ${AUDITWHEEL_POLICY} ${AUDITWHEEL_ARCH}
2525
# Make sure that SSL cert checking works
2626
$PYTHON $MY_DIR/ssl-check.py
27-
# Make sure sqlite3 module can be loaded properly and is the manylinux version one
28-
# c.f. https://github.com/pypa/manylinux/issues/1030
29-
$PYTHON -c 'import sqlite3; print(sqlite3.sqlite_version); assert sqlite3.sqlite_version_info[0:2] >= (3, 34)'
30-
# pythonx.y & pipx.y shall be available directly in PATH
27+
IMPLEMENTATION=$(${PYTHON} -c "import sys; print(sys.implementation.name)")
3128
PYVERS=$(${PYTHON} -c "import sys; print('.'.join(map(str, sys.version_info[:2])))")
32-
LINK_VERSION=$(python${PYVERS} -V)
29+
if [ "${IMPLEMENTATION}" == "pypy" ]; then
30+
LINK_PREFIX=pypy
31+
else
32+
LINK_PREFIX=python
33+
# Make sure sqlite3 module can be loaded properly and is the manylinux version one
34+
# c.f. https://github.com/pypa/manylinux/issues/1030
35+
$PYTHON -c 'import sqlite3; print(sqlite3.sqlite_version); assert sqlite3.sqlite_version_info[0:2] >= (3, 34)'
36+
# pipx.y shall be available directly in PATH
37+
LINK_VERSION=$(pip${PYVERS} -V)
38+
REAL_VERSION=$(${PYTHON} -m pip -V)
39+
test "${LINK_VERSION%% from *}" = "${REAL_VERSION%% from *}"
40+
fi
41+
# pythonx.y or pypyx.y shall be available directly in PATH
42+
LINK_VERSION=$(${LINK_PREFIX}${PYVERS} -V)
3343
REAL_VERSION=$(${PYTHON} -V)
3444
test "${LINK_VERSION}" = "${REAL_VERSION}"
35-
LINK_VERSION=$(pip${PYVERS} -V)
36-
REAL_VERSION=$(${PYTHON} -m pip -V)
37-
test "${LINK_VERSION%% from *}" = "${REAL_VERSION%% from *}"
3845
done
3946

4047
# minimal tests for tools that should be present

0 commit comments

Comments
 (0)