summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorMatt Wilson <msw@redhat.com>1999-10-22 19:32:38 +0000
committerMatt Wilson <msw@redhat.com>1999-10-22 19:32:38 +0000
commit1fd6585406744fec328b38bd62957ec063b2452f (patch)
tree745ba23bd7c4d8abfbaa51b6bf9e1585532c478b /iutil.py
parenta29f74c35f97793fe68ce93387a97051890243b4 (diff)
downloadanaconda-1fd6585406744fec328b38bd62957ec063b2452f.tar.gz
anaconda-1fd6585406744fec328b38bd62957ec063b2452f.tar.xz
anaconda-1fd6585406744fec328b38bd62957ec063b2452f.zip
merge from 6.1 branch
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/iutil.py b/iutil.py
index cbe049ee9..77202a63a 100644
--- a/iutil.py
+++ b/iutil.py
@@ -131,3 +131,26 @@ def memInstalled():
fields = string.split(mem)
return int(fields[1]) / 1024
+
+# this is a mkdir that won't fail if a directory already exists and will
+# happily make all of the directories leading up to it.
+def mkdirChain(dir):
+ if (os.path.isdir(dir)): return
+ elements = string.splitfields(dir, "/")
+
+ if (len(elements[0])):
+ which = 1
+ path = elements[0]
+ else:
+ which = 2
+ path = "/" + elements[1]
+
+ if (not os.path.isdir(path)):
+ os.mkdir(path, 0755)
+
+ while (which < len(elements)):
+ path = path + "/" + elements[which]
+ which = which + 1
+
+ if (not os.path.isdir(path)):
+ os.mkdir(path, 0755)