Skip to content

Commit

Permalink
Make configure.py handle numeric arguments for --set a little better.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Oct 23, 2018
1 parent 4545b3e commit 03551e1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,13 @@ def set(key, value):
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)


def is_number(value):
try:
float(value)
return True
except:
return False

# Here we walk through the constructed configuration we have from the parsed
# command line arguments. We then apply each piece of configuration by
# basically just doing a `sed` to change the various configuration line to what
Expand All @@ -406,7 +413,11 @@ def to_toml(value):
elif isinstance(value, list):
return '[' + ', '.join(map(to_toml, value)) + ']'
elif isinstance(value, str):
return "'" + value + "'"
# Don't put quotes around numeric values
if is_number(value):
return value
else:
return "'" + value + "'"
else:
raise RuntimeError('no toml')

Expand Down

0 comments on commit 03551e1

Please sign in to comment.