Changeset 75 for branches/mk/cheesecake/util.py
- Timestamp:
- 06/24/06 09:40:42 (7 years ago)
- Files:
-
- branches/mk/cheesecake/util.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/mk/cheesecake/util.py
r58 r75 9 9 PAD_VALUE = 4 10 10 11 def run_cmd(cmd): 12 """ 13 Run command and return its return code and its output 11 def run_cmd(cmd, env=None): 12 """Run command and return its return code and its output. 14 13 """ 15 14 arglist = cmd.split() 16 15 try: 17 p = Popen(arglist, stdout=PIPE, stderr=STDOUT )16 p = Popen(arglist, stdout=PIPE, stderr=STDOUT, env=env) 18 17 except ProcessError, e: 19 18 return 1, e … … 149 148 tarinfo = t.members[0] 150 149 return tarinfo.name.split(os.sep)[0] 150 151 def mkdirs(dir): 152 """Make directory with parent directories as needed. 153 154 Don't throw an exception if directory exists. 155 """ 156 parts = dir.split(os.path.sep) 157 for length in xrange(1, len(parts)+1): 158 path = os.path.sep.join([''] + parts[:length]) 159 if not os.path.exists(path): 160 os.mkdir(path)
