slicc: cleanup slicc code and make it less verbose

This commit is contained in:
Nathan Binkert
2011-07-05 18:30:05 -07:00
parent 3d252f8e5f
commit 831e9b3b7a
7 changed files with 73 additions and 108 deletions

View File

@@ -176,3 +176,12 @@ def readCommand(cmd, **kwargs):
raise
return subp.communicate()[0]
def makeDir(path):
"""Make a directory if it doesn't exist. If the path does exist,
ensure that it is a directory"""
if os.path.exists(path):
if not os.path.isdir(path):
raise AttributeError, "%s exists but is not directory" % path
else:
os.mkdir(path)