]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/save-cmd.py
helpers.localtime: avoid floor-related deprecation warning
[bup.git] / lib / cmd / save-cmd.py
index 02e6841e33bd9dd100150656645c3022c3a2dcd6..37155cb2e2a66ca68e4808790d828836e397be20 100755 (executable)
@@ -9,7 +9,7 @@ for arg in "$@"; do
     arg_i=$((arg_i + 1))
 done
 # Here to end of preamble replaced during install
-bup_python="$(dirname "$0")/bup-python" || exit $?
+bup_python="$(dirname "$0")/../../config/bin/python" || exit $?
 exec "$bup_python" "$0"
 """
 # end of bup preamble
@@ -18,7 +18,9 @@ from __future__ import absolute_import, print_function
 from binascii import hexlify
 from errno import EACCES
 from io import BytesIO
-import os, sys, stat, time, math
+import math, os, stat, sys, time
+
+sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
 
 from bup import compat, hashsplit, git, options, index, client, metadata
 from bup import hlinkdb
@@ -485,8 +487,13 @@ if opt.tree:
     out.write(hexlify(tree))
     out.write(b'\n')
 if opt.commit or name:
-    msg = (b'bup save\n\nGenerated by command:\n%r\n'
-           % [argv_bytes(x) for x in sys.argv])
+    if compat.py_maj > 2:
+        # Strip b prefix from python 3 bytes reprs to preserve previous format
+         msgcmd = b'[%s]' % b', '.join([repr(argv_bytes(x))[1:].encode('ascii')
+                                       for x in compat.argv])
+    else:
+        msgcmd = repr(compat.argv)
+    msg = b'bup save\n\nGenerated by command:\n%s\n' % msgcmd
     userline = (b'%s <%s@%s>' % (userfullname(), username(), hostname()))
     commit = w.new_commit(tree, oldref, userline, date, None,
                           userline, date, None, msg)