Add actual dependency checking.
This commit is contained in:
parent
ee8a3c8c6e
commit
9a45f066f8
2 changed files with 130 additions and 20 deletions
24
helpers.py
24
helpers.py
|
|
@ -1,12 +1,6 @@
|
|||
import sys, os, errno
|
||||
|
||||
|
||||
def log(s):
|
||||
sys.stdout.flush()
|
||||
sys.stderr.write(s)
|
||||
sys.stderr.flush()
|
||||
|
||||
|
||||
def unlink(f):
|
||||
"""Delete a file at path 'f' if it currently exists.
|
||||
|
||||
|
|
@ -20,3 +14,21 @@ def unlink(f):
|
|||
pass # it doesn't exist, that's what you asked for
|
||||
|
||||
|
||||
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:
|
||||
if mode:
|
||||
os.makedirs(d, mode)
|
||||
else:
|
||||
os.makedirs(d)
|
||||
except OSError, e:
|
||||
if e.errno == errno.EEXIST:
|
||||
pass
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue