[jhbuild] [win32] take .exe extension into account when looking for a command



commit 9e444bd57ed1aed945eba3cfb5bbcb5ae67df5c9
Author: Sam Thursfield <ssssam gmail com>
Date:   Sat May 23 00:31:07 2009 +0200

    [win32] take .exe extension into account when looking for a command
    
    (GNOME bug 583453)
---
 jhbuild/commands/sanitycheck.py |    3 +++
 jhbuild/utils/cmds.py           |    9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/jhbuild/commands/sanitycheck.py b/jhbuild/commands/sanitycheck.py
index b5399dc..306c168 100644
--- a/jhbuild/commands/sanitycheck.py
+++ b/jhbuild/commands/sanitycheck.py
@@ -42,6 +42,9 @@ def inpath(filename, path):
     for dir in path:
         if os.path.isfile(os.path.join(dir, filename)):
             return True
+        # also check for filename.exe on Windows
+        if sys.platform.startswith('win') and os.path.isfile(os.path.join(dir, filename + '.exe')):
+            return True
     return False
 
 
diff --git a/jhbuild/utils/cmds.py b/jhbuild/utils/cmds.py
index 1cd72f7..818640b 100644
--- a/jhbuild/utils/cmds.py
+++ b/jhbuild/utils/cmds.py
@@ -209,9 +209,14 @@ def pprint_output(pipe, format_line):
     return pipe.wait()
 
 def has_command(cmd):
-    for path in os.environ['PATH'].split(':'): 
-        if os.path.exists(os.path.join(path, cmd)):
+    for path in os.environ['PATH'].split(os.pathsep):
+        prog = os.path.abspath(os.path.join(path, cmd))
+        if os.path.exists(prog):
             return True
+
+        # also check for cmd.exe on Windows
+        if sys.platform.startswith('win') and os.path.exists(prog + ".exe"):
+             return True
     return False
 
 def check_version(cmd, regexp, minver, extra_env=None):



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