From: Geoffrey Blake Date: Tue, 9 Sep 2014 08:36:34 +0000 (-0400) Subject: config: Fix vectorparam command line parsing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b0e4de667a7d0d51ac0667ce1e48f13b2cb17716;p=gem5.git 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. --- 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) ]