Moved unnecessary constants out of Context.py

This commit is contained in:
Thomas Nagy 2016-05-11 21:59:16 +02:00
parent 441ed98a3d
commit da5c7d8b5c
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
2 changed files with 19 additions and 20 deletions

View File

@ -41,7 +41,6 @@ OUT = 'out'
WSCRIPT_FILE = 'wscript'
"""Name of the waf script files"""
launch_dir = ''
"""Directory from which waf has been called"""
run_dir = ''
@ -53,20 +52,6 @@ out_dir = ''
waf_dir = ''
"""Directory containing the waf modules"""
local_repo = ''
"""Local repository containing additional Waf tools (plugins)"""
remote_repo = 'https://raw.githubusercontent.com/waf-project/waf/master/'
"""
Remote directory containing downloadable waf tools. The missing tools can be downloaded by using::
$ waf configure --download
"""
remote_locs = ['waflib/extras', 'waflib/Tools']
"""
Remote directories for use with :py:const:`waflib.Context.remote_repo`
"""
g_module = None
"""
Module representing the main wscript file (see :py:const:`waflib.Context.run_dir`)
@ -82,7 +67,6 @@ List of :py:class:`waflib.Context.Context` subclasses that can be used as waf co
are added automatically by a metaclass.
"""
def create_context(cmd_name, *k, **kw):
"""
Create a new :py:class:`waflib.Context.Context` instance corresponding to the given command.
@ -687,7 +671,7 @@ def load_tool(tool, tooldir=None, ctx=None, with_sys_path=True):
break
except ImportError:
x = None
if x is None: # raise an exception
else: # raise an exception
__import__(tool)
finally:
if not with_sys_path: sys.path.remove(waf_dir)

View File

@ -50,6 +50,21 @@ import sys
import os.path as osp
import os
local_repo = ''
"""Local repository containing additional Waf tools (plugins)"""
remote_repo = 'https://raw.githubusercontent.com/waf-project/waf/master/'
"""
Remote directory containing downloadable waf tools. The missing tools can be downloaded by using::
$ waf configure --download
"""
remote_locs = ['waflib/extras', 'waflib/Tools']
"""
Remote directories for use with :py:const:`waflib.extras.use_config.remote_repo`
"""
try:
from urllib import request
except ImportError:
@ -94,12 +109,12 @@ def download_check(node):
def download_tool(tool, force=False, ctx=None):
"""
Download a Waf tool from the remote repository defined in :py:const:`waflib.Context.remote_repo`::
Download a Waf tool from the remote repository defined in :py:const:`waflib.extras.use_config.remote_repo`::
$ waf configure --download
"""
for x in Utils.to_list(Context.remote_repo):
for sub in Utils.to_list(Context.remote_locs):
for x in Utils.to_list(remote_repo):
for sub in Utils.to_list(remote_locs):
url = '/'.join((x, sub, tool + '.py'))
try:
web = urlopen(url)