aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2017-10-27 12:33:58 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2017-11-06 20:55:05 +0200
commitb8187961b98e5c81c239d9cce9aaea21317abeca (patch)
treefe35e0997a825da85b42e273a2fc113da3920254 /mesonbuild
parentcde0f4fca18b15a86218911d8519e1d334a27c7f (diff)
downloadmeson-b8187961b98e5c81c239d9cce9aaea21317abeca.zip
meson-b8187961b98e5c81c239d9cce9aaea21317abeca.tar.gz
meson-b8187961b98e5c81c239d9cce9aaea21317abeca.tar.bz2
coredata: Remove parse_string() method
set_value() already does a better job at parsing strings, such as accepting "True" for a boolean. This fixes issue #2544
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/coredata.py13
-rw-r--r--mesonbuild/optinterpreter.py2
2 files changed, 1 insertions, 14 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index cf5f077..ba5d2ac 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -29,9 +29,6 @@ class UserOption:
self.choices = choices
self.description = description
- def parse_string(self, valuestring):
- return valuestring
-
# Check that the input is a valid value and return the
# "cleaned" or "native" version. For example the Boolean
# option could take the string "true" and return True.
@@ -72,13 +69,6 @@ class UserBooleanOption(UserOption):
def set_value(self, newvalue):
self.value = self.tobool(newvalue)
- def parse_string(self, valuestring):
- if valuestring == 'false':
- return False
- if valuestring == 'true':
- return True
- raise MesonException('Value "%s" for boolean option "%s" is not a boolean.' % (valuestring, self.name))
-
def __bool__(self):
return self.value
@@ -109,9 +99,6 @@ class UserIntegerOption(UserOption):
except:
raise MesonException('Value string "%s" is not convertable to an integer.' % valuestring)
- def parse_string(self, valuestring):
- return self.toint(valuestring)
-
def validate_value(self, value):
return self.toint(value)
diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py
index 4b8e147..01dd036 100644
--- a/mesonbuild/optinterpreter.py
+++ b/mesonbuild/optinterpreter.py
@@ -180,5 +180,5 @@ class OptionInterpreter:
if opt.description == '':
opt.description = opt_name
if opt_name in self.cmd_line_options:
- opt.set_value(opt.parse_string(self.cmd_line_options[opt_name]))
+ opt.set_value(self.cmd_line_options[opt_name])
self.options[opt_name] = opt