X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fcmd%2Fsplit-cmd.py;h=3105eb8290751668ee49bb6a0c4d0339e480cd76;hb=4da04257d78f1f2e16925ab12817966f875cc4b3;hp=bb4cf2e619bbb178c9974bed4e166b9776af8ba8;hpb=887534c033738bd6b19464ca180b049e131d06a5;p=bup.git diff --git a/lib/cmd/split-cmd.py b/lib/cmd/split-cmd.py index bb4cf2e..3105eb8 100755 --- a/lib/cmd/split-cmd.py +++ b/lib/cmd/split-cmd.py @@ -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 @@ -9,7 +18,9 @@ from __future__ import absolute_import, division, print_function from binascii import hexlify import os, sys, time -from bup import hashsplit, git, options, client +sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..'] + +from bup import compat, hashsplit, git, options, client from bup.compat import argv_bytes, environ from bup.helpers import (add_error, handle_ctrl_c, hostname, log, parse_num, qprogress, reprogress, saved_errors, @@ -49,7 +60,7 @@ bwlimit= maximum bytes/sec to transmit to server handle_ctrl_c() o = options.Options(optspec) -(opt, flags, extra) = o.parse(sys.argv[1:]) +opt, flags, extra = o.parse(compat.argv[1:]) if opt.name: opt.name = argv_bytes(opt.name) if opt.remote: opt.remote = argv_bytes(opt.remote) if opt.verbose is None: opt.verbose = 0 @@ -211,7 +222,7 @@ if opt.verbose: if opt.tree: out.write(hexlify(tree) + b'\n') if opt.commit or opt.name: - msg = b'bup split\n\nGenerated by command:\n%r\n' % sys.argv + msg = b'bup split\n\nGenerated by command:\n%r\n' % compat.argvb ref = opt.name and (b'refs/heads/%s' % opt.name) or None userline = b'%s <%s@%s>' % (userfullname(), username(), hostname()) commit = pack_writer.new_commit(tree, oldref, userline, date, None,