2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 09:57:15 +01:00

Beautify Logs.{debug,error,info,warn} now that the formatting bug is fixed

This commit is contained in:
Thomas Nagy 2016-05-28 16:18:51 +02:00
parent 8407845787
commit 02a8361149
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
44 changed files with 142 additions and 147 deletions

View File

@ -73,7 +73,7 @@ def dump(bld):
def output_makefile(self): def output_makefile(self):
self.commands.insert(0, "all: %s" % " ".join(self.targets)) self.commands.insert(0, "all: %s" % " ".join(self.targets))
node = self.bldnode.make_node('Makefile') node = self.bldnode.make_node('Makefile')
node.write("\n".join(self.commands)) node.write('\n'.join(self.commands))
Logs.warn('Wrote %s' % node.abspath()) Logs.warn('Wrote %r', node)
bld.add_post_fun(output_makefile) bld.add_post_fun(output_makefile)

View File

@ -67,7 +67,7 @@ def configure(conf):
conf.env.revert() conf.env.revert()
node = conf.path.find_node('%s/build/config.log' % d.name) node = conf.path.find_node('%s/build/config.log' % d.name)
if node: 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: try:
e = sys.exc_info()[1] e = sys.exc_info()[1]
print(e) print(e)
@ -92,7 +92,7 @@ def configure(conf):
else: else:
conf.env.append_value('PYTHONS', x) 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("contents of config.log:")
Logs.info(conf.path.find_node('build/config.log').read()) Logs.info(conf.path.find_node('build/config.log').read())

View File

@ -38,7 +38,7 @@ The Waf module 'Logs' replaces the Python module logging. In the source code, tr
[source,python] [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: The following zones are used in Waf:

View File

@ -42,12 +42,12 @@ def gtest_results(bld):
if ' OK ]' in output[i]: if ' OK ]' in output[i]:
continue continue
while not '[ ' in output[i]: while not '[ ' in output[i]:
Logs.warn('%s' % output[i]) Logs.warn(output[i])
i += 1 i += 1
elif ' FAILED ]' in line and code: elif ' FAILED ]' in line and code:
Logs.error('%s' % line) Logs.error(line)
elif ' PASSED ]' in line: elif ' PASSED ]' in line:
Logs.info('%s' % line) Logs.info(line)
def build(bld): def build(bld):
bld.recurse('src tests') bld.recurse('src tests')

View File

@ -57,7 +57,7 @@ def are_implicit_nodes_ready(self):
if modified: if modified:
for tsk in self.run_after: for tsk in self.run_after:
if not tsk.hasrun: 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') raise Errors.TaskNotReady('not ready')
Task.Task.are_implicit_nodes_ready = are_implicit_nodes_ready Task.Task.are_implicit_nodes_ready = are_implicit_nodes_ready

View File

@ -250,7 +250,7 @@ class BuildContext(Context.Context):
* calling :py:meth:`waflib.Build.BuildContext.post_build` to call user build functions * 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.recurse([self.run_dir])
self.pre_build() self.pre_build()
@ -264,7 +264,7 @@ class BuildContext(Context.Context):
c = self.producer.processed or 1 c = self.producer.processed or 1
m = self.progress_line(c, c, Logs.colors.BLUE, Logs.colors.NORMAL) 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(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: try:
self.producer.bld = None self.producer.bld = None
del self.producer del self.producer
@ -630,7 +630,7 @@ class BuildContext(Context.Context):
#if self.groups and not self.groups[0].tasks: #if self.groups and not self.groups[0].tasks:
# error('add_group: an empty group is already present') # error('add_group: an empty group is already present')
if name and name in self.group_names: 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 = [] g = []
self.group_names[name] = g self.group_names[name] = g
self.groups.append(g) self.groups.append(g)
@ -731,7 +731,7 @@ class BuildContext(Context.Context):
Logs.warn('Building from the build directory, forcing --targets=*') Logs.warn('Building from the build directory, forcing --targets=*')
ln = self.srcnode ln = self.srcnode
elif not ln.is_child_of(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 ln = self.srcnode
for tg in self.groups[self.cur]: for tg in self.groups[self.cur]:
try: try:
@ -1054,11 +1054,11 @@ class inst(Task.Task):
# same size and identical timestamps -> make no copy # same size and identical timestamps -> make no copy
if st1.st_mtime + 2 >= st2.st_mtime and st1.st_size == st2.st_size: if st1.st_mtime + 2 >= st2.st_mtime and st1.st_size == st2.st_size:
if not self.generator.bld.progress_bar: 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 return False
if not self.generator.bld.progress_bar: 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, # Give best attempt at making destination overwritable,
# like the 'install' utility used by 'make install' does. # like the 'install' utility used by 'make install' does.
@ -1077,7 +1077,7 @@ class inst(Task.Task):
self.copy_fun(src, tgt) self.copy_fun(src, tgt)
except IOError: except IOError:
if not src.exists(): 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) raise Errors.WafError('Could not install the file %r' % tgt)
def do_link(self, src, tgt, **kw): 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 os.path.islink(tgt) and os.readlink(tgt) == src:
if not self.generator.bld.progress_bar: if not self.generator.bld.progress_bar:
Logs.info('- symlink %s (to %s)' % (tgt, src)) Logs.info('- symlink %s (to %s)', tgt, src)
else: else:
try: try:
os.remove(tgt) os.remove(tgt)
except OSError: except OSError:
pass pass
if not self.generator.bld.progress_bar: 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) os.symlink(src, tgt)
def do_uninstall(self, src, tgt, lbl, **kw): def do_uninstall(self, src, tgt, lbl, **kw):
if not self.generator.bld.progress_bar: if not self.generator.bld.progress_bar:
Logs.info('- remove %s' % tgt) Logs.info('- remove %s', tgt)
#self.uninstall.append(tgt) #self.uninstall.append(tgt)
try: try:
@ -1114,14 +1114,14 @@ class inst(Task.Task):
self.uninstall_error = True self.uninstall_error = True
Logs.warn('build: some files could not be uninstalled (retry with -vv to list them)') Logs.warn('build: some files could not be uninstalled (retry with -vv to list them)')
if Logs.verbose > 1: 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) self.rm_empty_dirs(tgt)
def do_unlink(self, src, tgt, **kw): def do_unlink(self, src, tgt, **kw):
# TODO do_uninstall with proper amount of args # TODO do_uninstall with proper amount of args
try: try:
if not self.generator.bld.progress_bar: if not self.generator.bld.progress_bar:
Logs.info('- remove %s' % tgt) Logs.info('- remove %s', tgt)
os.remove(tgt) os.remove(tgt)
except OSError: except OSError:
pass pass
@ -1289,7 +1289,7 @@ class StepContext(BuildContext):
break break
if do_exec: if do_exec:
ret = tsk.run() ret = tsk.run()
Logs.info('%s -> exit %r' % (str(tsk), ret)) Logs.info('%s -> exit %r', tsk, ret)
def get_matcher(self, pat): def get_matcher(self, pat):
# this returns a function # this returns a function

