From: Nathan Binkert Date: Tue, 18 Jan 2005 20:28:34 +0000 (-0500) Subject: More configuration fixes X-Git-Tag: m5_1.0_tutorial~106^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d728d44b55541f45b0b1a5d33650c20d260da37a;p=gem5.git More configuration fixes sim/pyconfig/m5config.py: put panic, AddToPath, and Import here so they're always available. --HG-- extra : convert_revision : 104dba5ccac0d64479b4109d477b5192c4b07a6e --- diff --git a/sim/pyconfig/m5config.py b/sim/pyconfig/m5config.py index d7c0c6507..4e2a377b0 100644 --- a/sim/pyconfig/m5config.py +++ b/sim/pyconfig/m5config.py @@ -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)