-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_package.sh
More file actions
executable file
·40 lines (33 loc) · 1.53 KB
/
install_package.sh
File metadata and controls
executable file
·40 lines (33 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
#
# To be ran from docker build context where ngwpc source code (repositories) have been mounted to /src_ngwpc/
#
set -euo pipefail
python_exe=$1
repo_name=$2
repo_remote_tag=$3
extras=$4
if [ "$repo_remote_tag" = "LOCAL" ]; then
echo "Installing '${repo_name}' from local with extras '${extras}'"
tar --exclude=".venv" -zcf "/tmp/${repo_name}.tgz" -C "/src_ngwpc" "${repo_name}"
(set -x; ${python_exe} -m pip install /tmp/${repo_name}.tgz${extras})
rm /tmp/${repo_name}.tgz
${python_exe} add_git_info.py --local_repo_path "/src_ngwpc/${repo_name}" --output_dir "/ngen-app/git-info"
# elif tag is not empty
elif [ -n "$repo_remote_tag" ]; then
echo "Installing '${repo_name}' from GitHub at tag '${repo_remote_tag}' with extras '${extras}'"
flags=()
if [ "$repo_name" = "ngen-forcing" ]; then
flags+=("--force-reinstall")
fi
if [ -n "$extras" ]; then
(set -x; ${python_exe} -m pip install "${flags[@]}" "${repo_name}${extras} @ git+https://github.com/NGWPC/${repo_name}@${repo_remote_tag}")
else
(set -x; ${python_exe} -m pip install "${flags[@]}" "https://github.com/NGWPC/${repo_name}/archive/${repo_remote_tag}.tar.gz")
fi
# (set -x; ${python_exe} -m pip install "${repo_name}${extras} @ git+https://github.com/NGWPC/${repo_name}@${repo_remote_tag}")
${python_exe} add_git_info.py --remote_repo_name "${repo_name}" --remote_branch "${repo_remote_tag}" --output_dir "/ngen-app/git-info"
# tag is empty
else
echo "WARNING: not installing: '${repo_name}'"
fi