View File

@ -344,5 +344,5 @@ def pprint(col, msg, label='', sep='\n'):
:param sep: a string to append at the end (line separator) :param sep: a string to append at the end (line separator)
:type sep: string :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})

View File

@ -28,7 +28,7 @@ def waf_entry_point(current_directory, version, wafdir):
Logs.init_log() Logs.init_log()
if Context.WAFVERSION != version: 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) sys.exit(1)
if '--version' in sys.argv: if '--version' in sys.argv:
@ -80,7 +80,7 @@ def waf_entry_point(current_directory, version, wafdir):
lst = os.listdir(cur) lst = os.listdir(cur)
except OSError: except OSError:
lst = [] lst = []
Logs.error('Directory %r is unreadable!' % cur) Logs.error('Directory %r is unreadable!', cur)
if Options.lockfile in lst: if Options.lockfile in lst:
env = ConfigSet.ConfigSet() env = ConfigSet.ConfigSet()
try: try:
@ -106,7 +106,7 @@ def waf_entry_point(current_directory, version, wafdir):
load = True load = True
break break
else: else:
Logs.warn('invalid lock file in %s' % cur) Logs.warn('invalid lock file in %s', cur)
load = False load = False
if load: if load:
@ -135,13 +135,13 @@ def waf_entry_point(current_directory, version, wafdir):
ctx.curdir = current_directory ctx.curdir = current_directory
ctx.parse_args() ctx.parse_args()
sys.exit(0) 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) sys.exit(1)
try: try:
os.chdir(Context.run_dir) os.chdir(Context.run_dir)
except OSError: 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) sys.exit(1)
try: try:
@ -151,7 +151,7 @@ def waf_entry_point(current_directory, version, wafdir):
Logs.error(str(e)) Logs.error(str(e))
sys.exit(1) sys.exit(1)
except Exception as e: 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) traceback.print_exc(file=sys.stdout)
sys.exit(2) sys.exit(2)
@ -264,7 +264,7 @@ def run_commands():
while Options.commands: while Options.commands:
cmd_name = Options.commands.pop(0) cmd_name = Options.commands.pop(0)
ctx = run_command(cmd_name) 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') run_command('shutdown')
########################################################################################### ###########################################################################################
@ -285,7 +285,7 @@ def distclean_dir(dirname):
try: try:
os.remove(fname) os.remove(fname)
except OSError: except OSError:
Logs.warn('Could not remove %r' % fname) Logs.warn('Could not remove %r', fname)
for x in (Context.DBFILE, 'config.log'): for x in (Context.DBFILE, 'config.log'):
try: try:
@ -306,7 +306,7 @@ def distclean(ctx):
try: try:
proj = ConfigSet.ConfigSet(f) proj = ConfigSet.ConfigSet(f)
except IOError: except IOError:
Logs.warn('Could not read %r' % f) Logs.warn('Could not read %r', f)
continue continue
if proj['out_dir'] != proj['top_dir']: if proj['out_dir'] != proj['top_dir']:
@ -316,7 +316,7 @@ def distclean(ctx):
pass pass
except OSError as e: except OSError as e:
if e.errno != errno.ENOENT: if e.errno != errno.ENOENT:
Logs.warn('Could not remove %r' % proj['out_dir']) Logs.warn('Could not remove %r', proj['out_dir'])
else: else:
distclean_dir(proj['out_dir']) distclean_dir(proj['out_dir'])
@ -326,7 +326,7 @@ def distclean(ctx):
os.remove(p) os.remove(p)
except OSError as e: except OSError as e:
if e.errno != errno.ENOENT: if e.errno != errno.ENOENT:
Logs.warn('Could not remove %r' % p) Logs.warn('Could not remove %r', p)
# remove local waf cache folders # remove local waf cache folders
if not Options.commands: if not Options.commands:
@ -393,7 +393,7 @@ class Dist(Context.Context):
else: else:
digest = ' (sha=%r)' % sha1(node.read()).hexdigest() 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): def get_tar_path(self, node):
""" """

