Adds script section to install waf-light bin and make it look for waflib in PYTHONPATH

This commit is contained in:
Adriano Scoditti 2019-06-26 11:49:07 +02:00
parent 5877a15ece
commit da37dfb7a9
2 changed files with 13 additions and 1 deletions

View File

@ -14,6 +14,7 @@ setuptools.setup(
long_description_content_type="text/markdown",
url="https://gitlab.com/ita1024/waf",
packages=['waflib', 'waflib/Tools', 'waflib/extras'],
scripts=['waf-light'],
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",

View File

@ -130,6 +130,15 @@ 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)
@ -142,6 +151,7 @@ def find_lib():
if name.endswith('waf-light'):
w = test(base)
if w: return w
if test_syspath(): return None
err('waf-light requires waflib -> export WAFDIR=/folder')
dirname = '%s-%s-%s' % (WAF, VERSION, REVISION)
@ -159,7 +169,8 @@ def find_lib():
return dir
wafdir = find_lib()
sys.path.insert(0, wafdir)
if wafdir is not None:
sys.path.insert(0, wafdir)
if __name__ == '__main__':
#import waflib.extras.compat15#PRELUDE