Skip to content
Browse files

Add a mode argument to mkdirp.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
  • Loading branch information...
1 parent 8a52582 commit 3175874e4e53c64d4d88695c67c36efef05064fd @rlbdv rlbdv committed with apenwarr Jul 25, 2010
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/bup/helpers.py
View
7 lib/bup/helpers.py
@@ -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

0 comments on commit 3175874

Please sign in to comment.
Something went wrong with that request. Please try again.