[jhbuild/desrt/master: 8/23] systeminstall: search for path files in sbin



commit 11adbc2ac690981fa2ab6351ded14a1b888c2828
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.

 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 dfcbf6c..8e15c5b 100644
--- a/jhbuild/utils/systeminstall.py
+++ b/jhbuild/utils/systeminstall.py
@@ -130,14 +130,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]