View File

@ -723,7 +723,7 @@ class Task(TaskBase):
except (OSError, IOError): except (OSError, IOError):
for k in bld.node_deps.get(self.uid(), []): for k in bld.node_deps.get(self.uid(), []):
if not k.exists(): 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 raise
def compute_sig_implicit_deps(self): def compute_sig_implicit_deps(self):

View File

@ -167,7 +167,7 @@ class task_gen(object):
st = feats[x] st = feats[x]
if not st: if not st:
if not x in Task.classes: 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 keys.update(list(st)) # ironpython 2.7 wants the cast to list
# copy the precedence table # copy the precedence table

View File

@ -274,8 +274,8 @@ def validate_cfg(self, kw):
if y in kw: if y in kw:
package = kw['package'] package = kw['package']
if Logs.verbose: if Logs.verbose:
Logs.warn('Passing %r to conf.check_cfg() is obsolete, pass parameters directly, eg:' % y) 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(" conf.check_cfg(package='%s', args=['--libs', '--cflags', '%s >= 1.6'])", package, package)
if not 'msg' in kw: if not 'msg' in kw:
kw['msg'] = 'Checking for %r %s %s' % (package, cfg_ver[x], kw[y]) kw['msg'] = 'Checking for %r %s %s' % (package, cfg_ver[x], kw[y])
break break

View File

@ -58,16 +58,16 @@ def check_same_targets(self):
Logs.error(msg) Logs.error(msg)
for x in v: for x in v:
if Logs.verbose > 1: 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: 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: if not dupe:
for (k, v) in uids.items(): for (k, v) in uids.items():
if len(v) > 1: 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') 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: 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): def check_invalid_constraints(self):
feat = set([]) feat = set([])
@ -81,7 +81,7 @@ def check_invalid_constraints(self):
ext.add(x.__name__) ext.add(x.__name__)
invalid = ext & feat invalid = ext & feat
if invalid: 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 # 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()): for cls in list(Task.classes.values()):
@ -91,9 +91,9 @@ def check_invalid_constraints(self):
for x in ('before', 'after'): for x in ('before', 'after'):
for y in Utils.to_list(getattr(cls, x, [])): for y in Utils.to_list(getattr(cls, x, [])):
if not Task.classes.get(y): 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): 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): def replace(m):
""" """
@ -107,7 +107,7 @@ def replace(m):
if x in kw: if x in kw:
if x == 'iscopy' and 'subst' in getattr(self, 'features', ''): if x == 'iscopy' and 'subst' in getattr(self, 'features', ''):
continue 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 return ret
setattr(Build.BuildContext, m, call) setattr(Build.BuildContext, m, call)
@ -124,11 +124,11 @@ def enhance_lib():
lst=Utils.to_list(k[0]) lst=Utils.to_list(k[0])
for pat in lst: for pat in lst:
if '..' in pat.split('/'): 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): if kw.get('remove', True):
try: try:
if self.is_child_of(self.ctx.bldnode) and not kw.get('quiet', False): 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: except AttributeError:
pass pass
return self.old_ant_glob(*k, **kw) return self.old_ant_glob(*k, **kw)
@ -140,7 +140,7 @@ def enhance_lib():
def is_before(t1, t2): def is_before(t1, t2):
ret = old(t1, t2) ret = old(t1, t2)
if ret and old(t2, t1): 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 return ret
Task.is_before = is_before Task.is_before = is_before
@ -152,7 +152,7 @@ def enhance_lib():
Logs.error('feature shlib -> cshlib, dshlib or cxxshlib') Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
for x in ('c', 'cxx', 'd', 'fc'): 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')]: 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) TaskGen.feature('*')(check_err_features)
# check for erroneous order constraints # 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): if not hasattr(self, 'rule') and not 'subst' in Utils.to_list(self.features):
for x in ('before', 'after', 'ext_in', 'ext_out'): for x in ('before', 'after', 'ext_in', 'ext_out'):
if hasattr(self, x): 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: else:
for x in ('before', 'after'): for x in ('before', 'after'):
for y in self.to_list(getattr(self, x, [])): for y in self.to_list(getattr(self, x, [])):
if not Task.classes.get(y, None): 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) TaskGen.feature('*')(check_err_order)
# check for @extension used with @feature/@before_method/@after_method # check for @extension used with @feature/@before_method/@after_method

View File

@ -239,7 +239,7 @@ class tex(Task.Task):
try: try:
ct = aux_node.read() ct = aux_node.read()
except EnvironmentError: except EnvironmentError:
Logs.error('Error reading %s: %r' % aux_node.abspath()) Logs.error('Error reading %s: %r', aux_node.abspath())
continue continue
if g_bibtex_re.findall(ct): if g_bibtex_re.findall(ct):
@ -312,7 +312,7 @@ class tex(Task.Task):
try: try:
ct = aux_node.read() ct = aux_node.read()
except EnvironmentError: except EnvironmentError:
Logs.error('Error reading %s: %r' % aux_node.abspath()) Logs.error('Error reading %s: %r', aux_node.abspath())
continue continue
if g_glossaries_re.findall(ct): if g_glossaries_re.findall(ct):
@ -477,9 +477,9 @@ def apply_tex(self):
if p: if p:
task.texinputs_nodes.append(p) task.texinputs_nodes.append(p)
else: else:
Logs.error('Invalid TEXINPUTS folder %s' % x) Logs.error('Invalid TEXINPUTS folder %s', x)
else: 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 self.type == 'latex':
if 'ps' in outs: if 'ps' in outs:

