]> arthur.barton.de Git - bup.git/blobdiff - cmd/import-duplicity-cmd.py
cmd/bup: adapt for python 3
[bup.git] / cmd / import-duplicity-cmd.py
index 3798d75c2c6ac51effe05e7222767c8385139ef6..565aca629c8cbca365152a4badddb1d11a794942 100755 (executable)
@@ -1,14 +1,20 @@
-#!/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
 from calendar import timegm
 from pipes import quote
-from subprocess import check_call, check_output
+from subprocess import check_call
 from time import strftime, strptime
 import sys
 import tempfile
 
-from bup import git, options, vfs
-from bup.helpers import handle_ctrl_c, log, saved_errors, unlink
+from bup import git, options
+from bup.helpers import handle_ctrl_c, log, readpipe, saved_errors, unlink
 import bup.path
 
 optspec = """
@@ -35,11 +41,13 @@ def exo(cmd, shell=False):
     global opt
     logcmd(cmd)
     if not opt.dry_run:
-        return check_output(cmd, shell=shell)
+        return readpipe(cmd, shell=shell)
 
 
 handle_ctrl_c()
 
+log('\nbup: import-duplicity is EXPERIMENTAL (proceed with caution)\n\n')
+
 o = options.Options(optspec)
 opt, flags, extra = o.parse(sys.argv[1:])
 
@@ -54,7 +62,6 @@ source_url, save_name = extra
 bup = bup.path.exe()
 
 git.check_repo_or_die()
-top = vfs.RefList(None)
 
 tmpdir = tempfile.mkdtemp(prefix='bup-import-dup-')
 try: