summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJames E.H. Turner <jturner@gemini.edu>2016-09-01 19:46:41 -0400
committerJames E.H. Turner <jturner@gemini.edu>2016-09-01 19:46:41 -0400
commit1e052387056cd49efecffc4dc3128d955f06956e (patch)
tree9560f84fda50ae413d3594cb56cd3e57ef38f15b /scripts
parent1c431a933c12ca0cf928a382df3b5ab3ceb971d4 (diff)
downloadastroconda-iraf-helpers-1e052387056cd49efecffc4dc3128d955f06956e.tar.gz
A common post-install script for AstroConda IRAF packages (which runs python on ac_update_extern_pkg directly, instead of messing with its interpreter path).
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ac_config_iraf_pkg30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/ac_config_iraf_pkg b/scripts/ac_config_iraf_pkg
new file mode 100755
index 0000000..32fae6b
--- /dev/null
+++ b/scripts/ac_config_iraf_pkg
@@ -0,0 +1,30 @@
+# A post-install script for AstroConda IRAF packages (to update extern.pkg),
+# which gets executed automatically when doing "conda install".
+
+script_dir=`dirname "$0"`
+name=$1
+
+if [ -z "$1" -o -n "$2" ]; then
+ echo "Usage: `basename "$0"` NAME"
+ exit 1
+fi
+
+if [ -z "$PREFIX" -o ! -d "$PREFIX" ]; then
+ echo "ERROR: \$PREFIX not set/found (script should be invoked by"\
+ "\"conda install\")" >&2
+ exit 1
+fi
+
+# The Python script for updating extern.pkg must be invoked in the following
+# way because conda insists on mangling its interpreter path and does not put
+# it back to something functional before the post install step happens :-(.
+# Both the LSB and MacOS define Python in /usr/bin as standard (used to avoid
+# dependence on the state of the Anaconda environment during installation).
+
+if /usr/bin/python "$script_dir/ac_update_extern_pkg" "$PREFIX" $name; then
+ echo "Updated extern.pkg file" >> "$PREFIX/.messages.txt"
+else
+ echo "ERROR: failed to update extern.pkg" >&2
+ exit 1
+fi
+