View File

@ -82,7 +82,7 @@ def init_vala_task(self):
self.use.append('GTHREAD') self.use.append('GTHREAD')
else: else:
#Vala doesn't have threading support for dova nor posix #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 self.thread = False
if self.thread: if self.thread:
@ -172,7 +172,7 @@ def init_vala_task(self):
else: else:
v_node = self.path.find_dir(vapi_dir) v_node = self.path.find_dir(vapi_dir)
if not v_node: 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: else:
addflags('--vapidir=%s' % v_node.abspath()) addflags('--vapidir=%s' % v_node.abspath())

View File

@ -70,7 +70,7 @@ class rc_parser(c_preproc.c_parser):
raise c_preproc.PreprocError("could not read the file %s" % filepath) raise c_preproc.PreprocError("could not read the file %s" % filepath)
except Exception: except Exception:
if Logs.verbose > 0: if Logs.verbose > 0:
Logs.error("parsing %s failed" % filepath) Logs.error("parsing %s failed", filepath)
traceback.print_exc() traceback.print_exc()
class winrc(Task.Task): class winrc(Task.Task):

View File

@ -161,7 +161,7 @@ def boost_get_version(self, d):
try: try:
txt = node.read() txt = node.read()
except EnvironmentError: except EnvironmentError:
Logs.error("Could not read the file %r" % node.abspath()) Logs.error("Could not read the file %r", node.abspath())
else: else:
re_but1 = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.+)"', re.M) re_but1 = re.compile('^#define\\s+BOOST_LIB_VERSION\\s+"(.+)"', re.M)
m1 = re_but1.search(txt) m1 = re_but1.search(txt)

View File

@ -96,7 +96,7 @@ def exit_cleanup():
fileobj.close() fileobj.close()
filename = sys.stdout.filename 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 # then copy the log file to "latest.log" if possible
up = os.path.dirname(os.path.abspath(filename)) up = os.path.dirname(os.path.abspath(filename))

View File

