diff options
author | William Deegan <bill@baddogconsulting.com> | 2018-11-09 20:30:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-09 20:30:26 (GMT) |
commit | bccc8cfc087cf8ee25a55eb76673a17e7e3a06d0 (patch) | |
tree | 90d884788010bb8a1280d8c26b5f9eafb322928e /testing | |
parent | 6248b8df3aac0f97f547322b939963adc3bf82fe (diff) | |
parent | 210b61f451bef2edf96bc2dafb5055d895f5af22 (diff) | |
download | SCons-bccc8cfc087cf8ee25a55eb76673a17e7e3a06d0.zip SCons-bccc8cfc087cf8ee25a55eb76673a17e7e3a06d0.tar.gz SCons-bccc8cfc087cf8ee25a55eb76673a17e7e3a06d0.tar.bz2 |
Merge pull request #3236 from ptomulik/whereis
attempt fixing TestSCons.where_is() for win32
Diffstat (limited to 'testing')
-rw-r--r-- | testing/framework/TestSCons.py | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index c3018f0..a874e5a 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -342,7 +342,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. @@ -352,26 +352,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 |