]> arthur.barton.de Git - bup.git/blobdiff - lib/cmd/fsck-cmd.py
Remove $(dirname "$0") from sys.path
[bup.git] / lib / cmd / fsck-cmd.py
index 0a1bdb079c401f1ee9cfd33f93dcd58ca7e319c9..911bab8b8bda9ad767929d538812f17e54ff68d4 100755 (executable)
@@ -15,14 +15,17 @@ exec "$bup_python" "$0"
 # end of bup preamble
 
 from __future__ import absolute_import, print_function
-import os, glob, subprocess, sys
+
+# Intentionally replace the dirname "$0" that python prepends
+import os, sys
+sys.path[0] = os.path.dirname(os.path.realpath(__file__)) + '/..'
+
+import glob, subprocess
 from shutil import rmtree
 from subprocess import PIPE, Popen
 from tempfile import mkdtemp
 from binascii import hexlify
 
-sys.path[:0] = [os.path.dirname(os.path.realpath(__file__)) + '/..']
-
 from bup import compat, options, git
 from bup.compat import argv_bytes
 from bup.helpers import Sha1, chunkyreader, istty2, log, progress
@@ -210,7 +213,7 @@ if opt.disable_par2:
 git.check_repo_or_die()
 
 if extra:
-    extra = [argv_byes(x) for x in extra]
+    extra = [argv_bytes(x) for x in extra]
 else:
     debug('fsck: No filenames given: checking all packs.\n')
     extra = glob.glob(git.repo(b'objects/pack/*.pack'))