@ -40,7 +40,7 @@ def collect_compilation_db_tasks(self):
def write_compilation_database(ctx): def write_compilation_database(ctx):
"Write the clang compilation database as JSON" "Write the clang compilation database as JSON"
database_file = ctx.bldnode.make_node('compile_commands.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: try:
root = json.load(database_file) root = json.load(database_file)
except IOError: except IOError:

View File

@ -325,7 +325,7 @@ def stealth_write(self, data, flags='wb'):
except (IOError, ValueError): except (IOError, ValueError):
self.write(data, flags=flags) self.write(data, flags=flags)
else: else:
Logs.debug('codelite: skipping %s' % self.abspath()) Logs.debug('codelite: skipping %r', self)
Node.Node.stealth_write = stealth_write Node.Node.stealth_write = stealth_write
re_quote = re.compile("[^a-zA-Z0-9-]") re_quote = re.compile("[^a-zA-Z0-9-]")
@ -470,7 +470,7 @@ class vsnode_project(vsnode):
return lst return lst
def write(self): def write(self):
Logs.debug('codelite: creating %r' % self.path) Logs.debug('codelite: creating %r', self.path)
#print "self.name:",self.name #print "self.name:",self.name
# first write the project file # first write the project file
@ -738,9 +738,7 @@ class codelite_generator(BuildContext):
return getattr(x, 'path', None) and x.path.abspath() or x.name return getattr(x, 'path', None) and x.path.abspath() or x.name
self.all_projects.sort(key=sortfun) self.all_projects.sort(key=sortfun)
def write_files(self): def write_files(self):
""" """
Write the project and solution files from the data collected Write the project and solution files from the data collected
so far. It is unlikely that you will want to change this so far. It is unlikely that you will want to change this
@ -751,7 +749,7 @@ class codelite_generator(BuildContext):
# and finally write the solution file # and finally write the solution file
node = self.get_solution_node() node = self.get_solution_node()
node.parent.mkdir() node.parent.mkdir()
Logs.warn('Creating %r' % node) Logs.warn('Creating %r', node)
#a = dir(self.root) #a = dir(self.root)
#for b in a: #for b in a:
# print b # print b

View File

@ -107,7 +107,7 @@ def retrieve(self, name, fromenv=None):
self.all_envs[name] = env self.all_envs[name] = env
else: else:
if fromenv: 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 return env
Configure.ConfigurationContext.retrieve = retrieve Configure.ConfigurationContext.retrieve = retrieve
@ -171,15 +171,15 @@ def load_module(path, encoding=None):
ret = rev(path, encoding) ret = rev(path, encoding)
if 'set_options' in ret.__dict__: if 'set_options' in ret.__dict__:
if Logs.verbose: 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 ret.options = ret.set_options
if 'srcdir' in ret.__dict__: if 'srcdir' in ret.__dict__:
if Logs.verbose: 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 ret.top = ret.srcdir
if 'blddir' in ret.__dict__: if 'blddir' in ret.__dict__:
if Logs.verbose: 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 ret.out = ret.blddir
Utils.g_module = Context.g_module Utils.g_module = Context.g_module
Options.launch_dir = Context.launch_dir Options.launch_dir = Context.launch_dir
@ -375,10 +375,10 @@ def install_dir(self, path):
destpath = Utils.subst_vars(path, self.env) destpath = Utils.subst_vars(path, self.env)
if self.is_install > 0: if self.is_install > 0:
Logs.info('* creating %s' % destpath) Logs.info('* creating %s', destpath)
Utils.check_dir(destpath) Utils.check_dir(destpath)
elif self.is_install < 0: elif self.is_install < 0:
Logs.info('* removing %s' % destpath) Logs.info('* removing %s', destpath)
try: try:
os.remove(destpath) os.remove(destpath)
except OSError: except OSError:

View File

@ -2,7 +2,7 @@
# encoding: utf-8 # encoding: utf-8
# Thomas Nagy, 2010-2015 # Thomas Nagy, 2010-2015
import os, re import re
from waflib import Task, Logs from waflib import Task, Logs
from waflib.TaskGen import extension from waflib.TaskGen import extension
@ -70,7 +70,7 @@ class cython(Task.Task):
if x.name.endswith('.h'): if x.name.endswith('.h'):
if not x.exists(): if not x.exists():
if Logs.verbose: if Logs.verbose:
Logs.warn('Expected %r' % x.abspath()) Logs.warn('Expected %r', x.abspath())
x.write('') x.write('')
return Task.Task.post_run(self) return Task.Task.post_run(self)
@ -92,7 +92,7 @@ class cython(Task.Task):
else: else:
mods.append(m.group(2)) mods.append(m.group(2))
Logs.debug("cython: mods %r" % mods) Logs.debug('cython: mods %r', mods)
incs = getattr(self.generator, 'cython_includes', []) incs = getattr(self.generator, 'cython_includes', [])
incs = [self.generator.path.find_dir(x) for x in incs] incs = [self.generator.path.find_dir(x) for x in incs]
incs.append(node.parent) incs.append(node.parent)
@ -113,7 +113,7 @@ class cython(Task.Task):
if implicit: if implicit:
found.append(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 # Now the .h created - store them in bld.raw_deps for later use
has_api = False has_api = False

View File

@ -107,10 +107,10 @@ class package(Context.Context):
tarinfo.name = os.path.split(x)[1] tarinfo.name = os.path.split(x)[1]
else: else:
tarinfo.name = endname + x # todo, if tuple, then.. 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: with open(x, 'rb') as f:
tar.addfile(tarinfo, f) tar.addfile(tarinfo, f)
Logs.info('Created %s' % filename) Logs.info('Created %s', filename)
class publish(Context.Context): class publish(Context.Context):
fun = 'publish' fun = 'publish'
@ -223,7 +223,7 @@ class package_reader(Context.Context):
try: try:
response = urlopen(req, timeout=TIMEOUT) response = urlopen(req, timeout=TIMEOUT)
except URLError as e: 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) self.constraints = self.local_resolve(text)
else: else:
ret = response.read() ret = response.read()
@ -243,11 +243,11 @@ class package_reader(Context.Context):
reasons = c.why() reasons = c.why()
if len(reasons) == 1: 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: else:
Logs.error('Conflicts on package %r:' % c.pkgname) Logs.error('Conflicts on package %r:', c.pkgname)
for r in reasons: for r in reasons:
Logs.error(' %s' % r) Logs.error(' %s', r)
if errors: if errors:
self.fatal('The package requirements cannot be satisfied!') self.fatal('The package requirements cannot be satisfied!')
@ -255,7 +255,6 @@ class package_reader(Context.Context):
try: try:
return self.cache_constraints[(pkgname, pkgver)] return self.cache_constraints[(pkgname, pkgver)]
except KeyError: except KeyError:
#Logs.error("no key %r" % (pkgname, pkgver))
text = Utils.readf(os.path.join(get_distnet_cache(), pkgname, pkgver, requires)) text = Utils.readf(os.path.join(get_distnet_cache(), pkgname, pkgver, requires))
ret = parse_constraints(text) ret = parse_constraints(text)
self.cache_constraints[(pkgname, pkgver)] = ret self.cache_constraints[(pkgname, pkgver)] = ret

View File

@ -144,14 +144,14 @@ def post_run(self):
continue continue
nodes.append(node) 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.node_deps[self.uid()] = nodes
bld.raw_deps[self.uid()] = [] bld.raw_deps[self.uid()] = []
try: try:
del self.cache_sig del self.cache_sig
except: except AttributeError:
pass pass
Task.Task.post_run(self) Task.Task.post_run(self)

View File

@ -130,7 +130,7 @@ def wrap_compiled_task(classname):
if not c_preproc.go_absolute: if not c_preproc.go_absolute:
if not (node.is_child_of(bld.srcnode) or node.is_child_of(bld.bldnode)): if not (node.is_child_of(bld.srcnode) or node.is_child_of(bld.bldnode)):
# System library # System library
Logs.debug('msvcdeps: Ignoring system include %r' % node) Logs.debug('msvcdeps: Ignoring system include %r', node)
continue continue
if id(node) == id(self.inputs[0]): if id(node) == id(self.inputs[0]):
@ -144,7 +144,7 @@ def wrap_compiled_task(classname):
try: try:
del self.cache_sig del self.cache_sig
except: except AttributeError:
pass pass
Task.Task.post_run(self) Task.Task.post_run(self)
@ -222,7 +222,7 @@ def wrap_compiled_task(classname):
for line in raw_out.splitlines(): for line in raw_out.splitlines():
if line.startswith(INCLUDE_PATTERN): if line.startswith(INCLUDE_PATTERN):
inc_path = line[len(INCLUDE_PATTERN):].strip() 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) self.msvcdeps_paths.append(inc_path)
else: else:
out.append(line) out.append(line)

