Skip to content

Commit 9e51b57

Browse files
committedOct 26, 2018
Make configure.py handle numeric arguments for --set a little better.
1 parent b8f977a commit 9e51b57

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed
 

‎src/bootstrap/configure.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,13 @@ def set(key, value):
393393
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)
394394

395395

396+
def is_number(value):
397+
try:
398+
float(value)
399+
return True
400+
except:
401+
return False
402+
396403
# Here we walk through the constructed configuration we have from the parsed
397404
# command line arguments. We then apply each piece of configuration by
398405
# basically just doing a `sed` to change the various configuration line to what
@@ -406,7 +413,11 @@ def to_toml(value):
406413
elif isinstance(value, list):
407414
return '[' + ', '.join(map(to_toml, value)) + ']'
408415
elif isinstance(value, str):
409-
return "'" + value + "'"
416+
# Don't put quotes around numeric values
417+
if is_number(value):
418+
return value
419+
else:
420+
return "'" + value + "'"
410421
else:
411422
raise RuntimeError('no toml')
412423

0 commit comments

Comments
 (0)