Bug 1308982 - Normalize gyp_reader.py indentation to 4 spaces. draft
authorChris Manchester <cmanchester@mozilla.com>
Thu, 01 Dec 2016 14:28:55 -0800
changeset 446795 7bd0f6946b7f7b81bc91931e035305baec989e1e
parent 446527 3853c539a1b7c803f1075d2c3ecefbdd314af1d8
child 446796 8a2e902f4290bea82b284091725633aaa00e1801
push id37888
push userbmo:cmanchester@mozilla.com
push dateThu, 01 Dec 2016 22:29:10 +0000
bugs1308982
milestone53.0a1
Bug 1308982 - Normalize gyp_reader.py indentation to 4 spaces. MozReview-Commit-ID: HRE3cVmNB2d
python/mozbuild/mozbuild/frontend/gyp_reader.py
--- a/python/mozbuild/mozbuild/frontend/gyp_reader.py
+++ b/python/mozbuild/mozbuild/frontend/gyp_reader.py
@@ -47,70 +47,72 @@ def encode(value):
     return value
 
 
 # Default variables gyp uses when evaluating gyp files.
 generator_default_variables = {
 }
 for dirname in [b'INTERMEDIATE_DIR', b'SHARED_INTERMEDIATE_DIR', b'PRODUCT_DIR',
                 b'LIB_DIR', b'SHARED_LIB_DIR']:
-  # Some gyp steps fail if these are empty(!).
-  generator_default_variables[dirname] = b'$' + dirname
+    # Some gyp steps fail if these are empty(!).
+    generator_default_variables[dirname] = b'$' + dirname
 
 for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME',
                'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT',
                'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX',
                'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX',
                'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX',
                'LINKER_SUPPORTS_ICF']:
-  generator_default_variables[unused] = b''
+    generator_default_variables[unused] = b''
 
 
 class GypContext(TemplateContext):
     """Specialized Context for use with data extracted from Gyp.
 
     config is the ConfigEnvironment for this context.
     relobjdir is the object directory that will be used for this context,
     relative to the topobjdir defined in the ConfigEnvironment.
     """
     def __init__(self, config, relobjdir):
         self._relobjdir = relobjdir
         TemplateContext.__init__(self, template='Gyp',
             allowed_variables=VARIABLES, config=config)
 
 
 def handle_actions(actions, context, action_overrides):
-  idir = '$INTERMEDIATE_DIR/'
-  for action in actions:
-    name = action['action_name']
-    if name not in action_overrides:
-      raise RuntimeError('GYP action %s not listed in action_overrides' % name)
-    outputs = action['outputs']
-    if len(outputs) > 1:
-      raise NotImplementedError('GYP actions with more than one output not supported: %s' % name)
-    output = outputs[0]
-    if not output.startswith(idir):
-      raise NotImplementedError('GYP actions outputting to somewhere other than <(INTERMEDIATE_DIR) not supported: %s' % output)
-    output = output[len(idir):]
-    context['GENERATED_FILES'] += [output]
-    g = context['GENERATED_FILES'][output]
-    g.script = action_overrides[name]
-    g.inputs = action['inputs']
+    idir = '$INTERMEDIATE_DIR/'
+    for action in actions:
+        name = action['action_name']
+        if name not in action_overrides:
+            raise RuntimeError('GYP action %s not listed in action_overrides' % name)
+        outputs = action['outputs']
+        if len(outputs) > 1:
+            raise NotImplementedError('GYP actions with more than one output not supported: %s' % name)
+        output = outputs[0]
+        if not output.startswith(idir):
+            raise NotImplementedError('GYP actions outputting to somewhere other than <(INTERMEDIATE_DIR) not supported: %s' % output)
+        output = output[len(idir):]
+        context['GENERATED_FILES'] += [output]
+        g = context['GENERATED_FILES'][output]
+        g.script = action_overrides[name]
+        g.inputs = action['inputs']
+
 
 def handle_copies(copies, context):
-  dist = '$PRODUCT_DIR/dist/'
-  for copy in copies:
-    dest = copy['destination']
-    if not dest.startswith(dist):
-      raise NotImplementedError('GYP copies to somewhere other than <(PRODUCT_DIR)/dist not supported: %s' % dest)
-    dest_paths = dest[len(dist):].split('/')
-    exports = context['EXPORTS']
-    while dest_paths:
-      exports = getattr(exports, dest_paths.pop(0))
-    exports += sorted(copy['files'], key=lambda x: x.lower())
+    dist = '$PRODUCT_DIR/dist/'
+    for copy in copies:
+        dest = copy['destination']
+        if not dest.startswith(dist):
+            raise NotImplementedError('GYP copies to somewhere other than <(PRODUCT_DIR)/dist not supported: %s' % dest)
+        dest_paths = dest[len(dist):].split('/')
+        exports = context['EXPORTS']
+        while dest_paths:
+            exports = getattr(exports, dest_paths.pop(0))
+        exports += sorted(copy['files'], key=lambda x: x.lower())
+
 
 def read_from_gyp(config, path, output, vars, no_chromium, no_unified, action_overrides, non_unified_sources = set()):
     """Read a gyp configuration and emits GypContexts for the backend to
     process.
 
     config is a ConfigEnvironment, path is the path to a root gyp configuration
     file, output is the base path under which the objdir for the various gyp
     dependencies will be, and vars a dict of variables to pass to the gyp