diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2005-03-13 00:36:06 -0500 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2005-03-13 00:36:06 -0500 |
commit | 8dff74b26fbfafad4ea9a12d20ad57b8094b0bc9 (patch) | |
tree | 0090f7b705aa58281c0783b48b24ac5ef37a5e9f /python/m5/__init__.py | |
parent | 3bbddb43d43b70e6af35a2c4d35607a5a364f463 (diff) | |
download | gem5-8dff74b26fbfafad4ea9a12d20ad57b8094b0bc9.tar.xz |
Clean up import situation... key things are:
- global tracking of legitimate param types in
separate dict keeps us from having to import
objects in config.py, which gets rid of nasty
circular dependence
- use __all__ in config.py and restrict imports
from mpy_importer to reduce m5 namespace pollution
python/m5/__init__.py:
Try to limit namespace pollution by only importing
what's needed from mpy_importer.
Explicitly set up legal parameter types rather than
relying on eval().
python/m5/config.py:
Use empty ParamType base class to distinguish
types that are legitimate SimObject params.
Explicitly add these to global param_types map.
Rework CheckedInt and Range classes a little bit
to fit in better with the model.
No need to import objects here any longer.
Add __all__ list to specify subset of names that
get exported on 'from m5.config import *'.
--HG--
extra : convert_revision : 01c6e82e0b175fc9b3df25dd0cc80ecd842680bc
Diffstat (limited to 'python/m5/__init__.py')
-rw-r--r-- | python/m5/__init__.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python/m5/__init__.py b/python/m5/__init__.py index 7cb3a32c6..3d54a83da 100644 --- a/python/m5/__init__.py +++ b/python/m5/__init__.py @@ -1,7 +1,11 @@ -from mpy_importer import * +from mpy_importer import AddToPath, LoadMpyFile + from config import * +config.add_param_types(config.__dict__) + from objects import * +config.add_param_types(objects.__dict__) -cpp_classes = MetaSimObject.cpp_classes +cpp_classes = config.MetaSimObject.cpp_classes cpp_classes.sort() |