]> arthur.barton.de Git - bup.git/blobdiff - cmd/init-cmd.py
vint: remove unnecessary condition
[bup.git] / cmd / init-cmd.py
index 80037e94e37645b836f7fddd1b6ea7eff62fee5c..ad2ed82877ab2bc643ee070f0ad7c75b5e5e959b 100755 (executable)
@@ -1,8 +1,16 @@
-#!/usr/bin/env python
+#!/bin/sh
+"""": # -*-python-*-
+bup_python="$(dirname "$0")/bup-python" || exit $?
+exec "$bup_python" "$0" ${1+"$@"}
+"""
+# end of bup preamble
+
+from __future__ import absolute_import
 import sys
 
 from bup import git, options, client
-from bup.helpers import *
+from bup.helpers import log, saved_errors
+from bup.compat import argv_bytes
 
 
 optspec = """
@@ -10,7 +18,7 @@ optspec = """
 --
 r,remote=  remote repository path
 """
-o = options.Options('bup init', optspec)
+o = options.Options(optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
 
 if extra:
@@ -19,11 +27,11 @@ if extra:
 
 try:
     git.init_repo()  # local repo
-except git.GitError, e:
+except git.GitError as e:
     log("bup: error: could not init repository: %s" % e)
     sys.exit(1)
 
 if opt.remote:
     git.check_repo_or_die()
-    cli = client.Client(opt.remote, create=True)
+    cli = client.Client(argv_bytes(opt.remote), create=True)
     cli.close()