]> arthur.barton.de Git - bup.git/blobdiff - cmd/daemon-cmd.py
test-restore-map-owner: accommodate python 3 and test there
[bup.git] / cmd / daemon-cmd.py
index c90e3e4bb3b9224c3be2039a7760340e28c1c9e8..ba4b86a50f8917bf697e2a45864cfecb8ddb97ba 100755 (executable)
@@ -1,4 +1,11 @@
-#!/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, getopt, socket, subprocess, fcntl
 from bup import options, path
 from bup.helpers import *
@@ -25,7 +32,7 @@ for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC,
     af, socktype, proto, canonname, sa = res
     try:
         s = socket.socket(af, socktype, proto)
-    except socket.error, e:
+    except socket.error as e:
         continue
     try:
         if af == socket.AF_INET6:
@@ -36,7 +43,7 @@ for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC,
         s.bind(sa)
         s.listen(1)
         fcntl.fcntl(s.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC)
-    except socket.error, e:
+    except socket.error as e:
         s.close()
         continue
     socks.append(s)