summaryrefslogtreecommitdiff
path: root/pactest/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'pactest/util.py')
-rwxr-xr-xpactest/util.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pactest/util.py b/pactest/util.py
index 2b384098..1cdb4018 100755
--- a/pactest/util.py
+++ b/pactest/util.py
@@ -247,6 +247,16 @@ def grep(filename, pattern):
fd.close()
return found
+def mkdir(dir):
+ if os.path.isdir(dir):
+ return
+ elif os.path.isfile(dir):
+ raise OSError("'%s' already exists and is not a directory" % dir)
+ else:
+ parent, thisdir = os.path.split(dir)
+ if parent: mkdir(parent) #recurse to make all parents
+ print "making dir %s" % thisdir
+ if thisdir: os.mkdir(dir)
if __name__ == "__main__":
pass