-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·69 lines (56 loc) · 1.68 KB
/
build.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -euf -o pipefail
generator_version=$(git describe --tags --always)
echo "GATK CWL generator: gatk-cwl-generator-${generator_version}"
VERSIONS=( 3.5-0 3.6-0 3.7-0 3.8-0 4.0.0.0 )
tarbase="gatk-cwl-generator-${generator_version}-gatk_cmdline_tools"
tmpdir=$(mktemp -d)
python_bin=$(which python3)
if [ -z "${USE_EXISTING_PYTHON+x}" ]; then
echo "Using ${python_bin} to generate temporary virtualenv ${tmpdir}/venv"
set -x
${python_bin} -m virtualenv "${tmpdir}/venv" -p python3
set +x
echo "Activating virtualenv in ${tmpdir}/venv"
set +u # virtualenv activate script references unset vars
. "${tmpdir}/venv/bin/activate"
set -u
echo "Installing requirements in virtualenv"
set -x
pip install -r requirements.txt
set +x
else
echo "Using existing python enviroment"
fi
builddir="${tmpdir}/${tarbase}"
mkdir -p "${builddir}"
echo "Building CWL in ${builddir} for GATK versions ${VERSIONS[@]}"
for ver in ${VERSIONS[@]}
do
echo "Generating CWL for GATK version ${ver}"
set -x
PYTHONPATH=. python -m gatkcwlgenerator -v ${ver} -o "${builddir}/${ver}" "$@"
set +x
done
if [ -z "${USE_EXISTING_PYTHON+x}" ]; then
echo "Deactivating virtualenv"
deactivate
fi
echo "Generating zip file"
set -x
( cd "${tmpdir}"; zip -r ${tarbase}.zip ${tarbase} )
set +x
cp "${tmpdir}/${tarbase}.zip" ./
echo "Generating tgz file"
set -x
( cd "${tmpdir}"; tar zcvf ${tarbase}.tgz ${tarbase}/ )
set +x
cp "${tmpdir}/${tarbase}.tgz" ./
echo "Generating .tar.bz2 file"
set -x
( cd "${tmpdir}"; tar jcvf ${tarbase}.tar.bz2 ${tarbase}/ )
set +x
cp "${tmpdir}/${tarbase}.tar.bz2" ./
echo "Removing tmpdir: ${tmpdir}"
rm -rf "${tmpdir}"
echo "Done."