python: Enable -m switch on gem5 binary (#453)

With -m, you can now run a module from the command line that is embedded
in the gem5 binary.
This will allow us to put some common "scripts" in the stdlib instead of
in the "configs" directory.
This commit is contained in:
Jason Lowe-Power
2023-10-14 20:08:06 -07:00
committed by GitHub
parent ca2592d3ba
commit 20f5555f30
2 changed files with 57 additions and 35 deletions

View File

@@ -38,6 +38,9 @@ class ByteCodeLoader(importlib.abc.Loader):
def exec_module(self, module):
exec(self.code, module.__dict__)
def get_code(self, _):
return self.code
# Simple importer that allows python to import data from a dict of
# code objects. The keys are the module path, and the items are the