2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-23 02:16:01 +01:00

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' WSCRIPT_FILE = 'wscript'
"""Name of the waf script files""" """Name of the waf script files"""
launch_dir = '' launch_dir = ''
"""Directory from which waf has been called""" """Directory from which waf has been called"""
run_dir = '' run_dir = ''
@ -53,20 +52,6 @@ out_dir = ''
waf_dir = '' waf_dir = ''
"""Directory containing the waf modules""" """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 g_module = None
""" """
Module representing the main wscript file (see :py:const:`waflib.Context.run_dir`) 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. are added automatically by a metaclass.
""" """
def create_context(cmd_name, *k, **kw): def create_context(cmd_name, *k, **kw):
""" """
Create a new :py:class:`waflib.Context.Context` instance corresponding to the given command. 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 break
except ImportError: except ImportError:
x = None x = None
if x is None: # raise an exception else: # raise an exception
__import__(tool) __import__(tool)
finally: finally:
if not with_sys_path: sys.path.remove(waf_dir) 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.path as osp
import os 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: try:
from urllib import request from urllib import request
except ImportError: except ImportError:
@ -94,12 +109,12 @@ def download_check(node):
def download_tool(tool, force=False, ctx=None): 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 $ waf configure --download
""" """
for x in Utils.to_list(Context.remote_repo): for x in Utils.to_list(remote_repo):
for sub in Utils.to_list(Context.remote_locs): for sub in Utils.to_list(remote_locs):
url = '/'.join((x, sub, tool + '.py')) url = '/'.join((x, sub, tool + '.py'))
try: try:
web = urlopen(url) web = urlopen(url)