View File

@ -374,7 +374,7 @@ def stealth_write(self, data, flags='wb'):
except (IOError, ValueError): except (IOError, ValueError):
self.write(data, flags=flags) self.write(data, flags=flags)
else: else:
Logs.debug('msvs: skipping %s' % self.win32path()) Logs.debug('msvs: skipping %s', self.win32path())
Node.Node.stealth_write = stealth_write Node.Node.stealth_write = stealth_write
re_win32 = re.compile(r'^([/\\]cygdrive)?[/\\]([a-z])([^a-z0-9_-].*)', re.I) re_win32 = re.compile(r'^([/\\]cygdrive)?[/\\]([a-z])([^a-z0-9_-].*)', re.I)
@ -529,7 +529,7 @@ class vsnode_project(vsnode):
return lst return lst
def write(self): def write(self):
Logs.debug('msvs: creating %r' % self.path) Logs.debug('msvs: creating %r', self.path)
# first write the project file # first write the project file
template1 = compile_template(PROJECT_TEMPLATE) template1 = compile_template(PROJECT_TEMPLATE)
@ -794,7 +794,7 @@ class msvs_generator(BuildContext):
# and finally write the solution file # and finally write the solution file
node = self.get_solution_node() node = self.get_solution_node()
node.parent.mkdir() node.parent.mkdir()
Logs.warn('Creating %r' % node) Logs.warn('Creating %r', node)
template1 = compile_template(SOLUTION_TEMPLATE) template1 = compile_template(SOLUTION_TEMPLATE)
sln_str = template1(self) sln_str = template1(self)
sln_str = rm_blank_lines(sln_str) sln_str = rm_blank_lines(sln_str)
@ -973,7 +973,7 @@ def wrap_2008(cls):
return '' return ''
def write(self): def write(self):
Logs.debug('msvs: creating %r' % self.path) Logs.debug('msvs: creating %r', self.path)
template1 = compile_template(self.project_template) template1 = compile_template(self.project_template)
proj_str = template1(self) proj_str = template1(self)
proj_str = rm_blank_lines(proj_str) proj_str = rm_blank_lines(proj_str)

View File

@ -146,7 +146,7 @@ def check_cache(conn, ssig):
ret = ''.join(buf) ret = ''.join(buf)
all_sigs_in_cache = (time.time(), ret.splitlines()) 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]: if not ssig in all_sigs_in_cache[1]:
raise ValueError('no file %s in cache' % ssig) raise ValueError('no file %s in cache' % ssig)
@ -215,11 +215,11 @@ def can_retrieve_cache(self):
recv_file(conn, ssig, cnt, p) recv_file(conn, ssig, cnt, p)
cnt += 1 cnt += 1
except MissingFile as e: 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 err = True
except Exception as e: 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 err = True
# broken connection? remove this one # broken connection? remove this one
@ -259,7 +259,7 @@ def put_files_cache(self):
conn = get_connection(push=True) conn = get_connection(push=True)
sock_send(conn, ssig, cnt, node.abspath()) sock_send(conn, ssig, cnt, node.abspath())
except Exception as e: 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 # broken connection? remove this one
close_connection(conn) close_connection(conn)

View File

@ -64,7 +64,7 @@ def download_archive(self, src, dst):
else: else:
tmp = self.root.make_node(dst) tmp = self.root.make_node(dst)
tmp.write(web.read()) tmp.write(web.read())
Logs.warn('Downloaded %s from %s' % (tmp.abspath(), url)) Logs.warn('Downloaded %s from %s', tmp.abspath(), url)
break break
else: else:
self.fatal('Could not get the package %s' % src) self.fatal('Could not get the package %s' % src)

View File

