]> arthur.barton.de Git - bup.git/commitdiff
Use Python 3 compatible octal notation
authorRob Browning <rlb@defaultvalue.org>
Tue, 29 Dec 2015 06:56:23 +0000 (00:56 -0600)
committerRob Browning <rlb@defaultvalue.org>
Fri, 1 Jan 2016 19:42:39 +0000 (13:42 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
cmd/restore-cmd.py
lib/bup/metadata.py
lib/bup/t/tmetadata.py

index c7f446b44a73d0155b75f4f90084e2a692539797..49f51761b6ae2911665618dc51ff0af089e7fe90 100755 (executable)
@@ -172,7 +172,7 @@ def write_file_content(fullname, n):
 
 
 def write_file_content_sparsely(fullname, n):
-    outfd = os.open(fullname, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0600)
+    outfd = os.open(fullname, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
     try:
         trailing_zeros = 0;
         for b in chunkyreader(n.open()):
index b981817d8579c4d67824a7e531051c10405ff3e3..046634519b2095707e0f0368e32175b25f5c0682 100644 (file)
@@ -323,23 +323,23 @@ class Metadata:
 
         if stat.S_ISREG(self.mode):
             assert(self._recognized_file_type())
-            fd = os.open(path, os.O_CREAT|os.O_WRONLY|os.O_EXCL, 0600)
+            fd = os.open(path, os.O_CREAT|os.O_WRONLY|os.O_EXCL, 0o600)
             os.close(fd)
         elif stat.S_ISDIR(self.mode):
             assert(self._recognized_file_type())
-            os.mkdir(path, 0700)
+            os.mkdir(path, 0o700)
         elif stat.S_ISCHR(self.mode):
             assert(self._recognized_file_type())
-            os.mknod(path, 0600 | stat.S_IFCHR, self.rdev)
+            os.mknod(path, 0o600 | stat.S_IFCHR, self.rdev)
         elif stat.S_ISBLK(self.mode):
             assert(self._recognized_file_type())
-            os.mknod(path, 0600 | stat.S_IFBLK, self.rdev)
+            os.mknod(path, 0o600 | stat.S_IFBLK, self.rdev)
         elif stat.S_ISFIFO(self.mode):
             assert(self._recognized_file_type())
-            os.mknod(path, 0600 | stat.S_IFIFO)
+            os.mknod(path, 0o600 | stat.S_IFIFO)
         elif stat.S_ISSOCK(self.mode):
             try:
-                os.mknod(path, 0600 | stat.S_IFSOCK)
+                os.mknod(path, 0o600 | stat.S_IFSOCK)
             except OSError, e:
                 if e.errno in (errno.EINVAL, errno.EPERM):
                     s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
@@ -352,7 +352,7 @@ class Metadata:
                 # on MacOS, symlink() permissions depend on umask, and there's
                 # no way to chown a symlink after creating it, so we have to
                 # be careful here!
-                oldumask = os.umask((self.mode & 0777) ^ 0777)
+                oldumask = os.umask((self.mode & 0o777) ^ 0o777)
                 try:
                     os.symlink(self.symlink_target, path)
                 finally:
index 126e1d7d0162a06b6200d49c9668d1effa91635f..dbd5fe21028bc68c9726c2214c14a5b99a70ec3b 100644 (file)
@@ -41,7 +41,7 @@ def setup_testfs():
     ex('mount', '-o', 'loop,acl,user_xattr', 'testfs.img', 'testfs')
     # Hide, so that tests can't create risks.
     os.chown('testfs', 0, 0)
-    os.chmod('testfs', 0700)
+    os.chmod('testfs', 0o700)
     return True