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",
|
long_description_content_type="text/markdown",
|
||||||
url="https://gitlab.com/ita1024/waf",
|
url="https://gitlab.com/ita1024/waf",
|
||||||
packages=['waflib', 'waflib/Tools', 'waflib/extras'],
|
packages=['waflib', 'waflib/Tools', 'waflib/extras'],
|
||||||
|
scripts=['waf-light'],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
|
13
waf-light
13
waf-light
@ -130,6 +130,15 @@ def test(dir):
|
|||||||
except OSError:
|
except OSError:
|
||||||
pass
|
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():
|
def find_lib():
|
||||||
src = os.path.abspath(inspect.getfile(inspect.getmodule(err)))
|
src = os.path.abspath(inspect.getfile(inspect.getmodule(err)))
|
||||||
base, name = os.path.split(src)
|
base, name = os.path.split(src)
|
||||||
@ -142,6 +151,7 @@ def find_lib():
|
|||||||
if name.endswith('waf-light'):
|
if name.endswith('waf-light'):
|
||||||
w = test(base)
|
w = test(base)
|
||||||
if w: return w
|
if w: return w
|
||||||
|
if test_syspath(): return None
|
||||||
err('waf-light requires waflib -> export WAFDIR=/folder')
|
err('waf-light requires waflib -> export WAFDIR=/folder')
|
||||||
|
|
||||||
dirname = '%s-%s-%s' % (WAF, VERSION, REVISION)
|
dirname = '%s-%s-%s' % (WAF, VERSION, REVISION)
|
||||||
@ -159,7 +169,8 @@ def find_lib():
|
|||||||
return dir
|
return dir
|
||||||
|
|
||||||
wafdir = find_lib()
|
wafdir = find_lib()
|
||||||
sys.path.insert(0, wafdir)
|
if wafdir is not None:
|
||||||
|
sys.path.insert(0, wafdir)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#import waflib.extras.compat15#PRELUDE
|
#import waflib.extras.compat15#PRELUDE
|
||||||
|
Loading…
Reference in New Issue
Block a user