OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2014 The Native Client Authors. All rights reserved. | 2 # Copyright 2014 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 # Installs required python modules using 'pip'. | 6 # Installs required python modules using 'pip'. |
7 # Always use a locally installed version of pip rather than relying | 7 # Always use a locally installed version of pip rather than relying |
8 # on the system version since the behaviour and command line flags | 8 # on the system version since the behaviour and command line flags |
9 # for pip inself vary between versions. | 9 # for pip inself vary between versions. |
10 | 10 |
11 SCRIPT_DIR="$(cd $(dirname $0) && pwd)" | 11 SCRIPT_DIR="$(cd $(dirname $0) && pwd)" |
12 ARGS="--user --no-compile" | 12 ARGS="--user --no-compile" |
13 | 13 |
14 cd "${SCRIPT_DIR}/.." | 14 cd "${SCRIPT_DIR}/.." |
15 | 15 |
16 export PYTHONUSERBASE=$PWD/out/pip | 16 export PYTHONUSERBASE=$PWD/out/pip |
17 pip_bin_dir=$PYTHONUSERBASE/bin | 17 pip_bin_dir=$PYTHONUSERBASE/bin |
18 pip_bin=$pip_bin_dir/pip | 18 pip_bin=$pip_bin_dir/pip |
19 export PATH=$PATH:$pip_bin_dir | 19 export PATH=$pip_bin_dir:$PATH |
20 | 20 |
21 if [ ! -f "$pip_bin" ]; then | 21 if [ ! -f "$pip_bin" ]; then |
22 # On first run install pip directly from the network | 22 # On first run install pip directly from the network |
23 echo "Installing pip.." | 23 echo "Installing pip.." |
24 # Use local file rather than pipeline so we can detect failure of the curl | 24 # Use local file rather than pipeline so we can detect failure of the curl |
25 # command. | 25 # command. |
26 curl --silent --show-error https://bootstrap.pypa.io/get-pip.py > get-pip.py | 26 curl --silent --show-error https://bootstrap.pypa.io/get-pip.py > get-pip.py |
27 python get-pip.py --force-reinstall --user | 27 python get-pip.py --force-reinstall --user |
28 rm -f get-pip.py | 28 rm -f get-pip.py |
29 hash -r | 29 hash -r |
30 fi | 30 fi |
31 | 31 |
32 set -x | 32 set -x |
33 # Pin locally install pip to a specific version | 33 # Pin locally install pip to a specific version |
34 pip install ${ARGS} "pip==6.0.6" | 34 pip install ${ARGS} "pip==6.0.6" |
35 | 35 |
36 # At this point we know we have good pip install in $PATH and we can use | 36 # At this point we know we have good pip install in $PATH and we can use |
37 # it to install the requirements. | 37 # it to install the requirements. |
38 pip install ${ARGS} -r requirements.txt | 38 pip install ${ARGS} -r requirements.txt |
OLD | NEW |