[gnome-builder] waf: use system installed waf when necessary



commit 0084fc93525d52a3988120b263da33a134361e21
Author: Christian Hergert <chergert redhat com>
Date:   Fri Feb 22 22:36:45 2019 -0800

    waf: use system installed waf when necessary
    
    This will fallback to the system installed waf if the waf file is not
    found bundled in the project.
    
    Patch from Alex Mitchell

 src/plugins/waf/waf_plugin.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/waf/waf_plugin.py b/src/plugins/waf/waf_plugin.py
index 9c0bea701..a22b93c86 100644
--- a/src/plugins/waf/waf_plugin.py
+++ b/src/plugins/waf/waf_plugin.py
@@ -79,17 +79,20 @@ class WafPipelineAddin(Ide.Object, Ide.PipelineAddin):
         if type(build_system) != WafBuildSystem:
             return
 
-        # Sniff the required python version
         waf = os.path.join(srcdir, 'waf')
         self.python = sniff_python_version(waf)
 
+        # If waf is in project directory use that
+        self.waf_local = os.path.isfile(waf)
+
         # Avoid sniffing again later in targets provider
         build_system.python = self.python
 
         # Launcher for project configuration
         config_launcher = pipeline.create_launcher()
         config_launcher.set_cwd(srcdir)
-        config_launcher.push_argv(self.python)
+        if self.waf_local:
+            config_launcher.push_argv(self.python)
         config_launcher.push_argv('waf')
         config_launcher.push_argv('configure')
         config_launcher.push_argv('--prefix=%s' % config.get_prefix())
@@ -104,13 +107,15 @@ class WafPipelineAddin(Ide.Object, Ide.PipelineAddin):
         # Now create our launcher to build the project
         build_launcher = pipeline.create_launcher()
         build_launcher.set_cwd(srcdir)
-        build_launcher.push_argv(self.python)
+        if self.waf_local:
+            build_launcher.push_argv(self.python)
         build_launcher.push_argv('waf')
         build_launcher.push_argv('build')
 
         clean_launcher = pipeline.create_launcher()
         clean_launcher.set_cwd(srcdir)
-        clean_launcher.push_argv(self.python)
+        if self.waf_local:
+            clean_launcher.push_argv(self.python)
         clean_launcher.push_argv('waf')
         clean_launcher.push_argv('clean')
 
@@ -122,7 +127,8 @@ class WafPipelineAddin(Ide.Object, Ide.PipelineAddin):
 
         install_launcher = pipeline.create_launcher()
         install_launcher.set_cwd(srcdir)
-        install_launcher.push_argv(self.python)
+        if self.waf_local:
+            install_launcher.push_argv(self.python)
         install_launcher.push_argv('waf')
         install_launcher.push_argv('install')
 
@@ -204,7 +210,8 @@ class WafBuildTargetProvider(Ide.Object, Ide.BuildTargetProvider):
         launcher = pipeline.create_launcher()
         launcher.set_flags(Gio.SubprocessFlags.STDOUT_SILENCE | Gio.SubprocessFlags.STDERR_PIPE)
         launcher.set_cwd(pipeline.get_srcdir())
-        launcher.push_argv(build_system.python)
+        if build_system.waf_local:
+            launcher.push_argv(build_system.python)
         launcher.push_argv('waf')
         launcher.push_argv('list')
 


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