@ -422,7 +422,7 @@ def make_picture(producer):
node = producer.bld.path.make_node('pdebug.svg') node = producer.bld.path.make_node('pdebug.svg')
node.write(txt) node.write(txt)
Logs.warn('Created the diagram %r' % node.abspath()) Logs.warn('Created the diagram %r', node)
def options(opt): def options(opt):
opt.add_option('--dtitle', action='store', default='Parallel build representation for %r' % ' '.join(sys.argv), opt.add_option('--dtitle', action='store', default='Parallel build representation for %r' % ' '.join(sys.argv),

View File

@ -20,8 +20,8 @@ def exec_command(self, cmd, **kw):
else: else:
txt = ' '.join(repr(x) if ' ' in x else x for x in cmd) txt = ' '.join(repr(x) if ' ' in x else x for x in cmd)
Logs.debug('runner: %s' % txt) Logs.debug('runner: %s', txt)
Logs.debug('runner_env: kw=%s' % kw) Logs.debug('runner_env: kw=%s', kw)
if self.logger: if self.logger:
self.logger.info(cmd) self.logger.info(cmd)

View File

@ -49,13 +49,13 @@ def parse_rst_node(task, node, nodes, names, seen, dirs=None):
for match in re_rst.finditer(code): for match in re_rst.finditer(code):
ipath = match.group('file') ipath = match.group('file')
itype = match.group('type') itype = match.group('type')
Logs.debug("rst: visiting %s: %s" % (itype, ipath)) Logs.debug('rst: visiting %s: %s', itype, ipath)
found = False found = False
for d in dirs: 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) found = d.find_node(ipath)
if found: 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)) nodes.append((itype, found))
if itype == 'include': if itype == 'include':
parse_rst_node(task, found, nodes, names, seen) parse_rst_node(task, found, nodes, names, seen)
@ -84,9 +84,9 @@ class docutils(Task.Task):
parse_rst_node(self, node, nodes, names, seen) 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: 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]) return ([v for (t,v) in nodes], [v for (t,v) in names])
@ -100,7 +100,7 @@ class docutils(Task.Task):
:type retcode: boolean :type retcode: boolean
""" """
if retcode != 0: 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): def run(self):
""" """
@ -124,7 +124,7 @@ class rst2html(docutils):
if stylesheet is not None: if stylesheet is not None:
ssnode = self.generator.to_nodes(stylesheet)[0] ssnode = self.generator.to_nodes(stylesheet)[0]
nodes.append(ssnode) 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 return nodes, names

View File

@ -84,8 +84,8 @@ class run_do_script(run_do_script_base):
run_do_script_base.run(self) run_do_script_base.run(self)
ret, log_tail = self.check_erase_log_file() ret, log_tail = self.check_erase_log_file()
if ret: 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""" % ( 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].abspath(), ret, self.env.LOGFILEPATH, log_tail)) self.inputs[0], ret, self.env.LOGFILEPATH, log_tail)
return ret return ret
def check_erase_log_file(self): def check_erase_log_file(self):
@ -133,7 +133,7 @@ def apply_run_do_script(tg):
if not node: if not node:
tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath())) tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath()))
tsk.dep_nodes.append(node) 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 # Bypass the execution of process_source by setting the source to an empty list
tg.source = [] tg.source = []

View File

@ -55,8 +55,8 @@ class run_m_script(run_m_script_base):
mode = 'rb' mode = 'rb'
with open(logfile, mode=mode) as f: with open(logfile, mode=mode) as f:
tail = f.readlines()[-10:] 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""" % ( 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].abspath(), ret, logfile, '\n'.join(tail))) self.inputs[0], ret, logfile, '\n'.join(tail))
else: else:
os.remove(logfile) os.remove(logfile)
return ret return ret
@ -83,7 +83,7 @@ def apply_run_m_script(tg):
if not node: if not node:
tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath())) tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath()))
tsk.dep_nodes.append(node) 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 # Bypass the execution of process_source by setting the source to an empty list
tg.source = [] tg.source = []

View File

@ -62,7 +62,6 @@ def apply_run_py_script(tg):
If the build environment has an attribute "PROJECT_PATHS" with If the build environment has an attribute "PROJECT_PATHS" with
a key "PROJECT_ROOT", its value will be appended to the PYTHONPATH. a key "PROJECT_ROOT", its value will be appended to the PYTHONPATH.
""" """
# Set the Python version to use, default to 3. # Set the Python version to use, default to 3.
@ -99,7 +98,7 @@ def apply_run_py_script(tg):
if not node: if not node:
tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath())) tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath()))
tsk.dep_nodes.append(node) 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 # Bypass the execution of process_source by setting the source to an empty list
tg.source = [] tg.source = []

View File

