scons: Make the SimObject list from the 'gem5 lib' tag.
Only include SimObject files which match the gem5 lib tag. This way we can declare SimObjects, and then filter them out based on tags. Change-Id: I0aca1ef830bcc7beaee80c54d58ba8a188968491 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50331 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -141,7 +141,6 @@ class SimObject(PySource):
|
||||
it to a list of sim object modules'''
|
||||
|
||||
fixed = False
|
||||
modnames = []
|
||||
|
||||
def __init__(self, source, tags=None, add_tags=None):
|
||||
'''Specify the source file and any tags (automatically in
|
||||
@@ -150,8 +149,6 @@ class SimObject(PySource):
|
||||
if self.fixed:
|
||||
raise AttributeError("Too late to call SimObject now.")
|
||||
|
||||
bisect.insort_right(SimObject.modnames, self.modname)
|
||||
|
||||
|
||||
# This regular expression is simplistic and assumes that the import takes up
|
||||
# the entire line, doesn't have the keyword "public", uses double quotes, has
|
||||
@@ -589,7 +586,9 @@ sys.meta_path[0:0] = [ importer ]
|
||||
|
||||
# import all sim objects so we can populate the all_objects list
|
||||
# make sure that we're working with a list, then let's sort it
|
||||
for modname in SimObject.modnames:
|
||||
gem5_lib_simobjects = SimObject.all.with_tag(env, 'gem5 lib')
|
||||
gem5_lib_modnames = sorted(map(lambda so: so.modname, gem5_lib_simobjects))
|
||||
for modname in gem5_lib_modnames:
|
||||
exec('from m5.objects import %s' % modname)
|
||||
|
||||
# we need to unload all of the currently imported modules so that they
|
||||
|
||||
Reference in New Issue
Block a user