mirror of https://gitlab.com/ita1024/waf.git
Cleanup unused global statements
This commit is contained in:
parent
5d4cd9e13c
commit
b5408091b3
|
@ -81,7 +81,6 @@ def create_context(cmd_name, *k, **kw):
|
|||
:return: Context object
|
||||
:rtype: :py:class:`waflib.Context.Context`
|
||||
"""
|
||||
global classes
|
||||
for x in classes:
|
||||
if x.cmd == cmd_name:
|
||||
return x(*k, **kw)
|
||||
|
@ -110,7 +109,6 @@ class store_context(type):
|
|||
if not getattr(cls, 'fun', None):
|
||||
cls.fun = cls.cmd
|
||||
|
||||
global classes
|
||||
classes.insert(0, cls)
|
||||
|
||||
ctx = store_context('ctx', (object,), {})
|
||||
|
@ -150,7 +148,6 @@ class Context(ctx):
|
|||
try:
|
||||
rd = kw['run_dir']
|
||||
except KeyError:
|
||||
global run_dir
|
||||
rd = run_dir
|
||||
|
||||
# binds the context to the nodes in use to avoid a context singleton
|
||||
|
@ -201,7 +198,6 @@ class Context(ctx):
|
|||
Here, it calls the function name in the top-level wscript file. Most subclasses
|
||||
redefine this method to provide additional functionality.
|
||||
"""
|
||||
global g_module
|
||||
self.recurse([os.path.dirname(g_module.root_path)])
|
||||
|
||||
def pre_recurse(self, node):
|
||||
|
@ -624,7 +620,6 @@ class Context(ctx):
|
|||
:param ban: list of exact file names to exclude
|
||||
:type ban: list of string
|
||||
"""
|
||||
global waf_dir
|
||||
if os.path.isdir(waf_dir):
|
||||
lst = self.root.find_node(waf_dir).find_node('waflib/extras').ant_glob(var)
|
||||
for x in lst:
|
||||
|
|
|
@ -139,7 +139,6 @@ class log_filter(logging.Filter):
|
|||
|
||||
:param rec: log entry
|
||||
"""
|
||||
global verbose
|
||||
rec.zone = rec.module
|
||||
if rec.levelno >= logging.INFO:
|
||||
return True
|
||||
|
@ -253,18 +252,15 @@ def debug(*k, **kw):
|
|||
"""
|
||||
Wraps logging.debug and discards messages if the verbosity level :py:attr:`waflib.Logs.verbose` ≤ 0
|
||||
"""
|
||||
global verbose
|
||||
if verbose:
|
||||
k = list(k)
|
||||
k[0] = k[0].replace('\n', ' ')
|
||||
global log
|
||||
log.debug(*k, **kw)
|
||||
|
||||
def error(*k, **kw):
|
||||
"""
|
||||
Wrap logging.errors, adds the stack trace when the verbosity level :py:attr:`waflib.Logs.verbose` ≥ 2
|
||||
"""
|
||||
global log, verbose
|
||||
log.error(*k, **kw)
|
||||
if verbose > 2:
|
||||
st = traceback.extract_stack()
|
||||
|
@ -282,14 +278,12 @@ def warn(*k, **kw):
|
|||
"""
|
||||
Wraps logging.warn
|
||||
"""
|
||||
global log
|
||||
log.warn(*k, **kw)
|
||||
|
||||
def info(*k, **kw):
|
||||
"""
|
||||
Wraps logging.info
|
||||
"""
|
||||
global log
|
||||
log.info(*k, **kw)
|
||||
|
||||
def init_log():
|
||||
|
@ -381,6 +375,5 @@ def pprint(col, msg, label='', sep='\n'):
|
|||
:param sep: a string to append at the end (line separator)
|
||||
:type sep: string
|
||||
"""
|
||||
global info
|
||||
info('%s%s%s %s', colors(col), msg, colors.NORMAL, label, extra={'terminator':sep})
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ class store_task_type(type):
|
|||
name = cls.__name__
|
||||
|
||||
if name != 'evil' and name != 'Task':
|
||||
global classes
|
||||
if getattr(cls, 'run_str', None):
|
||||
# if a string is provided, convert it to a method
|
||||
(f, dvars) = compile_fun(cls.run_str, cls.shell)
|
||||
|
@ -1219,7 +1218,6 @@ def task_factory(name, func=None, vars=None, color='GREEN', ext_in=[], ext_out=[
|
|||
params['run'] = func
|
||||
|
||||
cls = type(Task)(name, (Task,), params)
|
||||
global classes
|
||||
classes[name] = cls
|
||||
|
||||
if ext_in:
|
||||
|
|
|
@ -753,7 +753,6 @@ class subst_pc(Task.Task):
|
|||
lst.append(g(1))
|
||||
return "%%(%s)s" % g(1)
|
||||
return ''
|
||||
global re_m4
|
||||
code = getattr(self.generator, 're_m4', re_m4).sub(repl, code)
|
||||
|
||||
try:
|
||||
|
|
|
@ -845,7 +845,6 @@ class c_parser(object):
|
|||
try:
|
||||
cache = node.ctx.preproc_cache_node
|
||||
except AttributeError:
|
||||
global FILE_CACHE_SIZE
|
||||
cache = node.ctx.preproc_cache_node = Utils.lru_cache(FILE_CACHE_SIZE)
|
||||
|
||||
key = (node, filename)
|
||||
|
@ -924,7 +923,6 @@ class c_parser(object):
|
|||
try:
|
||||
cache = node.ctx.preproc_cache_lines
|
||||
except AttributeError:
|
||||
global LINE_CACHE_SIZE
|
||||
cache = node.ctx.preproc_cache_lines = Utils.lru_cache(LINE_CACHE_SIZE)
|
||||
try:
|
||||
return cache[node]
|
||||
|
@ -1072,9 +1070,6 @@ def scan(task):
|
|||
|
||||
This function is bound as a task method on :py:class:`waflib.Tools.c.c` and :py:class:`waflib.Tools.cxx.cxx` for example
|
||||
"""
|
||||
|
||||
global go_absolute
|
||||
|
||||
try:
|
||||
incn = task.generator.includes_nodes
|
||||
except AttributeError:
|
||||
|
|
|
@ -240,7 +240,6 @@ class jar_create(JTask):
|
|||
if not t.hasrun:
|
||||
return Task.ASK_LATER
|
||||
if not self.inputs:
|
||||
global JAR_RE
|
||||
try:
|
||||
self.inputs = [x for x in self.basedir.ant_glob(JAR_RE, remove=False) if id(x) != id(self.outputs[0])]
|
||||
except Exception:
|
||||
|
@ -273,7 +272,6 @@ class javac(JTask):
|
|||
return Task.ASK_LATER
|
||||
|
||||
if not self.inputs:
|
||||
global SOURCE_RE
|
||||
self.inputs = []
|
||||
for x in self.srcdir:
|
||||
self.inputs.extend(x.ant_glob(SOURCE_RE, remove=False))
|
||||
|
|
|
@ -25,7 +25,6 @@ def h_file(self):
|
|||
if filename in cache and cache[filename][0] == st.st_mtime:
|
||||
return cache[filename][1]
|
||||
|
||||
global STRONGEST
|
||||
if STRONGEST:
|
||||
ret = Utils.h_file(filename)
|
||||
else:
|
||||
|
|
|
@ -167,7 +167,6 @@ class tex(Task.Task):
|
|||
return
|
||||
seen.append(node)
|
||||
code = node.read()
|
||||
global re_tex
|
||||
for match in re_tex.finditer(code):
|
||||
|
||||
multibib = match.group('type')
|
||||
|
|
|
@ -162,7 +162,6 @@ class utest(Task.Task):
|
|||
def exec_command(self, cmd, **kw):
|
||||
Logs.debug('runner: %r', cmd)
|
||||
if getattr(Options.options, 'dump_test_scripts', False):
|
||||
global SCRIPT_TEMPLATE
|
||||
script_code = SCRIPT_TEMPLATE % {
|
||||
'python': sys.executable,
|
||||
'env': self.get_test_env(),
|
||||
|
|
Loading…
Reference in New Issue