]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/damage-cmd.py
Split src tree python use to config/bin/python and dev/bup-python
[bup.git] / lib / cmd / damage-cmd.py
index 07f0e03b25f3255d8ca522b4e661c61fd1fd91ff..85995edf439a4532657aafdc4d455ebea1f93a26 100755 (executable)
@@ -1,14 +1,25 @@
 #!/bin/sh
 """": # -*-python-*-
-bup_python="$(dirname "$0")/bup-python" || exit $?
-exec "$bup_python" "$0" ${1+"$@"}
+# https://sourceware.org/bugzilla/show_bug.cgi?id=26034
+export "BUP_ARGV_0"="$0"
+arg_i=1
+for arg in "$@"; do
+    export "BUP_ARGV_${arg_i}"="$arg"
+    shift
+    arg_i=$((arg_i + 1))
+done
+# Here to end of preamble replaced during install
+bup_python="$(dirname "$0")/../../config/bin/python" || exit $?
+exec "$bup_python" "$0"
 """
 # end of bup preamble
 
 from __future__ import absolute_import
-import sys, os, random
+import os, random, sys
 
-from bup import options
+sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
+
+from bup import compat, options
 from bup.compat import argv_bytes, bytes_from_uint, range
 from bup.helpers import log
 from bup.io import path_msg
@@ -29,7 +40,7 @@ equal    spread damage evenly throughout the file
 S,seed=  random number seed (for repeatable tests)
 """
 o = options.Options(optspec)
-(opt, flags, extra) = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
 
 if not extra:
     o.fatal('filenames expected')