blob: 553bc095edcc827d6829289936a1f1c56b92ca74 (
plain) (
blame)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
#!/usr/bin/env bash
# Accepts a list of <package>=<version> specifications used
# to convert a fully stable PUBLIC conda environment into one
# that reflects exactly what needs to be tested before
# delivering an HSTDP build to DMS.
set -e
pub_channel="http://ssb.stsci.edu/astroconda"
dev_channel="http://ssb.stsci.edu/astroconda-dev"
OS="linux"
if [[ "$(uname)" == "Darwin" ]];
then
OS="osx"
fi
ARGS=""
scriptname=$(basename $0)
# Display help text when no arguments are supplied.
if [[ $# -eq 0 ]];
then
printf "
Usage: ${scriptname} [-n] [-p] [-i] packages...
-n --hstdp-name Name of HSTDP release (2018.1 etc)
-p --python Python verison to use (3.5 etc)
-i --iteration Delivery iteration number (0, 1...)
Positional arguments
A list of packages & versions of the form:
<conda_package_name>=<version_string>, <>=<>, ...
"
exit 0
fi
while (( "${#}" )); do
case "${1}" in
-n|--hstdp-name)
HSTDP_NAME=${2}
shift 2
;;
-p|--python)
PYVER=${2}
PYVER_S=${PYVER//./}
shift 2
;;
-i|--iteration)
ITER=$(printf %02d ${2})
shift 2
;;
--) # end argument parsing
shift
break
;;
-*|--*) # unsupported flags
echo "Error: Unsupported flag ${1}" >&2
exit 1
;;
*) # positional arguments
ARGS="${ARGS} ${1}"
shift
;;
esac
done
eval set -- "${ARGS}"
env_name="hstdp-${HSTDP_NAME}-${OS}-py${PYVER_S}.${ITER}"
conda create -y -q -n ${env_name} -c ${pub_channel} -c defaults python=${PYVER} stsci-hst
source activate ${env_name}
if [[ -n "$ARGS" ]];
then
conda install -y -q -c ${dev_channel} -c defaults ${ARGS}
fi
printf "Writing spec file: ${env_name}.txt... "
conda list --explicit > "${env_name}.txt"
printf "Done.\n"
|