Bug 1317359 - Move add_old_configure_* functions to util.configure. r?chmanchester draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 15 Nov 2016 14:35:22 +0900
changeset 438917 a11bdf57ecc1abd7569166edced96f604799962d
parent 437964 21fe32a54a98acafd02955df8cc51c25d4cbea3a
child 438918 0317d8c1d997ee4acd7ab3a71346b8e91b30a6ae
push id35842
push userbmo:mh+mozilla@glandium.org
push dateTue, 15 Nov 2016 05:40:10 +0000
reviewerschmanchester
bugs1317359
milestone52.0a1
Bug 1317359 - Move add_old_configure_* functions to util.configure. r?chmanchester
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)