Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit 476ca37

Browse files
committed
rename the installation directory of pypy, symlink to /opt/python with the proper ABI tag, upgrade pip&co.
1 parent ec335a0 commit 476ca37

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docker/build_scripts_pypy/install_pypy.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,40 @@
22

33
set -ex
44

5+
function get_shortdir {
6+
local exe=$1
7+
$exe -c 'import sys; print("pypy%d.%d-%d.%d.%d" % (sys.version_info[:2]+sys.pypy_version_info[:3]))'
8+
}
9+
10+
# this is more or less equivalent to do_cpython_build, although we download a
11+
# prebuilt pypy instead of building it from scratch
512
function install_one_pypy {
613
local tarball=$1
14+
local basename=$(basename $tarball)
15+
local outdir=/opt/pypy/${basename/.tar.bz2//}
716

817
mkdir -p /opt/pypy
918
cd /opt/pypy
1019
tar xf $tarball
20+
21+
# rename the directory to something shorter like pypy2.7-7.1.1
22+
shortdir=$(get_shortdir $outdir/bin/pypy)
23+
mv "$outdir" "$shortdir"
24+
local pypy=$shortdir/bin/pypy
25+
26+
# remove debug symbols
27+
rm $shortdir/bin/*.debug
28+
29+
# install and upgrade pip
30+
$pypy -m ensurepip
31+
$pypy -m pip install -U --require-hashes -r /build_scripts/requirements.txt
32+
33+
local abi_tag=$($pypy /build_scripts/python-tag-abi-tag.py)
34+
ln -s /opt/pypy/$shortdir /opt/python/${abi_tag}
1135
}
1236

1337
for PYPY in /pypy*.tar.bz2
1438
do
1539
install_one_pypy "$PYPY"
40+
rm "$PYPY"
1641
done

0 commit comments

Comments
 (0)