]> err.no Git - dak/commitdiff
fstransactions.py: allow mode to be a string
authorAnsgar Burchardt <ansgar@debian.org>
Fri, 15 Jun 2012 13:42:10 +0000 (15:42 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Sun, 1 Jul 2012 11:17:10 +0000 (13:17 +0200)
daklib/fstransactions.py

index 468e2859b2d5ee804714b002734c981ab1a0ff23..f76a4bc67611fa0cab5f32d5f5d26bc883e4c456 100644 (file)
@@ -134,6 +134,9 @@ class FilesystemTransaction(object):
            symlink (bool): Create a symlink instead
            mode (int): Permissions to change `destination` to.
         """
+        if isinstance(mode, str) or isinstance(mode, unicode):
+            mode = int(mode, 8)
+
         self.actions.append(_FilesystemCopyAction(source, destination, link=link, symlink=symlink, mode=mode))
 
     def move(self, source, destination, mode=None):
@@ -169,6 +172,9 @@ class FilesystemTransaction(object):
         Returns:
            file handle of the new file
         """
+        if isinstance(mode, str) or isinstance(mode, unicode):
+            mode = int(mode, 8)
+
         destdir = os.path.dirname(path)
         if not os.path.exists(destdir):
             os.makedirs(destdir, 0o2775)