diff options
author | Geoffrey Blake <Geoffrey.Blake@arm.com> | 2014-09-09 04:36:34 -0400 |
---|---|---|
committer | Geoffrey Blake <Geoffrey.Blake@arm.com> | 2014-09-09 04:36:34 -0400 |
commit | b0e4de667a7d0d51ac0667ce1e48f13b2cb17716 (patch) | |
tree | 1f6688db8ed85a0a2c328bc2b5f1c52f7c76d578 /src/python/m5 | |
parent | cd1bd7572aeb49f55ea9071a73ba1e322fb2487b (diff) | |
download | gem5-b0e4de667a7d0d51ac0667ce1e48f13b2cb17716.tar.xz |
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 (limited to 'src/python/m5')
-rw-r--r-- | src/python/m5/params.py | 7 |
1 files changed, 6 insertions, 1 deletions
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) ] |