Bug 1255305 - Generalize adding arguments to old-configure draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 11 Mar 2016 22:53:48 +0900
changeset 339513 d3a16649f3666e4edbb407f40b7b5c822e44ea72
parent 339512 fd508a5095bf67e57cc314695765a7a6130e2104
child 339514 89946d6c06c7e34fe95377cec6792c8132d13a7e
push id12749
push userbmo:mh+mozilla@glandium.org
push dateFri, 11 Mar 2016 15:49:26 +0000
bugs1255305
milestone48.0a1
Bug 1255305 - Generalize adding arguments to old-configure
build/moz.configure/init.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -110,24 +110,34 @@ def mozconfig(current_project, mozconfig
 
 # Hacks related to old-configure
 # ==============================
 
 @depends('--help')
 def old_configure_assignments(help):
     return []
 
+@depends('--help')
+def extra_old_configure_args(help):
+    return []
+
 @template
 def add_old_configure_assignment(var, value):
     @depends(old_configure_assignments)
     @advanced
     def add_assignment(assignments):
         from mozbuild.shellutil import quote
         assignments.append('%s=%s' % (var, quote(value)))
 
+@template
+def add_old_configure_arg(arg):
+    @depends(extra_old_configure_args)
+    def add_arg(args):
+        args.append(arg)
+
 
 option(env='PYTHON', nargs=1, help='Python interpreter')
 
 # Setup python virtualenv
 # ==============================================================
 @depends('PYTHON', check_build_environment, mozconfig)
 @advanced
 def virtualenv_python(env_python, build_env, mozconfig):
@@ -296,26 +306,20 @@ def include_project_configure(project, e
 def build_project(include_project_configure, build_env, help):
     ret = os.path.dirname(os.path.relpath(include_project_configure,
                                           build_env['TOPSRCDIR']))
     add_old_configure_assignment('MOZ_BUILD_APP', ret)
     return ret
 
 
 # This is temporary until js/src/configure and configure are merged.
-@depends(build_project)
-def extra_old_configure_args(build_project):
-    if build_project != 'js':
-        return []
-    return False
-
 # Use instead of option() in js/moz.configure
 @template
 def js_option(*args, **kwargs):
     opt = option(*args, **kwargs)
 
-    @depends(opt.option, extra_old_configure_args)
-    def js_option(value, extra_old_configure_args):
-        if extra_old_configure_args is not False:
-            extra_old_configure_args.append(value.format(opt.option))
+    @depends(opt.option, build_project)
+    def js_option(value, build_project):
+        if build_project != 'js':
+            add_old_configure_arg(value.format(opt.option))
 
 
 include(include_project_configure)