about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2017-10-26 15:56:59 -0700
committerJosh Stone <jistone@redhat.com>2017-10-26 17:19:29 -0700
commit924331cc9b9213112e697833391c8d5fc59ea844 (patch)
tree101fb52c2f238cd11bd1446774d2d97c3ff0f9b1 /src
parentb218a02ad8b8b79b30a847eadf3e9c739560fadf (diff)
downloadrust-924331cc9b9213112e697833391c8d5fc59ea844.tar.gz
rust-924331cc9b9213112e697833391c8d5fc59ea844.zip
configure.py: fix --disable-option-checking
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.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/bootstrap/configure.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 42425a164a2..579422c9799 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -225,7 +225,12 @@ while i < len(sys.argv):
         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:
@@ -238,7 +243,7 @@ config = {}
 
 def build():
     if 'build' in known_args:
-        return known_args['build'][0][1]
+        return known_args['build'][-1][1]
     return bootstrap.default_build_triple()
 
 
@@ -276,9 +281,9 @@ for key in known_args:
 
     # 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: