summaryrefslogtreecommitdiff
path: root/src/python
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2011-07-05 18:30:05 -0700
committerNathan Binkert <nate@binkert.org>2011-07-05 18:30:05 -0700
commit831e9b3b7a658663f5bffafef175d4f4a5615cfd (patch)
treee2ac76e79b6e3f0f1fe5e5c471004c3e391dee2b /src/python
parent3d252f8e5fa2ec3f55730ab6d5d1a4a1b21b2cdf (diff)
downloadgem5-831e9b3b7a658663f5bffafef175d4f4a5615cfd.tar.xz
slicc: cleanup slicc code and make it less verbose
Diffstat (limited to 'src/python')
-rw-r--r--src/python/m5/util/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py
index 69f153bb4..591781977 100644
--- a/src/python/m5/util/__init__.py
+++ b/src/python/m5/util/__init__.py
@@ -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)