]> arthur.barton.de Git - bup.git/commitdiff
Add a mode argument to mkdirp. bup-0.16
authorRob Browning <rlb@defaultvalue.org>
Mon, 26 Jul 2010 03:11:36 +0000 (22:11 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Mon, 26 Jul 2010 05:06:11 +0000 (01:06 -0400)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/helpers.py

index 65dbc3fd499f63add0bebc55f7dcb6c933846c9e..daaa0c4402aa605f55b304e4f84816983e6e382a 100644 (file)
@@ -26,14 +26,17 @@ def log(s):
     _hard_write(sys.stderr.fileno(), s)
 
 
-def mkdirp(d):
+def mkdirp(d, mode=None):
     """Recursively create directories on path 'd'.
 
     Unlike os.makedirs(), it doesn't raise an exception if the last element of
     the path already exists.
     """
     try:
-        os.makedirs(d)
+        if mode:
+            os.makedirs(d, mode)
+        else:
+            os.makedirs(d)
     except OSError, e:
         if e.errno == errno.EEXIST:
             pass