|
2 | 2 |
|
3 | 3 | set -euo pipefail |
4 | 4 |
|
5 | | -# Make sure we are on the correct folder before beginning |
| 5 | +# Capture the script's absolute directory before any cd |
6 | 6 | if [[ "$OSTYPE" == "darwin"* ]]; then |
7 | | - cd "$(dirname $(perl -e 'use Cwd "abs_path";print abs_path(shift)' $0))/../" |
| 7 | + _script_dir="$(dirname $(perl -e 'use Cwd "abs_path";print abs_path(shift)' $0))" |
8 | 8 | else |
9 | | - cd "$(dirname $(readlink -f $0))/../" |
| 9 | + _script_dir="$(dirname $(readlink -f $0))" |
10 | 10 | fi |
11 | 11 |
|
| 12 | +# Make sure we are on the correct folder before beginning |
| 13 | +cd "${_script_dir}/../" |
| 14 | + |
12 | 15 | # package versions |
13 | 16 | klayoutVersion=0.30.7 |
14 | 17 | if [[ "$OSTYPE" == "darwin"* ]]; then |
@@ -36,23 +39,24 @@ _installPipCommon() { |
36 | 39 | source /opt/rh/rh-python38/enable |
37 | 40 | set -u |
38 | 41 | fi |
39 | | - local pkgs="pandas numpy firebase_admin click pyyaml yamlfix" |
| 42 | + local lockfile |
| 43 | + lockfile="${_script_dir}/requirements-common_lock.txt" |
40 | 44 | if [[ "$OSTYPE" == "darwin"* ]]; then |
41 | 45 | if [[ "$EUID" -eq 0 ]]; then |
42 | 46 | echo "Error: Do NOT run with sudo." |
43 | 47 | exit 1 |
44 | 48 | fi |
45 | 49 | if [[ -n "${VIRTUAL_ENV:-}" ]]; then |
46 | | - pip3 install --no-cache-dir -U $pkgs |
| 50 | + pip3 install --no-cache-dir -r "$lockfile" |
47 | 51 | else |
48 | 52 | echo "Error: Activate a virtual environment on macOS." |
49 | 53 | exit 1 |
50 | 54 | fi |
51 | 55 | else |
52 | 56 | if [[ $(id -u) == 0 ]]; then |
53 | | - pip3 install --no-cache-dir -U $pkgs |
| 57 | + pip3 install --no-cache-dir -r "$lockfile" |
54 | 58 | else |
55 | | - pip3 install --no-cache-dir --user -U $pkgs |
| 59 | + pip3 install --no-cache-dir --user -r "$lockfile" |
56 | 60 | fi |
57 | 61 | fi |
58 | 62 | } |
|
0 commit comments