summaryrefslogtreecommitdiff
path: root/include/pre-common.sh
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2016-07-20 15:42:41 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2016-07-20 15:42:41 -0400
commitde413e7ae293f2b919e2e75369c1ecb8a0c83975 (patch)
tree143ea097ea9e740c48b62335d468e9b0543be7b3 /include/pre-common.sh
downloadastroconda-control-de413e7ae293f2b919e2e75369c1ecb8a0c83975.tar.gz
Initial commit
Diffstat (limited to 'include/pre-common.sh')
-rw-r--r--include/pre-common.sh71
1 files changed, 71 insertions, 0 deletions
diff --git a/include/pre-common.sh b/include/pre-common.sh
new file mode 100644
index 0000000..ac14f6f
--- /dev/null
+++ b/include/pre-common.sh
@@ -0,0 +1,71 @@
+function cleanup
+{
+ # Not a fan of ultra-verbose. This message will get lost.
+ set +x
+ echo "Trapped common exit signal (SIGINT | SIGTERM)"
+ /bin/echo
+ echo "TESTS WILL NOT BE IMPORTED"
+ /bin/echo
+ echo "Exiting..."
+ exit 1
+}
+trap cleanup SIGINT SIGTERM
+
+test_from=/srv/rt
+test_to=~/local/pillowfort
+
+if [[ `uname -s` == Darwin ]]; then
+ test_from=/Users/iraf/rt
+fi
+
+if [[ $HOSTNAME == *jwcalibdev* ]]; then
+ test_from=/data1/jwst_rt
+fi
+
+if [[ ! -d $test_to ]]; then
+ mkdir -p "$test_to"
+fi
+
+export PATH=~/miniconda3/bin:$PATH
+#export PATH=$PATH:~/local/fakedokia/bin
+#export PYTHONPATH=~/local/fakedokia/lib
+export CDBS=/grp/hst/cdbs/
+export crrefer=$CDBS
+export PYSYN_CDBS=$CDBS
+
+function mkrt_paths
+{
+ args=("$@")
+ paths=""
+
+ for elem in "${args[@]}"
+ do
+ path="$test_from/$elem"
+ if [[ ! -d $path ]]; then
+ echo "Warning: $path does not exist. Omitting."
+ continue
+ fi
+ paths+=($path)
+ done
+ printf $paths | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
+}
+
+function svn_update()
+{
+ args=("$@")
+ paths=""
+
+ for elem in "${args[@]}"
+ do
+ if [[ ! -d $elem ]]; then
+ echo "Warning: $elem does not exist. Omitting."
+ continue
+ fi
+
+ pushd "$elem" &>/dev/null
+ echo "Updating $elem ..."
+ svn up --non-interactive --accept theirs-conflict
+ popd &>/dev/null
+
+ done
+}