From b0e4de667a7d0d51ac0667ce1e48f13b2cb17716 Mon Sep 17 00:00:00 2001 From: Geoffrey Blake Date: Tue, 9 Sep 2014 04:36:34 -0400 Subject: 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. --- src/python/m5/params.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/python/m5/params.py') diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 1f9a41d9e..db10a818f 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -311,6 +311,10 @@ class VectorParamDesc(ParamDesc): 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 @@ class VectorParamDesc(ParamDesc): 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) ] -- cgit v1.2.3