| 1 | # Wedge definition for python3
 | 
| 2 | #
 | 
| 3 | # Loaded by deps/wedge.sh.
 | 
| 4 | 
 | 
| 5 | set -o nounset
 | 
| 6 | set -o pipefail
 | 
| 7 | set -o errexit
 | 
| 8 | 
 | 
| 9 | # sourced
 | 
| 10 | WEDGE_NAME='python3'
 | 
| 11 | WEDGE_VERSION='3.10.4'
 | 
| 12 | 
 | 
| 13 | WEDGE_TARBALL_NAME='Python'
 | 
| 14 | WEDGE_IS_ABSOLUTE=1  # This is probably a requirement, but not sure
 | 
| 15 | 
 | 
| 16 | wedge-make() {
 | 
| 17 |   local src_dir=$1
 | 
| 18 |   local build_dir=$2
 | 
| 19 |   local install_dir=$3
 | 
| 20 | 
 | 
| 21 |   pushd $build_dir
 | 
| 22 | 
 | 
| 23 |   # Note: we need PY3_BUILD_DEPS on the base image to get a working 'pip
 | 
| 24 |   # install'
 | 
| 25 |   # And then Dockerfile.* may need the corresponding runtime deps
 | 
| 26 | 
 | 
| 27 |   # --without-static-python added in 2021.  Makes the package smaller.
 | 
| 28 |   #
 | 
| 29 |   # https://github.com/python/cpython/commit/801bb0b5035f8eeafe389dc082c02dfafaa07f6a
 | 
| 30 |   # https://bugs.python.org/issue43103
 | 
| 31 | 
 | 
| 32 |   time $src_dir/configure --prefix=$install_dir --without-static-libpython
 | 
| 33 | 
 | 
| 34 |   # Note: not building in parallel, because wedges themselves can be built in
 | 
| 35 |   # parallel?
 | 
| 36 |   time make
 | 
| 37 | 
 | 
| 38 |   popd
 | 
| 39 | }
 | 
| 40 | 
 | 
| 41 | wedge-install() {
 | 
| 42 |   local build_dir=$1
 | 
| 43 |   local install_dir=$2
 | 
| 44 | 
 | 
| 45 |   pushd $build_dir
 | 
| 46 | 
 | 
| 47 |   # It makes a symlink called python3
 | 
| 48 |   #
 | 
| 49 |   # NOTE: There's no option to strip the binary?
 | 
| 50 |   # The whole package is 265 MB, but 200 MB of it is the Python stdlib.
 | 
| 51 |   # Seemingly lots of __pycache__ dirs
 | 
| 52 | 
 | 
| 53 |   time make install
 | 
| 54 | 
 | 
| 55 |   popd
 | 
| 56 | }
 | 
| 57 | 
 | 
| 58 | wedge-smoke-test() {
 | 
| 59 |   local install_dir=$1
 | 
| 60 | 
 | 
| 61 |   $install_dir/bin/python3 -c 'print("hi from python 3")'
 | 
| 62 | }
 |