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
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
from mpy_importer import *
|
||||
from config import *
|
||||
from objects import *
|
||||
from mpy_importer import AddToPath, LoadMpyFile
|
||||
|
||||
cpp_classes = MetaSimObject.cpp_classes
|
||||
from config import *
|
||||
config.add_param_types(config.__dict__)
|
||||
|
||||
from objects import *
|
||||
config.add_param_types(objects.__dict__)
|
||||
|
||||
cpp_classes = config.MetaSimObject.cpp_classes
|
||||
cpp_classes.sort()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user