]> arthur.barton.de Git - bup.git/blobdiff - cmd/xstat-cmd.py
tclient: invoke bup via absolute path
[bup.git] / cmd / xstat-cmd.py
index 85071d21a7e232590c1079b8160fa59808587d16..aa43a53438a7a558b58701211108d08ad15ef190 100755 (executable)
@@ -1,11 +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
+
 # Copyright (C) 2010 Rob Browning
 #
 # This code is covered under the terms of the GNU Library General
 # Public License as described in the bup LICENSE file.
+
+from __future__ import absolute_import
 import sys, stat, errno
+
 from bup import metadata, options, xstat
-from bup.helpers import handle_ctrl_c, parse_timestamp, saved_errors, \
+from bup.helpers import add_error, handle_ctrl_c, parse_timestamp, saved_errors, \
     add_error, log
 
 
@@ -13,7 +22,7 @@ def parse_timestamp_arg(field, value):
     res = str(value) # Undo autoconversion.
     try:
         res = parse_timestamp(res)
-    except ValueError, ex:
+    except ValueError as ex:
         if ex.args:
             o.fatal('unable to parse %s resolution "%s" (%s)'
                     % (field, value, ex))
@@ -77,7 +86,7 @@ first_path = True
 for path in remainder:
     try:
         m = metadata.from_path(path, archive_path = path)
-    except (OSError,IOError), e:
+    except (OSError,IOError) as e:
         if e.errno == errno.ENOENT:
             add_error(e)
             continue