mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 01:46:15 +01:00
Adds script section to install waf-light bin and make it look for waflib in PYTHONPATH
This commit is contained in:
parent
5877a15ece
commit
da37dfb7a9
1
setup.py
1
setup.py
@ -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",
|
||||
|
13
waf-light
13
waf-light
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user