Ensure waf-light is first in sys.path (Pip integration)

This commit is contained in:
Thomas Nagy 2019-06-27 08:38:33 +02:00
parent ba3135c52b
commit 3c75c6eccb
1 changed files with 4 additions and 12 deletions

View File

@ -130,15 +130,6 @@ def test(dir):
except OSError:
pass
def test_syspath():
for dir in sys.path:
try:
os.stat(join(dir, 'waflib'))
return True
except OSError:
pass
return False
def find_lib():
src = os.path.abspath(inspect.getfile(inspect.getmodule(err)))
base, name = os.path.split(src)
@ -151,7 +142,9 @@ def find_lib():
if name.endswith('waf-light'):
w = test(base)
if w: return w
if test_syspath(): return None
for dir in sys.path:
if test(dir):
return dir
err('waf-light requires waflib -> export WAFDIR=/folder')
dirname = '%s-%s-%s' % (WAF, VERSION, REVISION)
@ -169,7 +162,6 @@ def find_lib():
return dir
wafdir = find_lib()
if wafdir is not None:
sys.path.insert(0, wafdir)
if __name__ == '__main__':