swig: make all generated files go into the m5.internal package

This is necessary because versions of swig older than 1.3.39 fail to
do the right thing and try to do relative imports for everything (even
with the package= option to %module).  Instead of putting params in
the m5.internal.params package, put params in the m5.internal package
and make all param modules start with param_.  Same thing for
m5.internal.enums.

Also, stop importing all generated params into m5.objects.  They are
not necessary and now with everything using relative imports we wound
up with pollution of the namespace (where builtin-range got overridden).

--HG--
rename : src/python/m5/internal/enums/__init__.py => src/python/m5/internal/enums.py
rename : src/python/m5/internal/params/__init__.py => src/python/m5/internal/params.py
This commit is contained in:
Nathan Binkert
2010-09-12 15:41:34 -07:00
parent afafaf1dcb
commit 2edfcbbaee
9 changed files with 32 additions and 90 deletions

View File

@@ -101,7 +101,7 @@ def default_cxx_predecls(cls, code):
code('#include "params/$cls.hh"')
def default_swig_predecls(cls, code):
code('%import "params/$cls.i"')
code('%import "python/m5/internal/param_$cls.i"')
def default_swig_objdecls(cls, code):
class_path = cls.cxx_class.split('::')
@@ -455,7 +455,7 @@ class MetaSimObject(type):
code()
if cls._base:
code('%import "params/${{cls._base.type}}.i"')
code('%import "python/m5/internal/param_${{cls._base.type}}.i"')
code()
for ptype in ptypes:
@@ -780,7 +780,7 @@ class SimObject(object):
if self._ccParams:
return self._ccParams
cc_params_struct = getattr(m5.objects.params, '%sParams' % self.type)
cc_params_struct = getattr(m5.internal.params, '%sParams' % self.type)
cc_params = cc_params_struct()
cc_params.pyobj = self
cc_params.name = str(self)