]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/prune-older-cmd.py
Use pytest item results to preserve tmpdirs on failure
[bup.git] / lib / cmd / prune-older-cmd.py
index fcc0fbd2785f5378f2c9278c9a663a2befafe5d4..c25bb81f74c20fff482e5efffe0fe2d05932c343 100755 (executable)
@@ -1,7 +1,16 @@
 #!/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
 
@@ -11,9 +20,11 @@ from collections import defaultdict
 from itertools import groupby
 from sys import stderr
 from time import localtime, strftime, time
-import re, sys
+import os.path, re, sys
 
-from bup import git, options
+sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
+
+from bup import compat, git, options
 from bup.compat import argv_bytes, int_types
 from bup.gc import bup_gc
 from bup.helpers import die_if_errors, log, partition, period_as_secs
@@ -84,7 +95,7 @@ unsafe        use the command even though it may be DANGEROUS
 """
 
 o = options.Options(optspec)
-opt, flags, roots = o.parse(sys.argv[1:])
+opt, flags, roots = o.parse(compat.argv[1:])
 roots = [argv_bytes(x) for x in roots]
 
 if not opt.unsafe: