More configuration fixes
authorNathan Binkert <binkertn@umich.edu>
Tue, 18 Jan 2005 20:28:34 +0000 (15:28 -0500)
committerNathan Binkert <binkertn@umich.edu>
Tue, 18 Jan 2005 20:28:34 +0000 (15:28 -0500)
sim/pyconfig/m5config.py:
    put panic, AddToPath, and Import here so they're always available.

--HG--
extra : convert_revision : 104dba5ccac0d64479b4109d477b5192c4b07a6e

sim/pyconfig/m5config.py

index d7c0c65079fced1b25ec713e0b4e8569be6cfa11..4e2a377b0e195e2b203f0dad55bd455c710348d6 100644 (file)
@@ -35,6 +35,19 @@ def defined(key):
 def define(key, value = True):
     env[key] = value
 
+def panic(*args, **kwargs):
+    sys.exit(*args, **kwargs)
+
+def AddToPath(path):
+    path = os.path.realpath(path)
+    if os.path.isdir(path):
+        sys.path.append(path)
+
+def Import(path):
+    AddToPath(os.path.dirname(path))
+    exec('from m5config import *')
+    mpy_exec(file(path, 'r'))
+
 def issequence(value):
     return isinstance(value, tuple) or isinstance(value, list)