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='python2'
|
11 | WEDGE_VERSION='2.7.18'
|
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 | time $src_dir/configure --prefix=$install_dir
|
28 |
|
29 | time make
|
30 |
|
31 | popd
|
32 | }
|
33 |
|
34 | wedge-install() {
|
35 | local build_dir=$1
|
36 | local install_dir=$2
|
37 |
|
38 | pushd $build_dir
|
39 |
|
40 | # It makes a symlink called python2
|
41 | #
|
42 | # TODO: minimize the size? There are some duplicate files
|
43 | time make install
|
44 |
|
45 | # Size optimization, remove these 2 files
|
46 | # /wedge/oils-for-unix.org/pkg/python2/2.7.18/lib/libpython2.7.a
|
47 | # /wedge/oils-for-unix.org/pkg/python2/2.7.18/lib/python2.7/config/libpython2.7.a
|
48 | #
|
49 | # This is like --without-static-libpython in Python 3
|
50 | # https://bugs.python.org/issue43103
|
51 | #
|
52 | # but Python 2 doesn't support it
|
53 | find $install_dir -name '*.a' | xargs rm -v -f
|
54 |
|
55 | popd
|
56 | }
|
57 |
|
58 | wedge-smoke-test() {
|
59 | local install_dir=$1
|
60 |
|
61 | $install_dir/bin/python2 -c 'print("hi from python 2")'
|
62 | }
|