diff options
author | Matt Wilson <msw@redhat.com> | 1999-10-22 19:32:38 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-10-22 19:32:38 +0000 |
commit | 1fd6585406744fec328b38bd62957ec063b2452f (patch) | |
tree | 745ba23bd7c4d8abfbaa51b6bf9e1585532c478b /iutil.py | |
parent | a29f74c35f97793fe68ce93387a97051890243b4 (diff) | |
download | anaconda-1fd6585406744fec328b38bd62957ec063b2452f.tar.gz anaconda-1fd6585406744fec328b38bd62957ec063b2452f.tar.xz anaconda-1fd6585406744fec328b38bd62957ec063b2452f.zip |
merge from 6.1 branch
Diffstat (limited to 'iutil.py')
-rw-r--r-- | iutil.py | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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) |