about summary refs log tree commit diff
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-10-12 16:14:26 +0800
committerkennytm <kennytm@gmail.com>2017-10-13 01:58:44 +0800
commit69447684d1fd8de6a0cdca153fdeef97528286bc (patch)
tree84f16b98d1406ff8a3854355dd5ca4139b0d7a89
parentff53dc7166e628bd6853a3c9b01d056ec61b1959 (diff)
parent3cb52949666fee2005402e71b879742f5baecf25 (diff)
downloadrust-69447684d1fd8de6a0cdca153fdeef97528286bc.tar.gz
rust-69447684d1fd8de6a0cdca153fdeef97528286bc.zip
Rollup merge of #45121 - johnthagen:pep8-bootstrap, r=alexcrichton
Fix PEP8 style issues in bootstrap code

This fixes PEP8 style issues (other than line-length) in the bootstrap Python code.

The most important fix is in the `set` function where the code was indented with 6 spaces instead of 4.
-rw-r--r--src/bootstrap/bootstrap.py1
-rwxr-xr-xsrc/bootstrap/configure.py48
2 files changed, 32 insertions, 17 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 25768867439..64f76aa2ef4 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -302,6 +302,7 @@ def default_build_triple():
 
     return "{}-{}".format(cputype, ostype)
 
+
 class RustBuild(object):
     """Provide all the methods required to build Rust"""
     def __init__(self):
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 0ea4af386c7..73ce82287e7 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -19,6 +19,7 @@ rust_dir = os.path.dirname(rust_dir)
 sys.path.append(os.path.join(rust_dir, "src", "bootstrap"))
 import bootstrap
 
+
 class Option:
     def __init__(self, name, rustbuild, desc, value):
         self.name = name
@@ -26,14 +27,18 @@ class Option:
         self.desc = desc
         self.value = value
 
+
 options = []
 
+
 def o(*args):
     options.append(Option(*args, value=False))
 
+
 def v(*args):
     options.append(Option(*args, value=True))
 
+
 o("debug", "rust.debug", "debug mode; disables optimization unless `--enable-optimize` given")
 o("docs", "build.docs", "build standard library documentation")
 o("compiler-docs", "build.compiler-docs", "build compiler documentation")
@@ -136,13 +141,16 @@ v("target", None, "GNUs ./configure syntax LLVM target triples")
 
 v("set", None, "set arbitrary key/value pairs in TOML configuration")
 
+
 def p(msg):
     print("configure: " + msg)
 
+
 def err(msg):
     print("configure: error: " + msg)
     sys.exit(1)
 
+
 if '--help' in sys.argv or '-h' in sys.argv:
     print('Usage: ./configure [options]')
     print('')
@@ -208,7 +216,7 @@ while i < len(sys.argv):
                 continue
 
         found = True
-        if not option.name in known_args:
+        if option.name not in known_args:
             known_args[option.name] = []
         known_args[option.name].append((option, value))
         break
@@ -227,27 +235,30 @@ if 'option-checking' not in known_args or known_args['option-checking'][1]:
 # TOML we're going to write out
 config = {}
 
+
 def build():
     if 'build' in known_args:
         return known_args['build'][0][1]
     return bootstrap.default_build_triple()
 
+
 def set(key, value):
-      s = "{:20} := {}".format(key, value)
-      if len(s) < 70:
-          p(s)
-      else:
-          p(s[:70] + " ...")
-
-      arr = config
-      parts = key.split('.')
-      for i, part in enumerate(parts):
-          if i == len(parts) - 1:
-              arr[part] = value
-          else:
-              if not part in arr:
-                  arr[part] = {}
-              arr = arr[part]
+    s = "{:20} := {}".format(key, value)
+    if len(s) < 70:
+        p(s)
+    else:
+        p(s[:70] + " ...")
+
+    arr = config
+    parts = key.split('.')
+    for i, part in enumerate(parts):
+        if i == len(parts) - 1:
+            arr[part] = value
+        else:
+            if part not in arr:
+                arr[part] = {}
+            arr = arr[part]
+
 
 for key in known_args:
     # The `set` option is special and can be passed a bunch of times
@@ -345,6 +356,7 @@ for target in configured_targets:
     targets[target] = sections['target'][:]
     targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)
 
+
 # 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
@@ -362,6 +374,7 @@ def to_toml(value):
     else:
         raise RuntimeError('no toml')
 
+
 def configure_section(lines, config):
     for key in config:
         value = config[key]
@@ -375,9 +388,10 @@ def configure_section(lines, config):
         if not found:
             raise RuntimeError("failed to find config line for {}".format(key))
 
+
 for section_key in config:
     section_config = config[section_key]
-    if not section_key in sections:
+    if section_key not in sections:
         raise RuntimeError("config key {} not in sections".format(section_key))
 
     if section_key == 'target':