Skip to content

Commit

Permalink
configure.py: fix --disable-option-checking
Browse files Browse the repository at this point in the history
Getting the value of this argument needs another level of indexing,
as `known_args` are stored in `{dict}[list](opt, value)` form.

Also, when option-checking is disabled, let this bypass the check that
options are only passed once, and just apply the last value.
  • Loading branch information
cuviper committed Oct 27, 2017
1 parent b218a02 commit 924331c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/bootstrap/configure.py
Expand Up @@ -225,7 +225,12 @@ def err(msg):
unknown_args.append(arg)
p("")

if 'option-checking' not in known_args or known_args['option-checking'][1]:
# Note: here and a few other places, we use [-1] to apply the *last* value
# passed. But if option-checking is enabled, then the known_args loop will
# also assert that options are only passed once.
option_checking = ('option-checking' not in known_args
or known_args['option-checking'][-1][1])
if option_checking:
if len(unknown_args) > 0:
err("Option '" + unknown_args[0] + "' is not recognized")
if len(need_value_args) > 0:
Expand All @@ -238,7 +243,7 @@ def err(msg):

def build():
if 'build' in known_args:
return known_args['build'][0][1]
return known_args['build'][-1][1]
return bootstrap.default_build_triple()


Expand Down Expand Up @@ -276,9 +281,9 @@ def set(key, value):

# Ensure each option is only passed once
arr = known_args[key]
if len(arr) > 1:
if option_checking and len(arr) > 1:
err("Option '{}' provided more than once".format(key))
option, value = arr[0]
option, value = arr[-1]

# If we have a clear avenue to set our value in rustbuild, do so
if option.rustbuild is not None:
Expand Down

0 comments on commit 924331c

Please sign in to comment.