Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/48371 )

Change subject: scons: Add a pair of functions for working with Value nodes.
......................................................................

scons: Add a pair of functions for working with Value nodes.

These nodes are really for working with text, and they do strange and
broken things otherwise. This change adds a pair of convenience
functions which uses pickle to serialize an object for the Value to
hold, and to unpack the Value later.

Change-Id: Id48822ce3de283b003d4cc7ef6b563a70e321ca6
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/48371
Tested-by: kokoro <[email protected]>
Reviewed-by: Hoa Nguyen <[email protected]>
Maintainer: Bobby R. Bruce <[email protected]>
---
M site_scons/gem5_scons/__init__.py
1 file changed, 9 insertions(+), 1 deletion(-)

Approvals:
  Hoa Nguyen: Looks good to me, approved
  Bobby R. Bruce: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/site_scons/gem5_scons/__init__.py b/site_scons/gem5_scons/__init__.py
index 91764b0..bf7b85d 100644
--- a/site_scons/gem5_scons/__init__.py
+++ b/site_scons/gem5_scons/__init__.py
@@ -39,6 +39,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 import os
+import pickle
 import sys
 import tempfile
 import textwrap
@@ -46,6 +47,7 @@
 from gem5_scons.util import get_termcap
 from gem5_scons.configure import Configure
 from gem5_scons.defaults import EnvDefaults
+import SCons.Node.Python
 import SCons.Script

 termcap = get_termcap()
@@ -260,5 +262,11 @@
         env['SHCCCOMSTR']      = Transform("SHCC")
         env['SHCXXCOMSTR']     = Transform("SHCXX")

+def ToValue(obj):
+    return SCons.Node.Python.Value(pickle.dumps(obj))
+
+def FromValue(node):
+    return pickle.loads(node.read())
+
 __all__ = ['Configure', 'EnvDefaults', 'Transform', 'warning', 'error',
-           'MakeAction', 'MakeActionTool']
+           'MakeAction', 'MakeActionTool', 'ToValue', 'FromValue']

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/48371
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: Id48822ce3de283b003d4cc7ef6b563a70e321ca6
Gerrit-Change-Number: 48371
Gerrit-PatchSet: 13
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Hoa Nguyen <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to