From f15f252d4e45f74a3b6e5ef0a7afacc656480792 Mon Sep 17 00:00:00 2001 From: Nathan Binkert Date: Mon, 19 Jan 2009 09:59:13 -0800 Subject: python: Rework how things are imported --- src/python/m5/__init__.py | 18 +++++++++--------- src/python/swig/core.i | 26 ++++++++++++++++---------- 2 files changed, 25 insertions(+), 19 deletions(-) (limited to 'src/python') diff --git a/src/python/m5/__init__.py b/src/python/m5/__init__.py index 7b071bccd..4151d1a13 100644 --- a/src/python/m5/__init__.py +++ b/src/python/m5/__init__.py @@ -77,18 +77,18 @@ env.update(os.environ) # importing *you*). try: import internal - running_m5 = True except ImportError: - running_m5 = False + internal = None -if running_m5: - import defines - build_env.update(defines.m5_build_env) -else: - import __scons - build_env.update(__scons.m5_build_env) +import defines +build_env.update(defines.buildEnv) + +if internal: + defines.compileDate = internal.core.compileDate + for k,v in internal.core.__dict__.iteritems(): + if k.startswith('flag_'): + setattr(defines, k[5:], v) -if running_m5: from event import * from simulate import * from main import options, main diff --git a/src/python/swig/core.i b/src/python/swig/core.i index 566998639..c567bea4d 100644 --- a/src/python/swig/core.i +++ b/src/python/swig/core.i @@ -41,15 +41,24 @@ #include "sim/startup.hh" extern const char *compileDate; -std::vector compileFlags(); -extern const char *hgRev; -extern const char *hgDate; + +#ifdef DEBUG +const bool flag_DEBUG = true; +#else +const bool flag_DEBUG = false; +#endif +#ifdef NDEBUG +const bool flag_NDEBUG = true; +#else +const bool flag_NDEBUG = false; +#endif +const bool flag_TRACING_ON = TRACING_ON; + inline void disableAllListeners() { ListenSocket::disableAll(); } %} %include "stdint.i" %include "std_string.i" -%include "std_vector.i" %include "sim/host.hh" void setOutputDir(const std::string &dir); @@ -59,12 +68,9 @@ void disableAllListeners(); %immutable compileDate; char *compileDate; - -namespace std { %template(StringVector) vector; } -std::vector compileFlags(); - -char *hgRev; -char *hgDate; +const bool flag_DEBUG; +const bool flag_NDEBUG; +const bool flag_TRACING_ON; void setClockFrequency(Tick ticksPerSecond); -- cgit v1.2.3