Bug 1317359 - Move add_old_configure_* functions to util.configure. r=chmanchester, a=jcristau CLOSED TREE FIREFOX_51_0b1_BUILD2 FIREFOX_51_0b1_RELEASE
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 15 Nov 2016 14:35:22 +0900
changeset 356614 749a8d32b74eae516b9427f28aad4ec1c11e0a54
parent 356611 f4f4fce526f54e4d4339fc6e5d87320df6126da6
child 356615 b896c64a32433508bd5ee22b8ebea2d2e74fd208
push id6577
push usernthomas@mozilla.com
push dateWed, 16 Nov 2016 02:21:48 +0000
treeherdermozilla-beta@749a8d32b74e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester, jcristau
bugs1317359
milestone51.0
Bug 1317359 - Move add_old_configure_* functions to util.configure. r=chmanchester, a=jcristau CLOSED TREE
build/moz.configure/init.configure
build/moz.configure/util.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -117,54 +117,16 @@ def mozconfig(current_project, mozconfig
     mozconfig = loader.find_mozconfig(env={'MOZCONFIG': mozconfig})
     mozconfig = loader.read_mozconfig(mozconfig, moz_build_app=current_project)
 
     return mozconfig
 
 set_config('MOZCONFIG', depends(mozconfig)(lambda m: m['path']))
 
 
-# Hacks related to old-configure
-# ==============================
-
-@dependable
-def old_configure_assignments():
-    return []
-
-@dependable
-def extra_old_configure_args():
-    return []
-
-@template
-def add_old_configure_assignment(var, value):
-    var = dependable(var)
-    value = dependable(value)
-
-    @depends(old_configure_assignments, var, value)
-    @imports(_from='mozbuild.shellutil', _import='quote')
-    def add_assignment(assignments, var, value):
-        if var is None or value is None:
-            return
-        if value is True:
-            assignments.append('%s=1' % var)
-        elif value is False:
-            assignments.append('%s=' % var)
-        else:
-            if isinstance(value, (list, tuple)):
-                value = quote(*value)
-            assignments.append('%s=%s' % (var, quote(str(value))))
-
-@template
-def add_old_configure_arg(arg):
-    @depends(extra_old_configure_args, arg)
-    def add_arg(args, arg):
-        if arg:
-            args.append(arg)
-
-
 option(env='PYTHON', nargs=1, help='Python interpreter')
 
 # Setup python virtualenv
 # ==============================================================
 @depends('PYTHON', check_build_environment, mozconfig, '--help')
 @imports('os')
 @imports('sys')
 @imports('subprocess')
--- a/build/moz.configure/util.configure
+++ b/build/moz.configure/util.configure
@@ -399,16 +399,54 @@ def depends_when(*args, **kwargs):
     def decorator(fn):
         @depends(when, *args)
         def wrapper(val, *args):
             if val:
                 return fn(*args)
         return wrapper
     return decorator
 
+
+# Hacks related to old-configure
+# ==============================
+
+@dependable
+def old_configure_assignments():
+    return []
+
+@dependable
+def extra_old_configure_args():
+    return []
+
+@template
+def add_old_configure_assignment(var, value):
+    var = dependable(var)
+    value = dependable(value)
+
+    @depends(old_configure_assignments, var, value)
+    @imports(_from='mozbuild.shellutil', _import='quote')
+    def add_assignment(assignments, var, value):
+        if var is None or value is None:
+            return
+        if value is True:
+            assignments.append('%s=1' % var)
+        elif value is False:
+            assignments.append('%s=' % var)
+        else:
+            if isinstance(value, (list, tuple)):
+                value = quote(*value)
+            assignments.append('%s=%s' % (var, quote(str(value))))
+
+@template
+def add_old_configure_arg(arg):
+    @depends(extra_old_configure_args, arg)
+    def add_arg(args, arg):
+        if arg:
+            args.append(arg)
+
 # Includes a file when the given condition evaluates to a truthy value.
 @template
 def include_when(filename, when):
     # Assume, for now, our condition already depends on --help.
     @depends(when, '--help')
     def conditional_include(value, _):
         if value:
             return filename