aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreterbase.py
diff options
context:
space:
mode:
authorIñigo Martínez <inigomartinez@gmail.com>2017-11-23 23:00:15 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2017-11-26 17:14:32 +0200
commit3d0a9b791175b3be4ebf6834c08d2cc3be5a1903 (patch)
treeba01f1bf6ed1e793d9ad036127d8852672b1e58d /mesonbuild/interpreterbase.py
parent30f2c4857c4798565a3f0d0b370b630335eb4687 (diff)
downloadmeson-3d0a9b791175b3be4ebf6834c08d2cc3be5a1903.zip
meson-3d0a9b791175b3be4ebf6834c08d2cc3be5a1903.tar.gz
meson-3d0a9b791175b3be4ebf6834c08d2cc3be5a1903.tar.bz2
interpreter: Reduce to_sring method to base 10
The int's to_string method implementation has been reduced to base 10.
Diffstat (limited to 'mesonbuild/interpreterbase.py')
-rw-r--r--mesonbuild/interpreterbase.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py
index 9bb311f..7ccc8b2 100644
--- a/mesonbuild/interpreterbase.py
+++ b/mesonbuild/interpreterbase.py
@@ -452,13 +452,8 @@ class InterpreterBase:
elif method_name == 'to_string':
if not posargs:
return str(obj)
- elif len(posargs) == 1 and isinstance(posargs[0], str):
- f = 'd' if len(posargs[0].strip()) == 0 else posargs[0]
- if re.match('^[bcdoxX]$', f) is None:
- raise InvalidCode('Invalid format for int to string conversion "%s"' % f)
- return str(('{:' + f + '}').format(obj))
else:
- raise InterpreterException('int.to_string() must have either no arguments or exactly one string arguments that signify what format to use.')
+ raise InterpreterException('int.to_string() must have no arguments.')
else:
raise InterpreterException('Unknown method "%s" for an integer.' % method_name)