@ -53,8 +53,8 @@ class run_r_script(run_r_script_base):
mode = 'rb' mode = 'rb'
with open(logfile, mode=mode) as f: with open(logfile, mode=mode) as f:
tail = f.readlines()[-10:] 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""" % ( 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].abspath(), ret, logfile, '\n'.join(tail))) self.inputs[0], ret, logfile, '\n'.join(tail))
else: else:
os.remove(logfile) os.remove(logfile)
return ret return ret
@ -80,7 +80,7 @@ def apply_run_r_script(tg):
if not node: if not node:
tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath())) tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.abspath()))
tsk.dep_nodes.append(node) 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 # Bypass the execution of process_source by setting the source to an empty list
tg.source = [] tg.source = []

View File

@ -22,7 +22,7 @@ class sas(Task.Task):
# set the cwd # set the cwd
task.cwd = task.inputs[0].parent.get_src().abspath() 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 SASINPUTS = node.parent.get_bld().abspath() + os.pathsep + node.parent.get_src().abspath() + os.pathsep
task.env.env = {'SASINPUTS': SASINPUTS} task.env.env = {'SASINPUTS': SASINPUTS}
@ -32,10 +32,10 @@ class sas(Task.Task):
task.env.LSTFILE = lstfilenode.abspath() task.env.LSTFILE = lstfilenode.abspath()
ret = fun(task) ret = fun(task)
if ret: if ret:
Logs.error('Running %s on %r returned a non-zero exit' % (command, node)) Logs.error('Running %s on %r returned a non-zero exit', command, node)
Logs.error('SRCFILE = %r' % node) Logs.error('SRCFILE = %r', node)
Logs.error('LOGFILE = %r' % logfilenode) Logs.error('LOGFILE = %r', logfilenode)
Logs.error('LSTFILE = %r' % lstfilenode) Logs.error('LSTFILE = %r', lstfilenode)
return ret return ret
@feature('sas') @feature('sas')

View File

@ -59,7 +59,7 @@ def stale_rec(node, nodes):
else: else:
if not node in nodes: if not node in nodes:
if can_delete(node): if can_delete(node):
Logs.warn("Removing stale file -> %s" % node.abspath()) Logs.warn('Removing stale file -> %r', node)
node.delete() node.delete()
old = Parallel.refill_task_list old = Parallel.refill_task_list

View File

@ -162,7 +162,7 @@ def parse_strace_deps(self, path, cwd):
# record the dependencies then force the task signature recalculation for next time # record the dependencies then force the task signature recalculation for next time
if Logs.verbose: 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 = self.generator.bld
bld.node_deps[self.uid()] = nodes bld.node_deps[self.uid()] = nodes
bld.raw_deps[self.uid()] = [] bld.raw_deps[self.uid()] = []

View File

@ -87,7 +87,7 @@ class swig(Task.Task):
to_see.append(u) to_see.append(u)
break break
else: else:
Logs.warn('could not find %r' % n) Logs.warn('could not find %r', n)
return (lst_src, []) return (lst_src, [])

View File

@ -130,12 +130,12 @@ def download_tool(tool, force=False, ctx=None):
else: else:
tmp = ctx.root.make_node(os.sep.join((Context.waf_dir, 'waflib', 'extras', tool + '.py'))) tmp = ctx.root.make_node(os.sep.join((Context.waf_dir, 'waflib', 'extras', tool + '.py')))
tmp.write(web.read(), 'wb') tmp.write(web.read(), 'wb')
Logs.warn('Downloaded %s from %s' % (tool, url)) Logs.warn('Downloaded %s from %s', tool, url)
download_check(tmp) download_check(tmp)
try: try:
module = Context.load_tool(tool) module = Context.load_tool(tool)
except Exception: 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: try:
tmp.delete() tmp.delete()
except Exception: except Exception:

View File

@ -113,7 +113,7 @@ def process_valadoc(self):
try: try:
task.vapi_dirs.append(self.path.find_dir(vapi_dir).abspath()) task.vapi_dirs.append(self.path.find_dir(vapi_dir).abspath())
except AttributeError: 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): if getattr(self, 'files', None):
task.files = self.files task.files = self.files
else: else:

View File

@ -62,7 +62,7 @@ def runnable_status(self):
def v(x): def v(x):
return Utils.to_hex(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'] msgs = ['* Implicit or scanner dependency', '* Task code', '* Source file, explicit or manual dependency', '* Configuration data variable']
tmp = 'task: -> %s: %s %s' tmp = 'task: -> %s: %s %s'
for x in range(len(msgs)): for x in range(len(msgs)):
@ -70,7 +70,7 @@ def runnable_status(self):
a = new_sigs[x*l : (x+1)*l] a = new_sigs[x*l : (x+1)*l]
b = old_sigs[x*l : (x+1)*l] b = old_sigs[x*l : (x+1)*l]
if (a != b): 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 return ret
Task.Task.runnable_status = runnable_status Task.Task.runnable_status = runnable_status

View File

@ -120,7 +120,7 @@ if Utils.is_win32:
find = FindFirstFile(TP % curpath, ctypes.byref(findData)) find = FindFirstFile(TP % curpath, ctypes.byref(findData))
if find == INVALID_HANDLE_VALUE: 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()) return os.path.isfile(self.abspath())
try: try:
@ -132,7 +132,7 @@ if Utils.is_win32:
if not FindNextFile(find, ctypes.byref(findData)): if not FindNextFile(find, ctypes.byref(findData)):
break break
except Exception as e: 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()) return os.path.isfile(self.abspath())
finally: finally:
FindClose(find) FindClose(find)

View File

@ -53,9 +53,8 @@ $ waf configure xcode6
# TODO: support iOS projects # TODO: support iOS projects
from waflib import Context, TaskGen, Build, Utils, ConfigSet, Configure, Errors from waflib import Context, TaskGen, Build, Utils, Errors
from waflib.Build import BuildContext import os, sys
import os, sys, random, time
HEADERS_GLOB = '**/(*.h|*.hpp|*.H|*.inl)' HEADERS_GLOB = '**/(*.h|*.hpp|*.H|*.inl)'

View File

@ -267,8 +267,8 @@ def create_waf(self, *k, **kw):
files = [x.name for x in tar.getmembers()] files = [x.name for x in tar.getmembers()]
if set(files) ^ set(oldfiles): if set(files) ^ set(oldfiles):
Logs.warn('The archive model has differences:') Logs.warn('The archive model has differences:')
Logs.warn('- Added %r' % list(set(files) - set(oldfiles))) Logs.warn('- Added %r', list(set(files) - set(oldfiles)))
Logs.warn('- Removed %r' % list(set(oldfiles) - set(files))) Logs.warn('- Removed %r', list(set(oldfiles) - set(files)))
#open a file as tar.[extension] for writing #open a file as tar.[extension] for writing
tar = tarfile.open('%s.tar.%s' % (mw, zipType), "w:%s" % zipType) tar = tarfile.open('%s.tar.%s' % (mw, zipType), "w:%s" % zipType)