]> arthur.barton.de Git - bup.git/blobdiff - cmd/python-cmd.sh
Simplify bup startup process
[bup.git] / cmd / python-cmd.sh
index 6de5867309b89f7ee04dbd89cd20960d86da10b3..cce1b8b7bde1dabea2e80cb2c5d374c8288a1faf 100644 (file)
@@ -2,4 +2,20 @@
 
 set -e
 
+top="$(pwd)"
+cmdpath="$0"
+# loop because macos has no recursive resolution
+while test -L "$cmdpath"; do
+    link="$(readlink "$cmdpath")"
+    cd "$(dirname "$cmdpath")"
+    cmdpath="$link"
+done
+script_home="$(cd "$(dirname "$cmdpath")" && pwd -P)"
+cd "$top"
+
+bup_libdir="$script_home/../lib"  # bup_libdir will be adjusted during install
+
+export PYTHONPATH="$bup_libdir${PYTHONPATH:+:$PYTHONPATH}"
+export BUP_RESOURCE_PATH="$bup_libdir"
+
 # This last line will be replaced with 'exec some/python "$@"