diff options
author | Matt Rendina <rendinam@users.noreply.github.com> | 2018-02-09 09:58:38 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-09 09:58:38 -0500 |
commit | e100e816b5803a39d1274b976ed37f21490f1c4c (patch) | |
tree | 18bf3e69ef208a42d36ef6e3621a8da213144e3c /mktestenv.sh | |
parent | 7d5595d17e20572fdeec8bf3e753f7f987a18e60 (diff) | |
parent | 08a87080218f9b35344aba6563f4614a922a9056 (diff) | |
download | delivery_control-e100e816b5803a39d1274b976ed37f21490f1c4c.tar.gz |
Merge pull request #1 from rendinam/initial
initial commit
Diffstat (limited to 'mktestenv.sh')
-rwxr-xr-x | mktestenv.sh | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/mktestenv.sh b/mktestenv.sh new file mode 100755 index 0000000..553bc09 --- /dev/null +++ b/mktestenv.sh @@ -0,0 +1,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" |