From 02a8361149aae7e6c7f88159386e8ea42f846c27 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Sat, 28 May 2016 16:18:51 +0200 Subject: [PATCH] Beautify Logs.{debug,error,info,warn} now that the formatting bug is fixed --- build_system_kit/makefile_dumper/wscript | 4 ++-- demos/wscript | 4 ++-- docs/book/development.txt | 2 +- playground/gtest/wscript | 6 ++--- playground/implicit_order/wscript | 2 +- waflib/Build.py | 26 ++++++++++----------- waflib/Logs.py | 2 +- waflib/Scripting.py | 24 +++++++++---------- waflib/Task.py | 2 +- waflib/TaskGen.py | 2 +- waflib/Tools/c_config.py | 4 ++-- waflib/Tools/errcheck.py | 26 ++++++++++----------- waflib/Tools/tex.py | 8 +++---- waflib/Tools/vala.py | 4 ++-- waflib/Tools/winres.py | 2 +- waflib/extras/boost.py | 2 +- waflib/extras/build_logs.py | 2 +- waflib/extras/clang_compilation_database.py | 2 +- waflib/extras/codelite.py | 12 ++++------ waflib/extras/compat15.py | 12 +++++----- waflib/extras/cython.py | 8 +++---- waflib/extras/distnet.py | 13 +++++------ waflib/extras/gccdeps.py | 4 ++-- waflib/extras/msvcdeps.py | 6 ++--- waflib/extras/msvs.py | 8 +++---- waflib/extras/netcache_client.py | 8 +++---- waflib/extras/package.py | 2 +- waflib/extras/parallel_debug.py | 2 +- waflib/extras/print_commands.py | 4 ++-- waflib/extras/rst.py | 14 +++++------ waflib/extras/run_do_script.py | 6 ++--- waflib/extras/run_m_script.py | 6 ++--- waflib/extras/run_py_script.py | 11 ++++----- waflib/extras/run_r_script.py | 10 ++++---- waflib/extras/sas.py | 10 ++++---- waflib/extras/stale.py | 2 +- waflib/extras/stracedeps.py | 2 +- waflib/extras/swig.py | 2 +- waflib/extras/use_config.py | 4 ++-- waflib/extras/valadoc.py | 2 +- waflib/extras/why.py | 4 ++-- waflib/extras/win32_opts.py | 4 ++-- waflib/extras/xcode6.py | 5 ++-- wscript | 4 ++-- 44 files changed, 142 insertions(+), 147 deletions(-) diff --git a/build_system_kit/makefile_dumper/wscript b/build_system_kit/makefile_dumper/wscript index 5e9b3f24..4a90fbbe 100644 --- a/build_system_kit/makefile_dumper/wscript +++ b/build_system_kit/makefile_dumper/wscript @@ -73,7 +73,7 @@ def dump(bld): def output_makefile(self): self.commands.insert(0, "all: %s" % " ".join(self.targets)) node = self.bldnode.make_node('Makefile') - node.write("\n".join(self.commands)) - Logs.warn('Wrote %s' % node.abspath()) + node.write('\n'.join(self.commands)) + Logs.warn('Wrote %r', node) bld.add_post_fun(output_makefile) diff --git a/demos/wscript b/demos/wscript index 2e898da1..2b6baa80 100644 --- a/demos/wscript +++ b/demos/wscript @@ -67,7 +67,7 @@ def configure(conf): conf.env.revert() node = conf.path.find_node('%s/build/config.log' % d.name) if node: - Logs.info("-- BEGIN %s config.log --\n%s-- END %s config.log --" % (d.name, node.read(), d.name)) + Logs.info('-- BEGIN %s config.log --\n%s-- END %s config.log --', d.name, node.read(), d.name) try: e = sys.exc_info()[1] print(e) @@ -92,7 +92,7 @@ def configure(conf): else: conf.env.append_value('PYTHONS', x) - Logs.info("executing the build for folders %r and with pythons %r" % (conf.env.CFG, conf.env.PYTHONS)) + Logs.info('executing the build for folders %r and with pythons %r', conf.env.CFG, conf.env.PYTHONS) Logs.info("contents of config.log:") Logs.info(conf.path.find_node('build/config.log').read()) diff --git a/docs/book/development.txt b/docs/book/development.txt index 3ca8f0b6..30d47649 100644 --- a/docs/book/development.txt +++ b/docs/book/development.txt @@ -38,7 +38,7 @@ The Waf module 'Logs' replaces the Python module logging. In the source code, tr [source,python] --------------- -Logs.debug("task: executing %r - it was never run before or its class changed" % self) +Logs.debug('task: executing %r - it was never run before or its class changed', self) --------------- The following zones are used in Waf: diff --git a/playground/gtest/wscript b/playground/gtest/wscript index 5919f3ca..3e6f8cdd 100644 --- a/playground/gtest/wscript +++ b/playground/gtest/wscript @@ -42,12 +42,12 @@ def gtest_results(bld): if ' OK ]' in output[i]: continue while not '[ ' in output[i]: - Logs.warn('%s' % output[i]) + Logs.warn(output[i]) i += 1 elif ' FAILED ]' in line and code: - Logs.error('%s' % line) + Logs.error(line) elif ' PASSED ]' in line: - Logs.info('%s' % line) + Logs.info(line) def build(bld): bld.recurse('src tests') diff --git a/playground/implicit_order/wscript b/playground/implicit_order/wscript index 925d9047..e72b5fc2 100644 --- a/playground/implicit_order/wscript +++ b/playground/implicit_order/wscript @@ -57,7 +57,7 @@ def are_implicit_nodes_ready(self): if modified: for tsk in self.run_after: if not tsk.hasrun: - Logs.warn("task %r is not ready..." % self) + Logs.warn('task %r is not ready...', self) raise Errors.TaskNotReady('not ready') Task.Task.are_implicit_nodes_ready = are_implicit_nodes_ready diff --git a/waflib/Build.py b/waflib/Build.py index 26209684..7218807e 100644 --- a/waflib/Build.py +++ b/waflib/Build.py @@ -250,7 +250,7 @@ class BuildContext(Context.Context): * calling :py:meth:`waflib.Build.BuildContext.post_build` to call user build functions """ - Logs.info("Waf: Entering directory `%s'" % self.variant_dir) + Logs.info("Waf: Entering directory `%s'", self.variant_dir) self.recurse([self.run_dir]) self.pre_build() @@ -264,7 +264,7 @@ class BuildContext(Context.Context): c = self.producer.processed or 1 m = self.progress_line(c, c, Logs.colors.BLUE, Logs.colors.NORMAL) Logs.info(m, extra={'stream': sys.stderr, 'c1': Logs.colors.cursor_off, 'c2' : Logs.colors.cursor_on}) - Logs.info("Waf: Leaving directory `%s'" % self.variant_dir) + Logs.info("Waf: Leaving directory `%s'", self.variant_dir) try: self.producer.bld = None del self.producer @@ -630,7 +630,7 @@ class BuildContext(Context.Context): #if self.groups and not self.groups[0].tasks: # error('add_group: an empty group is already present') if name and name in self.group_names: - Logs.error('add_group: name %s already present' % name) + Logs.error('add_group: name %s already present', name) g = [] self.group_names[name] = g self.groups.append(g) @@ -731,7 +731,7 @@ class BuildContext(Context.Context): Logs.warn('Building from the build directory, forcing --targets=*') ln = self.srcnode elif not ln.is_child_of(self.srcnode): - Logs.warn('CWD %s is not under %s, forcing --targets=* (run distclean?)' % (ln.abspath(), self.srcnode.abspath())) + Logs.warn('CWD %s is not under %s, forcing --targets=* (run distclean?)', ln.abspath(), self.srcnode.abspath()) ln = self.srcnode for tg in self.groups[self.cur]: try: @@ -1054,11 +1054,11 @@ class inst(Task.Task): # same size and identical timestamps -> make no copy if st1.st_mtime + 2 >= st2.st_mtime and st1.st_size == st2.st_size: if not self.generator.bld.progress_bar: - Logs.info('- install %s (from %s)' % (tgt, lbl)) + Logs.info('- install %s (from %s)', tgt, lbl) return False if not self.generator.bld.progress_bar: - Logs.info('+ install %s (from %s)' % (tgt, lbl)) + Logs.info('+ install %s (from %s)', tgt, lbl) # Give best attempt at making destination overwritable, # like the 'install' utility used by 'make install' does. @@ -1077,7 +1077,7 @@ class inst(Task.Task): self.copy_fun(src, tgt) except IOError: if not src.exists(): - Logs.error('File %r does not exist' % src) + Logs.error('File %r does not exist', src) raise Errors.WafError('Could not install the file %r' % tgt) def do_link(self, src, tgt, **kw): @@ -1091,19 +1091,19 @@ class inst(Task.Task): """ if os.path.islink(tgt) and os.readlink(tgt) == src: if not self.generator.bld.progress_bar: - Logs.info('- symlink %s (to %s)' % (tgt, src)) + Logs.info('- symlink %s (to %s)', tgt, src) else: try: os.remove(tgt) except OSError: pass if not self.generator.bld.progress_bar: - Logs.info('+ symlink %s (to %s)' % (tgt, src)) + Logs.info('+ symlink %s (to %s)', tgt, src) os.symlink(src, tgt) def do_uninstall(self, src, tgt, lbl, **kw): if not self.generator.bld.progress_bar: - Logs.info('- remove %s' % tgt) + Logs.info('- remove %s', tgt) #self.uninstall.append(tgt) try: @@ -1114,14 +1114,14 @@ class inst(Task.Task): self.uninstall_error = True Logs.warn('build: some files could not be uninstalled (retry with -vv to list them)') if Logs.verbose > 1: - Logs.warn('Could not remove %s (error code %r)' % (e.filename, e.errno)) + Logs.warn('Could not remove %s (error code %r)', e.filename, e.errno) self.rm_empty_dirs(tgt) def do_unlink(self, src, tgt, **kw): # TODO do_uninstall with proper amount of args try: if not self.generator.bld.progress_bar: - Logs.info('- remove %s' % tgt) + Logs.info('- remove %s', tgt) os.remove(tgt) except OSError: pass @@ -1289,7 +1289,7 @@ class StepContext(BuildContext): break if do_exec: ret = tsk.run() - Logs.info('%s -> exit %r' % (str(tsk), ret)) + Logs.info('%s -> exit %r', tsk, ret) def get_matcher(self, pat): # this returns a function diff --git a/waflib/Logs.py b/waflib/Logs.py index 946421ce..f92283bc 100644 --- a/waflib/Logs.py +++ b/waflib/Logs.py @@ -344,5 +344,5 @@ def pprint(col, msg, label='', sep='\n'): :param sep: a string to append at the end (line separator) :type sep: string """ - info("%s%s%s %s" % (colors(col), msg, colors.NORMAL, label), extra={'terminator':sep}) + info('%s%s%s %s', colors(col), msg, colors.NORMAL, label, extra={'terminator':sep}) diff --git a/waflib/Scripting.py b/waflib/Scripting.py index f6bd6426..75d9af4a 100644 --- a/waflib/Scripting.py +++ b/waflib/Scripting.py @@ -28,7 +28,7 @@ def waf_entry_point(current_directory, version, wafdir): Logs.init_log() if Context.WAFVERSION != version: - Logs.error('Waf script %r and library %r do not match (directory %r)' % (version, Context.WAFVERSION, wafdir)) + Logs.error('Waf script %r and library %r do not match (directory %r)', version, Context.WAFVERSION, wafdir) sys.exit(1) if '--version' in sys.argv: @@ -80,7 +80,7 @@ def waf_entry_point(current_directory, version, wafdir): lst = os.listdir(cur) except OSError: lst = [] - Logs.error('Directory %r is unreadable!' % cur) + Logs.error('Directory %r is unreadable!', cur) if Options.lockfile in lst: env = ConfigSet.ConfigSet() try: @@ -106,7 +106,7 @@ def waf_entry_point(current_directory, version, wafdir): load = True break else: - Logs.warn('invalid lock file in %s' % cur) + Logs.warn('invalid lock file in %s', cur) load = False if load: @@ -135,13 +135,13 @@ def waf_entry_point(current_directory, version, wafdir): ctx.curdir = current_directory ctx.parse_args() sys.exit(0) - Logs.error('Waf: Run from a directory containing a file named %r' % Context.WSCRIPT_FILE) + Logs.error('Waf: Run from a directory containing a file named %r', Context.WSCRIPT_FILE) sys.exit(1) try: os.chdir(Context.run_dir) except OSError: - Logs.error('Waf: The folder %r is unreadable' % Context.run_dir) + Logs.error('Waf: The folder %r is unreadable', Context.run_dir) sys.exit(1) try: @@ -151,7 +151,7 @@ def waf_entry_point(current_directory, version, wafdir): Logs.error(str(e)) sys.exit(1) except Exception as e: - Logs.error('Waf: The wscript in %r is unreadable' % Context.run_dir, e) + Logs.error('Waf: The wscript in %r is unreadable', Context.run_dir) traceback.print_exc(file=sys.stdout) sys.exit(2) @@ -264,7 +264,7 @@ def run_commands(): while Options.commands: cmd_name = Options.commands.pop(0) ctx = run_command(cmd_name) - Logs.info('%r finished successfully (%s)' % (cmd_name, str(ctx.log_timer))) + Logs.info('%r finished successfully (%s)', cmd_name, ctx.log_timer) run_command('shutdown') ########################################################################################### @@ -285,7 +285,7 @@ def distclean_dir(dirname): try: os.remove(fname) except OSError: - Logs.warn('Could not remove %r' % fname) + Logs.warn('Could not remove %r', fname) for x in (Context.DBFILE, 'config.log'): try: @@ -306,7 +306,7 @@ def distclean(ctx): try: proj = ConfigSet.ConfigSet(f) except IOError: - Logs.warn('Could not read %r' % f) + Logs.warn('Could not read %r', f) continue if proj['out_dir'] != proj['top_dir']: @@ -316,7 +316,7 @@ def distclean(ctx): pass except OSError as e: if e.errno != errno.ENOENT: - Logs.warn('Could not remove %r' % proj['out_dir']) + Logs.warn('Could not remove %r', proj['out_dir']) else: distclean_dir(proj['out_dir']) @@ -326,7 +326,7 @@ def distclean(ctx): os.remove(p) except OSError as e: if e.errno != errno.ENOENT: - Logs.warn('Could not remove %r' % p) + Logs.warn('Could not remove %r', p) # remove local waf cache folders if not Options.commands: @@ -393,7 +393,7 @@ class Dist(Context.Context): else: digest = ' (sha=%r)' % sha1(node.read()).hexdigest() - Logs.info('New archive created: %s%s' % (self.arch_name, digest)) + Logs.info('New archive created: %s%s', self.arch_name, digest) def get_tar_path(self, node): """ diff --git a/waflib/Task.py b/waflib/Task.py index 18744e82..c9bf6882 100644 --- a/waflib/Task.py +++ b/waflib/Task.py @@ -723,7 +723,7 @@ class Task(TaskBase): except (OSError, IOError): for k in bld.node_deps.get(self.uid(), []): if not k.exists(): - Logs.warn('Dependency %r for %r is missing: check the task declaration and the build order!' % (k, self)) + Logs.warn('Dependency %r for %r is missing: check the task declaration and the build order!', k, self) raise def compute_sig_implicit_deps(self): diff --git a/waflib/TaskGen.py b/waflib/TaskGen.py index bfda1c28..c38dda98 100644 --- a/waflib/TaskGen.py +++ b/waflib/TaskGen.py @@ -167,7 +167,7 @@ class task_gen(object): st = feats[x] if not st: if not x in Task.classes: - Logs.warn('feature %r does not exist - bind at least one method to it' % x) + Logs.warn('feature %r does not exist - bind at least one method to it', x) keys.update(list(st)) # ironpython 2.7 wants the cast to list # copy the precedence table diff --git a/waflib/Tools/c_config.py b/waflib/Tools/c_config.py index 82f1abc6..0c00ebf6 100644 --- a/waflib/Tools/c_config.py +++ b/waflib/Tools/c_config.py @@ -274,8 +274,8 @@ def validate_cfg(self, kw): if y in kw: package = kw['package'] if Logs.verbose: - Logs.warn('Passing %r to conf.check_cfg() is obsolete, pass parameters directly, eg:' % y) - Logs.warn(" conf.check_cfg(package='%s', args=['--libs', '--cflags', '%s >= 1.6'])" % (package, package)) + Logs.warn('Passing %r to conf.check_cfg() is obsolete, pass parameters directly, eg:', y) + Logs.warn(" conf.check_cfg(package='%s', args=['--libs', '--cflags', '%s >= 1.6'])", package, package) if not 'msg' in kw: kw['msg'] = 'Checking for %r %s %s' % (package, cfg_ver[x], kw[y]) break diff --git a/waflib/Tools/errcheck.py b/waflib/Tools/errcheck.py index b66f4fc2..edfa00ed 100644 --- a/waflib/Tools/errcheck.py +++ b/waflib/Tools/errcheck.py @@ -58,16 +58,16 @@ def check_same_targets(self): Logs.error(msg) for x in v: if Logs.verbose > 1: - Logs.error(' %d. %r' % (1 + v.index(x), x.generator)) + Logs.error(' %d. %r', 1 + v.index(x), x.generator) else: - Logs.error(' %d. %r in %r' % (1 + v.index(x), x.generator.name, getattr(x.generator, 'path', None))) + Logs.error(' %d. %r in %r', 1 + v.index(x), x.generator.name, getattr(x.generator, 'path', None)) if not dupe: for (k, v) in uids.items(): if len(v) > 1: Logs.error('* Several tasks use the same identifier. Please check the information on\n https://waf.io/apidocs/Task.html?highlight=uid#waflib.Task.Task.uid') for tsk in v: - Logs.error(' - object %r (%r) defined in %r' % (tsk.__class__.__name__, tsk, tsk.generator)) + Logs.error(' - object %r (%r) defined in %r', tsk.__class__.__name__, tsk, tsk.generator) def check_invalid_constraints(self): feat = set([]) @@ -81,7 +81,7 @@ def check_invalid_constraints(self): ext.add(x.__name__) invalid = ext & feat if invalid: - Logs.error('The methods %r have invalid annotations: @extension <-> @feature/@before_method/@after_method' % list(invalid)) + Logs.error('The methods %r have invalid annotations: @extension <-> @feature/@before_method/@after_method', list(invalid)) # the build scripts have been read, so we can check for invalid after/before attributes on task classes for cls in list(Task.classes.values()): @@ -91,9 +91,9 @@ def check_invalid_constraints(self): for x in ('before', 'after'): for y in Utils.to_list(getattr(cls, x, [])): if not Task.classes.get(y): - Logs.error('Erroneous order constraint %r=%r on task class %r' % (x, y, cls.__name__)) + Logs.error('Erroneous order constraint %r=%r on task class %r', x, y, cls.__name__) if getattr(cls, 'rule', None): - Logs.error('Erroneous attribute "rule" on task class %r (rename to "run_str")' % cls.__name__) + Logs.error('Erroneous attribute "rule" on task class %r (rename to "run_str")', cls.__name__) def replace(m): """ @@ -107,7 +107,7 @@ def replace(m): if x in kw: if x == 'iscopy' and 'subst' in getattr(self, 'features', ''): continue - Logs.error('Fix the typo %r -> %r on %r' % (x, typos[x], ret)) + Logs.error('Fix the typo %r -> %r on %r', x, typos[x], ret) return ret setattr(Build.BuildContext, m, call) @@ -124,11 +124,11 @@ def enhance_lib(): lst=Utils.to_list(k[0]) for pat in lst: if '..' in pat.split('/'): - Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" % k[0]) + Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'", k[0]) if kw.get('remove', True): try: if self.is_child_of(self.ctx.bldnode) and not kw.get('quiet', False): - Logs.error('Using ant_glob on the build folder (%r) is dangerous (quiet=True to disable this warning)' % self) + Logs.error('Using ant_glob on the build folder (%r) is dangerous (quiet=True to disable this warning)', self) except AttributeError: pass return self.old_ant_glob(*k, **kw) @@ -140,7 +140,7 @@ def enhance_lib(): def is_before(t1, t2): ret = old(t1, t2) if ret and old(t2, t1): - Logs.error('Contradictory order constraints in classes %r %r' % (t1, t2)) + Logs.error('Contradictory order constraints in classes %r %r', t1, t2) return ret Task.is_before = is_before @@ -152,7 +152,7 @@ def enhance_lib(): Logs.error('feature shlib -> cshlib, dshlib or cxxshlib') for x in ('c', 'cxx', 'd', 'fc'): if not x in lst and lst and lst[0] in [x+y for y in ('program', 'shlib', 'stlib')]: - Logs.error('%r features is probably missing %r' % (self, x)) + Logs.error('%r features is probably missing %r', self, x) TaskGen.feature('*')(check_err_features) # check for erroneous order constraints @@ -160,12 +160,12 @@ def enhance_lib(): if not hasattr(self, 'rule') and not 'subst' in Utils.to_list(self.features): for x in ('before', 'after', 'ext_in', 'ext_out'): if hasattr(self, x): - Logs.warn('Erroneous order constraint %r on non-rule based task generator %r' % (x, self)) + Logs.warn('Erroneous order constraint %r on non-rule based task generator %r', x, self) else: for x in ('before', 'after'): for y in self.to_list(getattr(self, x, [])): if not Task.classes.get(y, None): - Logs.error('Erroneous order constraint %s=%r on %r (no such class)' % (x, y, self)) + Logs.error('Erroneous order constraint %s=%r on %r (no such class)', x, y, self) TaskGen.feature('*')(check_err_order) # check for @extension used with @feature/@before_method/@after_method diff --git a/waflib/Tools/tex.py b/waflib/Tools/tex.py index 306f99b7..4dcc3379 100644 --- a/waflib/Tools/tex.py +++ b/waflib/Tools/tex.py @@ -239,7 +239,7 @@ class tex(Task.Task): try: ct = aux_node.read() except EnvironmentError: - Logs.error('Error reading %s: %r' % aux_node.abspath()) + Logs.error('Error reading %s: %r', aux_node.abspath()) continue if g_bibtex_re.findall(ct): @@ -312,7 +312,7 @@ class tex(Task.Task): try: ct = aux_node.read() except EnvironmentError: - Logs.error('Error reading %s: %r' % aux_node.abspath()) + Logs.error('Error reading %s: %r', aux_node.abspath()) continue if g_glossaries_re.findall(ct): @@ -477,9 +477,9 @@ def apply_tex(self): if p: task.texinputs_nodes.append(p) else: - Logs.error('Invalid TEXINPUTS folder %s' % x) + Logs.error('Invalid TEXINPUTS folder %s', x) else: - Logs.error('Cannot resolve relative paths in TEXINPUTS %s' % x) + Logs.error('Cannot resolve relative paths in TEXINPUTS %s', x) if self.type == 'latex': if 'ps' in outs: diff --git a/waflib/Tools/vala.py b/waflib/Tools/vala.py index ddd5ac34..2e90c350 100644 --- a/waflib/Tools/vala.py +++ b/waflib/Tools/vala.py @@ -82,7 +82,7 @@ def init_vala_task(self): self.use.append('GTHREAD') else: #Vala doesn't have threading support for dova nor posix - Logs.warn("Profile %s means no threading support" % self.profile) + Logs.warn('Profile %s means no threading support', self.profile) self.thread = False if self.thread: @@ -172,7 +172,7 @@ def init_vala_task(self): else: v_node = self.path.find_dir(vapi_dir) if not v_node: - Logs.warn('Unable to locate Vala API directory: %r' % vapi_dir) + Logs.warn('Unable to locate Vala API directory: %r', vapi_dir) else: addflags('--vapidir=%s' % v_node.abspath()) diff --git a/waflib/Tools/winres.py b/waflib/Tools/winres.py index 6c7e66ae..50a4f408 100644 --- a/waflib/Tools/winres.py +++ b/waflib/Tools/winres.py @@ -70,7 +70,7 @@ class rc_parser(c_preproc.c_parser): raise c_preproc.PreprocError("could not read the file %s" % filepath) except Exception: if Logs.verbose > 0: - Logs.error("parsing %s failed" % filepath) + Logs.error("parsing %s failed", filepath) traceback.print_exc() class winrc(Task.Task): diff --git a/waflib/extras/boost.py b/waflib/extras/boost.py index c9367a38..107c1d93 100644 --- a/waflib/extras/boost.py +++ b/waflib/extras/boost.py @@ -161,7 +161,7 @@ def boost_get_version(self, d): try: txt = node.read() except EnvironmentError: - Logs.error("Could not read the file %r" % node.abspath()) + Logs.error("Could not read the file %r", node.abspath()) else: re_but1 = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.+)"', re.M) m1 = re_but1.search(txt) diff --git a/waflib/extras/build_logs.py b/waflib/extras/build_logs.py index 7ccb18a7..9feb2239 100644 --- a/waflib/extras/build_logs.py +++ b/waflib/extras/build_logs.py @@ -96,7 +96,7 @@ def exit_cleanup(): fileobj.close() filename = sys.stdout.filename - Logs.info('Output logged to %r' % filename) + Logs.info('Output logged to %r', filename) # then copy the log file to "latest.log" if possible up = os.path.dirname(os.path.abspath(filename)) diff --git a/waflib/extras/clang_compilation_database.py b/waflib/extras/clang_compilation_database.py index a9e61ff0..5229360e 100644 --- a/waflib/extras/clang_compilation_database.py +++ b/waflib/extras/clang_compilation_database.py @@ -40,7 +40,7 @@ def collect_compilation_db_tasks(self): def write_compilation_database(ctx): "Write the clang compilation database as JSON" database_file = ctx.bldnode.make_node('compile_commands.json') - Logs.info("Build commands will be stored in %s" % database_file.path_from(ctx.path)) + Logs.info('Build commands will be stored in %s', database_file.path_from(ctx.path)) try: root = json.load(database_file) except IOError: diff --git a/waflib/extras/codelite.py b/waflib/extras/codelite.py index 866a01b3..794875a0 100644 --- a/waflib/extras/codelite.py +++ b/waflib/extras/codelite.py @@ -325,7 +325,7 @@ def stealth_write(self, data, flags='wb'): except (IOError, ValueError): self.write(data, flags=flags) else: - Logs.debug('codelite: skipping %s' % self.abspath()) + Logs.debug('codelite: skipping %r', self) Node.Node.stealth_write = stealth_write re_quote = re.compile("[^a-zA-Z0-9-]") @@ -470,7 +470,7 @@ class vsnode_project(vsnode): return lst def write(self): - Logs.debug('codelite: creating %r' % self.path) + Logs.debug('codelite: creating %r', self.path) #print "self.name:",self.name # first write the project file @@ -737,22 +737,20 @@ class codelite_generator(BuildContext): return '' return getattr(x, 'path', None) and x.path.abspath() or x.name self.all_projects.sort(key=sortfun) - def write_files(self): - """ Write the project and solution files from the data collected so far. It is unlikely that you will want to change this """ - for p in self.all_projects: + for p in self.all_projects: p.write() # and finally write the solution file node = self.get_solution_node() node.parent.mkdir() - Logs.warn('Creating %r' % node) - #a = dir(self.root) + Logs.warn('Creating %r', node) + #a = dir(self.root) #for b in a: # print b #print self.group_names diff --git a/waflib/extras/compat15.py b/waflib/extras/compat15.py index ed08c394..afce50d5 100644 --- a/waflib/extras/compat15.py +++ b/waflib/extras/compat15.py @@ -107,7 +107,7 @@ def retrieve(self, name, fromenv=None): self.all_envs[name] = env else: if fromenv: - Logs.warn("The environment %s may have been configured already" % name) + Logs.warn('The environment %s may have been configured already', name) return env Configure.ConfigurationContext.retrieve = retrieve @@ -171,15 +171,15 @@ def load_module(path, encoding=None): ret = rev(path, encoding) if 'set_options' in ret.__dict__: if Logs.verbose: - Logs.warn('compat: rename "set_options" to "options" (%r)' % path) + Logs.warn('compat: rename "set_options" to "options" (%r)', path) ret.options = ret.set_options if 'srcdir' in ret.__dict__: if Logs.verbose: - Logs.warn('compat: rename "srcdir" to "top" (%r)' % path) + Logs.warn('compat: rename "srcdir" to "top" (%r)', path) ret.top = ret.srcdir if 'blddir' in ret.__dict__: if Logs.verbose: - Logs.warn('compat: rename "blddir" to "out" (%r)' % path) + Logs.warn('compat: rename "blddir" to "out" (%r)', path) ret.out = ret.blddir Utils.g_module = Context.g_module Options.launch_dir = Context.launch_dir @@ -375,10 +375,10 @@ def install_dir(self, path): destpath = Utils.subst_vars(path, self.env) if self.is_install > 0: - Logs.info('* creating %s' % destpath) + Logs.info('* creating %s', destpath) Utils.check_dir(destpath) elif self.is_install < 0: - Logs.info('* removing %s' % destpath) + Logs.info('* removing %s', destpath) try: os.remove(destpath) except OSError: diff --git a/waflib/extras/cython.py b/waflib/extras/cython.py index 8e2b2f47..2b2c7ccc 100644 --- a/waflib/extras/cython.py +++ b/waflib/extras/cython.py @@ -2,7 +2,7 @@ # encoding: utf-8 # Thomas Nagy, 2010-2015 -import os, re +import re from waflib import Task, Logs from waflib.TaskGen import extension @@ -70,7 +70,7 @@ class cython(Task.Task): if x.name.endswith('.h'): if not x.exists(): if Logs.verbose: - Logs.warn('Expected %r' % x.abspath()) + Logs.warn('Expected %r', x.abspath()) x.write('') return Task.Task.post_run(self) @@ -92,7 +92,7 @@ class cython(Task.Task): else: mods.append(m.group(2)) - Logs.debug("cython: mods %r" % mods) + Logs.debug('cython: mods %r', mods) incs = getattr(self.generator, 'cython_includes', []) incs = [self.generator.path.find_dir(x) for x in incs] incs.append(node.parent) @@ -113,7 +113,7 @@ class cython(Task.Task): if implicit: found.append(implicit) - Logs.debug("cython: found %r" % found) + Logs.debug('cython: found %r', found) # Now the .h created - store them in bld.raw_deps for later use has_api = False diff --git a/waflib/extras/distnet.py b/waflib/extras/distnet.py index 1c5f3e60..54572e60 100644 --- a/waflib/extras/distnet.py +++ b/waflib/extras/distnet.py @@ -107,10 +107,10 @@ class package(Context.Context): tarinfo.name = os.path.split(x)[1] else: tarinfo.name = endname + x # todo, if tuple, then.. - Logs.debug("adding %r to %s" % (tarinfo.name, filename)) + Logs.debug('distnet: adding %r to %s', tarinfo.name, filename) with open(x, 'rb') as f: tar.addfile(tarinfo, f) - Logs.info('Created %s' % filename) + Logs.info('Created %s', filename) class publish(Context.Context): fun = 'publish' @@ -223,7 +223,7 @@ class package_reader(Context.Context): try: response = urlopen(req, timeout=TIMEOUT) except URLError as e: - Logs.warn('The package server is down! %r' % e) + Logs.warn('The package server is down! %r', e) self.constraints = self.local_resolve(text) else: ret = response.read() @@ -243,11 +243,11 @@ class package_reader(Context.Context): reasons = c.why() if len(reasons) == 1: - Logs.error('%s but no matching package could be found in this repository' % reasons[0]) + Logs.error('%s but no matching package could be found in this repository', reasons[0]) else: - Logs.error('Conflicts on package %r:' % c.pkgname) + Logs.error('Conflicts on package %r:', c.pkgname) for r in reasons: - Logs.error(' %s' % r) + Logs.error(' %s', r) if errors: self.fatal('The package requirements cannot be satisfied!') @@ -255,7 +255,6 @@ class package_reader(Context.Context): try: return self.cache_constraints[(pkgname, pkgver)] except KeyError: - #Logs.error("no key %r" % (pkgname, pkgver)) text = Utils.readf(os.path.join(get_distnet_cache(), pkgname, pkgver, requires)) ret = parse_constraints(text) self.cache_constraints[(pkgname, pkgver)] = ret diff --git a/waflib/extras/gccdeps.py b/waflib/extras/gccdeps.py index 9d0eb9d3..72e340ed 100644 --- a/waflib/extras/gccdeps.py +++ b/waflib/extras/gccdeps.py @@ -144,14 +144,14 @@ def post_run(self): continue nodes.append(node) - Logs.debug('deps: gccdeps for %s returned %s' % (str(self), str(nodes))) + Logs.debug('deps: gccdeps for %s returned %s', self, nodes) bld.node_deps[self.uid()] = nodes bld.raw_deps[self.uid()] = [] try: del self.cache_sig - except: + except AttributeError: pass Task.Task.post_run(self) diff --git a/waflib/extras/msvcdeps.py b/waflib/extras/msvcdeps.py index 98b06776..1ba289bf 100644 --- a/waflib/extras/msvcdeps.py +++ b/waflib/extras/msvcdeps.py @@ -130,7 +130,7 @@ def wrap_compiled_task(classname): if not c_preproc.go_absolute: if not (node.is_child_of(bld.srcnode) or node.is_child_of(bld.bldnode)): # System library - Logs.debug('msvcdeps: Ignoring system include %r' % node) + Logs.debug('msvcdeps: Ignoring system include %r', node) continue if id(node) == id(self.inputs[0]): @@ -144,7 +144,7 @@ def wrap_compiled_task(classname): try: del self.cache_sig - except: + except AttributeError: pass Task.Task.post_run(self) @@ -222,7 +222,7 @@ def wrap_compiled_task(classname): for line in raw_out.splitlines(): if line.startswith(INCLUDE_PATTERN): inc_path = line[len(INCLUDE_PATTERN):].strip() - Logs.debug('msvcdeps: Regex matched %s' % inc_path) + Logs.debug('msvcdeps: Regex matched %s', inc_path) self.msvcdeps_paths.append(inc_path) else: out.append(line) diff --git a/waflib/extras/msvs.py b/waflib/extras/msvs.py index 4f97cdee..d50f5c7b 100644 --- a/waflib/extras/msvs.py +++ b/waflib/extras/msvs.py @@ -374,7 +374,7 @@ def stealth_write(self, data, flags='wb'): except (IOError, ValueError): self.write(data, flags=flags) else: - Logs.debug('msvs: skipping %s' % self.win32path()) + Logs.debug('msvs: skipping %s', self.win32path()) Node.Node.stealth_write = stealth_write re_win32 = re.compile(r'^([/\\]cygdrive)?[/\\]([a-z])([^a-z0-9_-].*)', re.I) @@ -529,7 +529,7 @@ class vsnode_project(vsnode): return lst def write(self): - Logs.debug('msvs: creating %r' % self.path) + Logs.debug('msvs: creating %r', self.path) # first write the project file template1 = compile_template(PROJECT_TEMPLATE) @@ -794,7 +794,7 @@ class msvs_generator(BuildContext): # and finally write the solution file node = self.get_solution_node() node.parent.mkdir() - Logs.warn('Creating %r' % node) + Logs.warn('Creating %r', node) template1 = compile_template(SOLUTION_TEMPLATE) sln_str = template1(self) sln_str = rm_blank_lines(sln_str) @@ -973,7 +973,7 @@ def wrap_2008(cls): return '' def write(self): - Logs.debug('msvs: creating %r' % self.path) + Logs.debug('msvs: creating %r', self.path) template1 = compile_template(self.project_template) proj_str = template1(self) proj_str = rm_blank_lines(proj_str) diff --git a/waflib/extras/netcache_client.py b/waflib/extras/netcache_client.py index 068a4f51..b11c1bbb 100644 --- a/waflib/extras/netcache_client.py +++ b/waflib/extras/netcache_client.py @@ -146,7 +146,7 @@ def check_cache(conn, ssig): ret = ''.join(buf) all_sigs_in_cache = (time.time(), ret.splitlines()) - Logs.debug('netcache: server cache has %r entries' % len(all_sigs_in_cache[1])) + Logs.debug('netcache: server cache has %r entries', len(all_sigs_in_cache[1])) if not ssig in all_sigs_in_cache[1]: raise ValueError('no file %s in cache' % ssig) @@ -215,11 +215,11 @@ def can_retrieve_cache(self): recv_file(conn, ssig, cnt, p) cnt += 1 except MissingFile as e: - Logs.debug('netcache: file is not in the cache %r' % e) + Logs.debug('netcache: file is not in the cache %r', e) err = True except Exception as e: - Logs.debug('netcache: could not get the files %r' % e) + Logs.debug('netcache: could not get the files %r', e) err = True # broken connection? remove this one @@ -259,7 +259,7 @@ def put_files_cache(self): conn = get_connection(push=True) sock_send(conn, ssig, cnt, node.abspath()) except Exception as e: - Logs.debug("netcache: could not push the files %r" % e) + Logs.debug('netcache: could not push the files %r', e) # broken connection? remove this one close_connection(conn) diff --git a/waflib/extras/package.py b/waflib/extras/package.py index 955daa3b..c06498eb 100644 --- a/waflib/extras/package.py +++ b/waflib/extras/package.py @@ -64,7 +64,7 @@ def download_archive(self, src, dst): else: tmp = self.root.make_node(dst) tmp.write(web.read()) - Logs.warn('Downloaded %s from %s' % (tmp.abspath(), url)) + Logs.warn('Downloaded %s from %s', tmp.abspath(), url) break else: self.fatal('Could not get the package %s' % src) diff --git a/waflib/extras/parallel_debug.py b/waflib/extras/parallel_debug.py index 7d80c56c..8f02b5c3 100644 --- a/waflib/extras/parallel_debug.py +++ b/waflib/extras/parallel_debug.py @@ -422,7 +422,7 @@ def make_picture(producer): node = producer.bld.path.make_node('pdebug.svg') node.write(txt) - Logs.warn('Created the diagram %r' % node.abspath()) + Logs.warn('Created the diagram %r', node) def options(opt): opt.add_option('--dtitle', action='store', default='Parallel build representation for %r' % ' '.join(sys.argv), diff --git a/waflib/extras/print_commands.py b/waflib/extras/print_commands.py index a9975557..805dac9c 100644 --- a/waflib/extras/print_commands.py +++ b/waflib/extras/print_commands.py @@ -20,8 +20,8 @@ def exec_command(self, cmd, **kw): else: txt = ' '.join(repr(x) if ' ' in x else x for x in cmd) - Logs.debug('runner: %s' % txt) - Logs.debug('runner_env: kw=%s' % kw) + Logs.debug('runner: %s', txt) + Logs.debug('runner_env: kw=%s', kw) if self.logger: self.logger.info(cmd) diff --git a/waflib/extras/rst.py b/waflib/extras/rst.py index cf8b2b49..f3c3a5eb 100644 --- a/waflib/extras/rst.py +++ b/waflib/extras/rst.py @@ -49,13 +49,13 @@ def parse_rst_node(task, node, nodes, names, seen, dirs=None): for match in re_rst.finditer(code): ipath = match.group('file') itype = match.group('type') - Logs.debug("rst: visiting %s: %s" % (itype, ipath)) + Logs.debug('rst: visiting %s: %s', itype, ipath) found = False for d in dirs: - Logs.debug("rst: looking for %s in %s" % (ipath, d.abspath())) + Logs.debug('rst: looking for %s in %s', ipath, d.abspath()) found = d.find_node(ipath) if found: - Logs.debug("rst: found %s as %s" % (ipath, found.abspath())) + Logs.debug('rst: found %s as %s', ipath, found.abspath()) nodes.append((itype, found)) if itype == 'include': parse_rst_node(task, found, nodes, names, seen) @@ -84,9 +84,9 @@ class docutils(Task.Task): parse_rst_node(self, node, nodes, names, seen) - Logs.debug("rst: %s: found the following file deps: %s" % (repr(self), nodes)) + Logs.debug('rst: %r: found the following file deps: %r', self, nodes) if names: - Logs.warn("rst: %s: could not find the following file deps: %s" % (repr(self), names)) + Logs.warn('rst: %r: could not find the following file deps: %r', self, names) return ([v for (t,v) in nodes], [v for (t,v) in names]) @@ -100,7 +100,7 @@ class docutils(Task.Task): :type retcode: boolean """ if retcode != 0: - raise Errors.WafError("%r command exit status %r" % (msg, retcode)) + raise Errors.WafError('%r command exit status %r' % (msg, retcode)) def run(self): """ @@ -124,7 +124,7 @@ class rst2html(docutils): if stylesheet is not None: ssnode = self.generator.to_nodes(stylesheet)[0] nodes.append(ssnode) - Logs.debug("rst: adding dep to %s %s" % (attribute, stylesheet)) + Logs.debug('rst: adding dep to %s %s', attribute, stylesheet) return nodes, names diff --git a/waflib/extras/run_do_script.py b/waflib/extras/run_do_script.py index 2bf71489..64df04a1 100644 --- a/waflib/extras/run_do_script.py +++ b/waflib/extras/run_do_script.py @@ -84,8 +84,8 @@ class run_do_script(run_do_script_base): run_do_script_base.run(self) ret, log_tail = self.check_erase_log_file() if ret: - Logs.error("""Running Stata on %s failed with code %r.\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""" % ( - self.inputs[0].abspath(), ret, self.env.LOGFILEPATH, log_tail)) + Logs.error("""Running Stata on %r failed with code %r.\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""", + self.inputs[0], ret, self.env.LOGFILEPATH, log_tail) return ret def check_erase_log_file(self): @@ -133,7 +133,7 @@ def apply_run_do_script(tg): if not node: tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath())) tsk.dep_nodes.append(node) - Logs.debug('deps: found dependencies %r for running %r' % (tsk.dep_nodes, src_node.abspath())) + Logs.debug('deps: found dependencies %r for running %r', tsk.dep_nodes, src_node.abspath()) # Bypass the execution of process_source by setting the source to an empty list tg.source = [] diff --git a/waflib/extras/run_m_script.py b/waflib/extras/run_m_script.py index 534c8d92..142a0d77 100644 --- a/waflib/extras/run_m_script.py +++ b/waflib/extras/run_m_script.py @@ -55,8 +55,8 @@ class run_m_script(run_m_script_base): mode = 'rb' with open(logfile, mode=mode) as f: tail = f.readlines()[-10:] - Logs.error("""Running Matlab on %s returned the error %r\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""" % ( - self.inputs[0].abspath(), ret, logfile, '\n'.join(tail))) + Logs.error("""Running Matlab on %r returned the error %r\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""", + self.inputs[0], ret, logfile, '\n'.join(tail)) else: os.remove(logfile) return ret @@ -83,7 +83,7 @@ def apply_run_m_script(tg): if not node: tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath())) tsk.dep_nodes.append(node) - Logs.debug('deps: found dependencies %r for running %r' % (tsk.dep_nodes, src_node.abspath())) + Logs.debug('deps: found dependencies %r for running %r', tsk.dep_nodes, src_node.abspath()) # Bypass the execution of process_source by setting the source to an empty list tg.source = [] diff --git a/waflib/extras/run_py_script.py b/waflib/extras/run_py_script.py index 99370efc..fafd3e9a 100644 --- a/waflib/extras/run_py_script.py +++ b/waflib/extras/run_py_script.py @@ -51,25 +51,24 @@ class run_py_3_script(Task.Task): @TaskGen.before_method('process_source') def apply_run_py_script(tg): """Task generator for running either Python 2 or Python 3 on a single - script. - + script. + Attributes: * source -- A **single** source node or string. (required) * target -- A single target or list of targets (nodes or strings). * deps -- A single dependency or list of dependencies (nodes or strings) * add_to_pythonpath -- A string that will be appended to the PYTHONPATH environment variable. - + If the build environment has an attribute "PROJECT_PATHS" with a key "PROJECT_ROOT", its value will be appended to the PYTHONPATH. - """ # Set the Python version to use, default to 3. v = getattr(tg, 'version', 3) if v not in (2, 3): raise ValueError("Specify the 'version' attribute for run_py_script task generator as integer 2 or 3.\n Got: %s" %v) - # Convert sources and targets to nodes + # Convert sources and targets to nodes src_node = tg.path.find_resource(tg.source) tgt_nodes = [tg.path.find_or_declare(t) for t in tg.to_list(tg.target)] @@ -99,7 +98,7 @@ def apply_run_py_script(tg): if not node: tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath())) tsk.dep_nodes.append(node) - Logs.debug('deps: found dependencies %r for running %r' % (tsk.dep_nodes, src_node.abspath())) + Logs.debug('deps: found dependencies %r for running %r', tsk.dep_nodes, src_node.abspath()) # Bypass the execution of process_source by setting the source to an empty list tg.source = [] diff --git a/waflib/extras/run_r_script.py b/waflib/extras/run_r_script.py index 8f3e0c86..200e9af6 100644 --- a/waflib/extras/run_r_script.py +++ b/waflib/extras/run_r_script.py @@ -6,12 +6,12 @@ Run a R script in the directory specified by **ctx.bldnode**. For error-catching purposes, keep an own log-file that is destroyed if the -task finished without error. If not, it will show up as rscript_[index].log +task finished without error. If not, it will show up as rscript_[index].log in the bldnode directory. Usage:: - ctx(features='run_r_script', + ctx(features='run_r_script', source='some_script.r', target=['some_table.tex', 'some_figure.eps'], deps='some_data.csv') @@ -53,8 +53,8 @@ class run_r_script(run_r_script_base): mode = 'rb' with open(logfile, mode=mode) as f: tail = f.readlines()[-10:] - Logs.error("""Running R on %s returned the error %r\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""" % ( - self.inputs[0].abspath(), ret, logfile, '\n'.join(tail))) + Logs.error("""Running R on %r returned the error %r\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""", + self.inputs[0], ret, logfile, '\n'.join(tail)) else: os.remove(logfile) return ret @@ -80,7 +80,7 @@ def apply_run_r_script(tg): if not node: tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath())) tsk.dep_nodes.append(node) - Logs.debug('deps: found dependencies %r for running %r' % (tsk.dep_nodes, src_node.abspath())) + Logs.debug('deps: found dependencies %r for running %r', tsk.dep_nodes, src_node.abspath()) # Bypass the execution of process_source by setting the source to an empty list tg.source = [] diff --git a/waflib/extras/sas.py b/waflib/extras/sas.py index 3b680636..d0f463d6 100644 --- a/waflib/extras/sas.py +++ b/waflib/extras/sas.py @@ -22,7 +22,7 @@ class sas(Task.Task): # set the cwd task.cwd = task.inputs[0].parent.get_src().abspath() - Logs.debug('runner: %s on %s' % (command, node.abspath)) + Logs.debug('runner: %r on %r', command, node) SASINPUTS = node.parent.get_bld().abspath() + os.pathsep + node.parent.get_src().abspath() + os.pathsep task.env.env = {'SASINPUTS': SASINPUTS} @@ -32,10 +32,10 @@ class sas(Task.Task): task.env.LSTFILE = lstfilenode.abspath() ret = fun(task) if ret: - Logs.error('Running %s on %r returned a non-zero exit' % (command, node)) - Logs.error('SRCFILE = %r' % node) - Logs.error('LOGFILE = %r' % logfilenode) - Logs.error('LSTFILE = %r' % lstfilenode) + Logs.error('Running %s on %r returned a non-zero exit', command, node) + Logs.error('SRCFILE = %r', node) + Logs.error('LOGFILE = %r', logfilenode) + Logs.error('LSTFILE = %r', lstfilenode) return ret @feature('sas') diff --git a/waflib/extras/stale.py b/waflib/extras/stale.py index c89550e2..9e48d0a1 100644 --- a/waflib/extras/stale.py +++ b/waflib/extras/stale.py @@ -59,7 +59,7 @@ def stale_rec(node, nodes): else: if not node in nodes: if can_delete(node): - Logs.warn("Removing stale file -> %s" % node.abspath()) + Logs.warn('Removing stale file -> %r', node) node.delete() old = Parallel.refill_task_list diff --git a/waflib/extras/stracedeps.py b/waflib/extras/stracedeps.py index f9102865..68d6db3d 100644 --- a/waflib/extras/stracedeps.py +++ b/waflib/extras/stracedeps.py @@ -162,7 +162,7 @@ def parse_strace_deps(self, path, cwd): # record the dependencies then force the task signature recalculation for next time if Logs.verbose: - Logs.debug('deps: real scanner for %s returned %s' % (str(self), str(nodes))) + Logs.debug('deps: real scanner for %r returned %r', self, nodes) bld = self.generator.bld bld.node_deps[self.uid()] = nodes bld.raw_deps[self.uid()] = [] diff --git a/waflib/extras/swig.py b/waflib/extras/swig.py index 0671f2c3..eeb99522 100644 --- a/waflib/extras/swig.py +++ b/waflib/extras/swig.py @@ -87,7 +87,7 @@ class swig(Task.Task): to_see.append(u) break else: - Logs.warn('could not find %r' % n) + Logs.warn('could not find %r', n) return (lst_src, []) diff --git a/waflib/extras/use_config.py b/waflib/extras/use_config.py index 5eaced24..6859bed3 100644 --- a/waflib/extras/use_config.py +++ b/waflib/extras/use_config.py @@ -130,12 +130,12 @@ def download_tool(tool, force=False, ctx=None): else: tmp = ctx.root.make_node(os.sep.join((Context.waf_dir, 'waflib', 'extras', tool + '.py'))) tmp.write(web.read(), 'wb') - Logs.warn('Downloaded %s from %s' % (tool, url)) + Logs.warn('Downloaded %s from %s', tool, url) download_check(tmp) try: module = Context.load_tool(tool) except Exception: - Logs.warn('The tool %s from %s is unusable' % (tool, url)) + Logs.warn('The tool %s from %s is unusable', tool, url) try: tmp.delete() except Exception: diff --git a/waflib/extras/valadoc.py b/waflib/extras/valadoc.py index 335f11ac..c50f69e7 100644 --- a/waflib/extras/valadoc.py +++ b/waflib/extras/valadoc.py @@ -113,7 +113,7 @@ def process_valadoc(self): try: task.vapi_dirs.append(self.path.find_dir(vapi_dir).abspath()) except AttributeError: - Logs.warn("Unable to locate Vala API directory: '%s'" % vapi_dir) + Logs.warn('Unable to locate Vala API directory: %r', vapi_dir) if getattr(self, 'files', None): task.files = self.files else: diff --git a/waflib/extras/why.py b/waflib/extras/why.py index b2f5d7e1..9f3ab27a 100644 --- a/waflib/extras/why.py +++ b/waflib/extras/why.py @@ -62,7 +62,7 @@ def runnable_status(self): def v(x): return Utils.to_hex(x) - Logs.debug("Task %r" % self) + Logs.debug('Task %r', self) msgs = ['* Implicit or scanner dependency', '* Task code', '* Source file, explicit or manual dependency', '* Configuration data variable'] tmp = 'task: -> %s: %s %s' for x in range(len(msgs)): @@ -70,7 +70,7 @@ def runnable_status(self): a = new_sigs[x*l : (x+1)*l] b = old_sigs[x*l : (x+1)*l] if (a != b): - Logs.debug(tmp % (msgs[x].ljust(35), v(a), v(b))) + Logs.debug(tmp, msgs[x].ljust(35), v(a), v(b)) return ret Task.Task.runnable_status = runnable_status diff --git a/waflib/extras/win32_opts.py b/waflib/extras/win32_opts.py index 85fcef22..6d2f360b 100644 --- a/waflib/extras/win32_opts.py +++ b/waflib/extras/win32_opts.py @@ -120,7 +120,7 @@ if Utils.is_win32: find = FindFirstFile(TP % curpath, ctypes.byref(findData)) if find == INVALID_HANDLE_VALUE: - Logs.error("invalid win32 handle isfile_cached %r" % self.abspath()) + Logs.error("invalid win32 handle isfile_cached %r", self.abspath()) return os.path.isfile(self.abspath()) try: @@ -132,7 +132,7 @@ if Utils.is_win32: if not FindNextFile(find, ctypes.byref(findData)): break except Exception as e: - Logs.error('exception while listing a folder %r %r' % (self.abspath(), e)) + Logs.error('exception while listing a folder %r %r', self.abspath(), e) return os.path.isfile(self.abspath()) finally: FindClose(find) diff --git a/waflib/extras/xcode6.py b/waflib/extras/xcode6.py index 2b4480f1..ac161320 100644 --- a/waflib/extras/xcode6.py +++ b/waflib/extras/xcode6.py @@ -53,9 +53,8 @@ $ waf configure xcode6 # TODO: support iOS projects -from waflib import Context, TaskGen, Build, Utils, ConfigSet, Configure, Errors -from waflib.Build import BuildContext -import os, sys, random, time +from waflib import Context, TaskGen, Build, Utils, Errors +import os, sys HEADERS_GLOB = '**/(*.h|*.hpp|*.H|*.inl)' diff --git a/wscript b/wscript index 6435909b..3b23560f 100644 --- a/wscript +++ b/wscript @@ -267,8 +267,8 @@ def create_waf(self, *k, **kw): files = [x.name for x in tar.getmembers()] if set(files) ^ set(oldfiles): Logs.warn('The archive model has differences:') - Logs.warn('- Added %r' % list(set(files) - set(oldfiles))) - Logs.warn('- Removed %r' % list(set(oldfiles) - set(files))) + Logs.warn('- Added %r', list(set(files) - set(oldfiles))) + Logs.warn('- Removed %r', list(set(oldfiles) - set(files))) #open a file as tar.[extension] for writing tar = tarfile.open('%s.tar.%s' % (mw, zipType), "w:%s" % zipType)