diff --git a/waflib/Context.py b/waflib/Context.py index 7c2b7b3c..dcd6cae9 100644 --- a/waflib/Context.py +++ b/waflib/Context.py @@ -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: diff --git a/waflib/Logs.py b/waflib/Logs.py index 3e0b06d7..c524c46f 100644 --- a/waflib/Logs.py +++ b/waflib/Logs.py @@ -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}) diff --git a/waflib/Task.py b/waflib/Task.py index d9dbd6e8..37c9baeb 100644 --- a/waflib/Task.py +++ b/waflib/Task.py @@ -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: diff --git a/waflib/TaskGen.py b/waflib/TaskGen.py index ac2ed85f..2e67784b 100644 --- a/waflib/TaskGen.py +++ b/waflib/TaskGen.py @@ -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: diff --git a/waflib/Tools/c_preproc.py b/waflib/Tools/c_preproc.py index 63cff65b..a07f1195 100644 --- a/waflib/Tools/c_preproc.py +++ b/waflib/Tools/c_preproc.py @@ -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: diff --git a/waflib/Tools/javaw.py b/waflib/Tools/javaw.py index b0e93187..a3529e63 100644 --- a/waflib/Tools/javaw.py +++ b/waflib/Tools/javaw.py @@ -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)) diff --git a/waflib/Tools/md5_tstamp.py b/waflib/Tools/md5_tstamp.py index 414a1222..6428e460 100644 --- a/waflib/Tools/md5_tstamp.py +++ b/waflib/Tools/md5_tstamp.py @@ -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: diff --git a/waflib/Tools/tex.py b/waflib/Tools/tex.py index f2f53585..4710f001 100644 --- a/waflib/Tools/tex.py +++ b/waflib/Tools/tex.py @@ -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') diff --git a/waflib/Tools/waf_unit_test.py b/waflib/Tools/waf_unit_test.py index a6f89527..5f18a474 100644 --- a/waflib/Tools/waf_unit_test.py +++ b/waflib/Tools/waf_unit_test.py @@ -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(),