Skip to content

Commit cf9ad45

Browse files
committed
Add pypy3.7 7.3.5
Fix #1099
1 parent de3fa74 commit cf9ad45

File tree

6 files changed

+98
-10
lines changed

6 files changed

+98
-10
lines changed

README.rst

Lines changed: 3 additions & 1 deletion
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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ 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+
COPY build_scripts/pypy.sha256 /build_scripts/pypy.sha256
137+
RUN manylinux-entrypoint /build_scripts/install-pypy.sh 3.7 7.3.5rc3
135138
COPY --from=build_cpython36 /opt/_internal /opt/_internal/
136139
COPY --from=build_cpython37 /opt/_internal /opt/_internal/
137140
COPY --from=build_cpython38 /opt/_internal /opt/_internal/
@@ -144,7 +147,7 @@ FROM runtime_base
144147
COPY --from=build_git /manylinux-rootfs /
145148
COPY --from=build_swig /manylinux-rootfs /
146149
COPY --from=build_cpython /manylinux-rootfs /
147-
COPY --from=all_cpython /opt/_internal /opt/_internal/
150+
COPY --from=all_python /opt/_internal /opt/_internal/
148151
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/
149152
RUN manylinux-entrypoint /build_scripts/finalize.sh && rm -rf /build_scripts
150153

docker/build_scripts/finalize.sh

Lines changed: 6 additions & 2 deletions
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,7 +28,11 @@ 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}
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+
fi
3236
done
3337

3438
# Create venv for auditwheel & certifi

docker/build_scripts/install-pypy.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
# make sure this tarball is listed in pypy.sha256
43+
grep " ${TARBALL}\$" ${MY_DIR}/pypy.sha256 > /dev/null
44+
# then check sha256 sum
45+
sha256sum -c --ignore-missing ${MY_DIR}/pypy.sha256
46+
47+
tar -xf ${TARBALL}
48+
49+
# the new PyPy 3 distributions don't have pypy symlinks to pypy3
50+
if [ ! -f "${TMPDIR}/bin/pypy" ]; then
51+
ln -s pypy3 ${TMPDIR}/bin/pypy
52+
fi
53+
54+
# rename the directory to something shorter like pypy3.7-7.3.4
55+
PREFIX=${PREFIX}/$(get_shortdir ${TMPDIR}/bin/pypy)
56+
mv ${TMPDIR} ${PREFIX}
57+
58+
# add a generic "python" symlink
59+
if [ ! -f "${PREFIX}/bin/python" ]; then
60+
ln -s pypy ${PREFIX}/bin/python
61+
fi
62+
63+
# remove debug symbols
64+
rm ${PREFIX}/bin/*.debug
65+
66+
# We do not need the Python test suites
67+
find ${PREFIX} -depth \( -type d -a -name test -o -name tests \) | xargs rm -rf
68+
69+
# We do not need precompiled .pyc and .pyo files.
70+
clean_pyc ${PREFIX}

docker/build_scripts/pypy.sha256

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dbf579f7eb5c527d37ecd43da88cbad02920881b608eb7486d70b4fa31bfc146 pypy3.7-v7.3.5rc3-aarch64.tar.bz2
2+
d2daf8b1966497d09be703b939bd0020394e0738095243396b3d5f87cef0d815 pypy3.7-v7.3.5rc3-linux32.tar.bz2
3+
1f9712fa86a50b1de00eb776f3e99033c2a7911dceaa8bc9daf77aa3d2a95842 pypy3.7-v7.3.5rc3-linux64.tar.bz2

tests/run_tests.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@ 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 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+
fi
37+
# pythonX.Y / pypyX.Y shall be available directly in PATH
38+
LINK_VERSION=$(${LINK_PREFIX}${PYVERS} -V)
3339
REAL_VERSION=$(${PYTHON} -V)
3440
test "${LINK_VERSION}" = "${REAL_VERSION}"
3541
done

0 commit comments

Comments
 (0)