[jhbuild] systeminstall: search for path files in sbin



commit 921ee9aa9bfda7bcaf3aca4b5a4c37fa7c13bf78
Author: Ryan Lortie <desrt desrt ca>
Date:   Fri Jan 2 19:04:36 2015 -0500

    systeminstall: search for path files in sbin
    
    /sbin and /usr/sbin may be missing from $PATH so make sure we include
    them when looking for path programs.
    
    This is needed to find iptables on Debian.
    
    While we're at it, rewrite the loop to take advantage of for/else to
    remove the need for a separate 'found' variable.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742268

 jhbuild/utils/systeminstall.py |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/jhbuild/utils/systeminstall.py b/jhbuild/utils/systeminstall.py
index 673e433..ffa1ccd 100644
--- a/jhbuild/utils/systeminstall.py
+++ b/jhbuild/utils/systeminstall.py
@@ -125,14 +125,13 @@ def systemdependencies_met(module_name, sysdeps, config):
                 if not os.path.isfile(value) and not os.access(value, os.X_OK):
                     return False
             else:
-                found = False
-                for path in os.environ.get('PATH', '').split(os.pathsep):
+                pathdirs = set(os.environ.get('PATH', '').split(os.pathsep))
+                pathdirs.update(['/sbin', '/usr/sbin'])
+                for path in pathdirs:
                     filename = os.path.join(path, value)
-                    if (os.path.isfile(filename) and
-                        os.access(filename, os.X_OK)):
-                        found = True
+                    if os.path.isfile(filename) and os.access(filename, os.X_OK):
                         break
-                if not found:
+                else:
                     return False
         elif dep_type.lower() == 'c_include':
             if c_include_search_paths is None:


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