Bug 1317359 - Move add_old_configure_* functions to util.configure. r=chmanchester, a=jcristau
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 15 Nov 2016 14:35:22 +0900
changeset 352450 03d26fc3da000f90bf441feb6aad233b71ef4a6b
parent 352449 64936ba0330a72cf5e05bca5f44b84562705fea0
child 352451 1a240efc72a9c50d8e846f42948f0c08406a40d0
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester, jcristau
bugs1317359
milestone52.0a2
Bug 1317359 - Move add_old_configure_* functions to util.configure. r=chmanchester, a=jcristau
build/moz.configure/init.configure
build/moz.configure/util.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -118,54 +118,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
@@ -395,8 +395,46 @@ 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)