]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/xstat-cmd.py
ftp: fix ls arguments for python3
[bup.git] / lib / cmd / xstat-cmd.py
index 626b4c7e9d2f82476346c01184c21aab764457f8..9935b07432d9061b0477e296c3de7118f59f77f4 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 @@ exec "$bup_python" "$0" ${1+"$@"}
 # Public License as described in the bup LICENSE file.
 
 from __future__ import absolute_import, print_function
-import sys, stat, errno
+import errno, os.path, sys, stat
 
-from bup import metadata, options, xstat
+sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
+
+from bup import compat, metadata, options, xstat
 from bup.compat import argv_bytes
 from bup.helpers import add_error, handle_ctrl_c, parse_timestamp, saved_errors, \
     add_error, log
@@ -54,7 +65,7 @@ active_fields = metadata.all_fields
 handle_ctrl_c()
 
 o = options.Options(optspec)
-(opt, flags, remainder) = o.parse(sys.argv[1:])
+(opt, flags, remainder) = o.parse(compat.argv[1:])
 
 atime_resolution = parse_timestamp_arg('atime', opt.atime_resolution)
 mtime_resolution = parse_timestamp_arg('mtime', opt.mtime_resolution)