Add actual dependency checking.

This commit is contained in:
Avery Pennarun 2010-11-12 07:03:06 -08:00
commit 9a45f066f8
2 changed files with 130 additions and 20 deletions

View file

@ -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