1 | #!/bin/bash |
---|
2 | |
---|
3 | # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ |
---|
4 | set -euxo pipefail |
---|
5 | |
---|
6 | # The filesystem location of the wheelhouse which we'll populate with wheels |
---|
7 | # for all of our dependencies. |
---|
8 | WHEELHOUSE_PATH="$1" |
---|
9 | shift |
---|
10 | |
---|
11 | # The filesystem location of the root of a virtualenv we can use to get/build |
---|
12 | # wheels. |
---|
13 | BOOTSTRAP_VENV="$1" |
---|
14 | shift |
---|
15 | |
---|
16 | # The basename of the Python executable (found on PATH) that will be used with |
---|
17 | # this image. This lets us create a virtualenv that uses the correct Python. |
---|
18 | PYTHON="$1" |
---|
19 | shift |
---|
20 | |
---|
21 | # Set up the virtualenv as a non-root user so we can run the test suite as a |
---|
22 | # non-root user. See below. |
---|
23 | virtualenv --python "${PYTHON}" "${BOOTSTRAP_VENV}" |
---|
24 | |
---|
25 | # For convenience. |
---|
26 | PIP="${BOOTSTRAP_VENV}/bin/pip" |
---|
27 | |
---|
28 | # Tell pip where it can find any existing wheels. |
---|
29 | export PIP_FIND_LINKS="file://${WHEELHOUSE_PATH}" |
---|
30 | |
---|
31 | # Get "certifi" to avoid bug #2913. Basically if a `setup_requires=...` causes |
---|
32 | # a package to be installed (with setuptools) then it'll fail on certain |
---|
33 | # platforms (travis's OX-X 10.12, Slackware 14.2) because PyPI's TLS |
---|
34 | # requirements (TLS >= 1.2) are incompatible with the old TLS clients |
---|
35 | # available to those systems. Installing it ahead of time (with pip) avoids |
---|
36 | # this problem. Make sure this step comes before any other attempts to |
---|
37 | # install things using pip! |
---|
38 | "${PIP}" install certifi |
---|
39 | |
---|
40 | # Get a new, awesome version of pip and setuptools. For example, the |
---|
41 | # distro-packaged virtualenv's pip may not know about wheels. Get the newer |
---|
42 | # version of pip *first* in case we have a really old one now which can't even |
---|
43 | # install setuptools properly. |
---|
44 | "${PIP}" install --upgrade pip |
---|
45 | |
---|
46 | # setuptools 45 requires Python 3.5 or newer. Even though we upgraded pip |
---|
47 | # above, it may still not be able to get us a compatible version unless we |
---|
48 | # explicitly ask for one. |
---|
49 | "${PIP}" install --upgrade setuptools wheel |
---|
50 | |
---|
51 | # Just about every user of this image wants to use tox from the bootstrap |
---|
52 | # virtualenv so go ahead and install it now. |
---|
53 | "${PIP}" install "tox~=4.0" |
---|