summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorPaweł Tomulik <ptomulik@meil.pw.edu.pl>2018-11-06 14:16:41 (GMT)
committerPaweł Tomulik <ptomulik@meil.pw.edu.pl>2018-11-06 23:32:47 (GMT)
commit210b61f451bef2edf96bc2dafb5055d895f5af22 (patch)
treeca5b982c4aff4d5f382dc87dc4bef82c18d16fd1 /testing
parent9685d23fc73e3266abd4a5a47669b9d321c53665 (diff)
downloadSCons-210b61f451bef2edf96bc2dafb5055d895f5af22.zip
SCons-210b61f451bef2edf96bc2dafb5055d895f5af22.tar.gz
SCons-210b61f451bef2edf96bc2dafb5055d895f5af22.tar.bz2
attempt fixing TestSCons.where_is() for win32
Diffstat (limited to 'testing')
-rw-r--r--testing/framework/TestSCons.py22
1 files changed, 5 insertions, 17 deletions
diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py
index 68641f0..a3b12c0 100644
--- a/testing/framework/TestSCons.py
+++ b/testing/framework/TestSCons.py
@@ -333,7 +333,7 @@ class TestSCons(TestCommon):
return None
return env.Detect([prog])
- def where_is(self, prog, path=None):
+ def where_is(self, prog, path=None, pathext=None):
"""
Given a program, search for it in the specified external PATH,
or in the actual external PATH if none is specified.
@@ -343,26 +343,14 @@ class TestSCons(TestCommon):
if self.external:
if isinstance(prog, str):
prog = [prog]
- import stat
- paths = path.split(os.pathsep)
for p in prog:
- for d in paths:
- f = os.path.join(d, p)
- if os.path.isfile(f):
- try:
- st = os.stat(f)
- except OSError:
- # os.stat() raises OSError, not IOError if the file
- # doesn't exist, so in this case we let IOError get
- # raised so as to not mask possibly serious disk or
- # network issues.
- continue
- if stat.S_IMODE(st[stat.ST_MODE]) & 0o111:
- return os.path.normpath(f)
+ result = TestCmd.where_is(self, p, path, pathext)
+ if result:
+ return os.path.normpath(result)
else:
import SCons.Environment
env = SCons.Environment.Environment()
- return env.WhereIs(prog, path)
+ return env.WhereIs(prog, path, pathext)
return None