changeset c12ec2a0de52 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=c12ec2a0de52
description:
        config: Fix vectorparam command line parsing

        Parsing vectorparams from the command was slightly broken
        in that it wouldn't accept the input that the help message
        provided to the user and it didn't do the conversion
        on the second code path used to convert the string input
        to the actual internal representation.  This patch fixes these bugs.

diffstat:

 src/python/m5/params.py |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r c870b43d2ba6 -r c12ec2a0de52 src/python/m5/params.py
--- a/src/python/m5/params.py   Tue Sep 09 04:36:34 2014 -0400
+++ b/src/python/m5/params.py   Tue Sep 09 04:36:34 2014 -0400
@@ -311,6 +311,10 @@
         if isinstance(value, (list, tuple)):
             # list: coerce each element into new list
             tmp_list = [ ParamDesc.convert(self, v) for v in value ]
+        elif isinstance(value, str):
+            # If input is a csv string
+            tmp_list = [ ParamDesc.convert(self, v) \
+                         for v in value.strip('[').strip(']').split(',') ]
         else:
             # singleton: coerce to a single-element list
             tmp_list = [ ParamDesc.convert(self, value) ]
@@ -346,7 +350,8 @@
             tmp_list = [ ParamDesc.convert(self, v) for v in value ]
         elif isinstance(value, str):
             # If input is a csv string
-            tmp_list = [ ParamDesc.convert(self, v) for v in value.split(',') ]
+            tmp_list = [ ParamDesc.convert(self, v) \
+                         for v in value.strip('[').strip(']').split(',') ]
         else:
             # singleton: coerce to a single-element list
             tmp_list = [ ParamDesc.convert(self, value) ]
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to