mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-21 17:35:55 +01:00
Beautify Logs.{debug,error,info,warn} now that the formatting bug is fixed
This commit is contained in:
parent
8407845787
commit
02a8361149
@ -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)
|
||||
|
||||
|
@ -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())
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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})
|
||||
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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())
|
||||
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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))
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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),
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 = []
|
||||
|
@ -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 = []
|
||||
|
@ -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 = []
|
||||
|
@ -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 = []
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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()] = []
|
||||
|
@ -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, [])
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)'
|
||||
|
||||
|
4
wscript
4
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)
|
||||
|
Loading…
Reference in New Issue
Block a user