Jason Lowe-Power has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/58430 )
Change subject: python: Add function to get ruby protocol
......................................................................
python: Add function to get ruby protocol
This changeset moves the auto-generated defines.py file to _defines and
replaces it with an explicit defines.py file in the m5 module. This
explicit module also includes a function to expose the ruby protocol.
This will make it easier to provide backwards compatibility and have a
"main" protocol as we add support for multiple protocols in a single
binary.
Change-Id: Id632d4af7d1e60f2c3ea0c492c0cba26c6d9af92
Signed-off-by: Jason Lowe-Power <ja...@lowepower.com>
---
M src/SConscript
M src/python/SConscript
A src/python/m5/defines.py
3 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/SConscript b/src/SConscript
index d55520b..f356f00 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -609,9 +609,9 @@
code.write(target[0].abspath)
# Generate a file with all of the compile options in it
-env.Command('python/m5/defines.py', ToValue(dict(build_env)),
+env.Command('python/m5/_defines.py', ToValue(dict(build_env)),
MakeAction(makeDefinesPyFile, Transform("DEFINES", 0)))
-PySource('m5', 'python/m5/defines.py')
+PySource('m5', 'python/m5/_defines.py')
# Generate a file that wraps the basic top level files
gem5py_env.Command('python/m5/info.py',
diff --git a/src/python/SConscript b/src/python/SConscript
index 343a696..bb069f5 100644
--- a/src/python/SConscript
+++ b/src/python/SConscript
@@ -219,6 +219,7 @@
PySource('m5', 'm5/SimObject.py')
PySource('m5', 'm5/core.py')
PySource('m5', 'm5/debug.py')
+PySource('m5', 'm5/defines.py')
PySource('m5', 'm5/event.py')
PySource('m5', 'm5/main.py')
PySource('m5', 'm5/options.py')
diff --git a/src/python/m5/defines.py b/src/python/m5/defines.py
new file mode 100644
index 0000000..9c1c98d
--- /dev/null
+++ b/src/python/m5/defines.py
@@ -0,0 +1,32 @@
+# Copyright (c) 2022 The Regents of the University of California
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from ._defines import buildEnv
+
+def getRubyProtocol() -> str:
+ return buildEnv["PROTOCOL"]
+
+__all__ = ["buildEnv", "getRubyProtocol"]
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/58430
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Id632d4af7d1e60f2c3ea0c492c0cba26c6d9af92
Gerrit-Change-Number: 58430
Gerrit-PatchSet: 1
Gerrit-Owner: Jason Lowe-Power <power...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s