[jhbuild] autotools: refactor argument handling



commit fda1a543b222cb1d296190e4af5cab4b92a52db5
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri Dec 20 18:06:39 2013 -0500

    autotools: refactor argument handling
    
    Split out a tiny bit of common code used in collecting and expanding
    autogenargs, makeargs and makeinstallargs.
    
    There is a strict refactoring -- no functionality changes here.
    
    The 'common code' will grow with the next commit, increasing the benefit
    of having it factored out.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720839

 jhbuild/modtypes/autotools.py |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/jhbuild/modtypes/autotools.py b/jhbuild/modtypes/autotools.py
index 56e7fb8..583cf44 100644
--- a/jhbuild/modtypes/autotools.py
+++ b/jhbuild/modtypes/autotools.py
@@ -393,19 +393,20 @@ class AutogenModule(MakeModule, DownloadableModule):
                  ('supports-static-analyzer', 'supports_static_analyzer', True),
                  ('autogen-template', 'autogen_template', None)])
 
+def collect_args(instance, node, argtype):
+    if node.hasAttribute(argtype):
+        args = node.getAttribute(argtype)
+    else:
+        args = ''
+
+    return instance.eval_args(args)
 
 def parse_autotools(node, config, uri, repositories, default_repo):
     instance = AutogenModule.parse_from_xml(node, config, uri, repositories, default_repo)
 
-    if node.hasAttribute('autogenargs'):
-        autogenargs = node.getAttribute('autogenargs')
-        instance.autogenargs = instance.eval_args(autogenargs)
-    if node.hasAttribute('makeargs'):
-        makeargs = node.getAttribute('makeargs')
-        instance.makeargs = instance.eval_args(makeargs)
-    if node.hasAttribute('makeinstallargs'):
-        makeinstallargs = node.getAttribute('makeinstallargs')
-        instance.makeinstallargs = instance.eval_args(makeinstallargs)
+    instance.autogenargs = collect_args (instance, node, 'autogenargs')
+    instance.makeargs = collect_args (instance, node, 'makeargs')
+    instance.makeinstallargs = collect_args (instance, node, 'makeinstallargs')
 
     if node.hasAttribute('supports-non-srcdir-builds'):
         instance.supports_non_srcdir_builds = \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]