]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/fuse-cmd.py
Prefer python 3, and mention intent to drop python 2 support
[bup.git] / lib / cmd / fuse-cmd.py
index 2eb28fbcf8c0293844456c51cf9b4c2bdde09182..1b8bd9ccb6d2ac494755c1a44884198281b0540b 100755 (executable)
@@ -1,12 +1,21 @@
 #!/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, print_function
-import sys, os, errno
+import errno, os, sys
 
 try:
     import fuse
@@ -32,7 +41,9 @@ if sys.version_info[0] > 2:
               file=sys.stderr)
         sys.exit(2)
 
-from bup import options, git, vfs, xstat
+sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
+
+from bup import compat, options, git, vfs, xstat
 from bup.compat import argv_bytes, fsdecode, py_maj
 from bup.helpers import log
 from bup.repo import LocalRepo
@@ -137,7 +148,7 @@ meta          report original metadata for paths when available
 v,verbose     increase log output (can be used more than once)
 """
 o = options.Options(optspec)
-opt, flags, extra = o.parse(sys.argv[1:])
+opt, flags, extra = o.parse(compat.argv[1:])
 if not opt.verbose:
     opt.verbose = 0