mirror of https://gitlab.com/ita1024/waf.git
Issue 1453
This commit is contained in:
parent
6be13a74bb
commit
c21317c727
|
@ -749,13 +749,6 @@ class Node(object):
|
||||||
|
|
||||||
return self.parent.find_or_declare([name])
|
return self.parent.find_or_declare([name])
|
||||||
|
|
||||||
def nice_path(self, env=None):
|
|
||||||
"""
|
|
||||||
Return the path seen from the launch directory.
|
|
||||||
Can be used for opening files easily (copy-paste in the console).
|
|
||||||
"""
|
|
||||||
return self.path_from(self.ctx.launch_node())
|
|
||||||
|
|
||||||
def bldpath(self):
|
def bldpath(self):
|
||||||
"Path seen from the build directory default/src/foo.cpp"
|
"Path seen from the build directory default/src/foo.cpp"
|
||||||
return self.path_from(self.ctx.bldnode)
|
return self.path_from(self.ctx.bldnode)
|
||||||
|
|
|
@ -416,8 +416,8 @@ class Task(TaskBase):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"string to display to the user"
|
"string to display to the user"
|
||||||
src_str = ' '.join([a.nice_path() for a in self.inputs])
|
src_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.inputs])
|
||||||
tgt_str = ' '.join([a.nice_path() for a in self.outputs])
|
tgt_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.outputs])
|
||||||
if self.outputs: sep = ' -> '
|
if self.outputs: sep = ' -> '
|
||||||
else: sep = ''
|
else: sep = ''
|
||||||
return '%s: %s%s%s\n' % (self.__class__.__name__.replace('_task', ''), src_str, sep, tgt_str)
|
return '%s: %s%s%s\n' % (self.__class__.__name__.replace('_task', ''), src_str, sep, tgt_str)
|
||||||
|
|
|
@ -163,7 +163,7 @@ class tar(Task.Task):
|
||||||
return Task.Task.runnable_status(self)
|
return Task.Task.runnable_status(self)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
tgt_str = ' '.join([a.nice_path(self.env) for a in self.outputs])
|
tgt_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.outputs])
|
||||||
return '%s: %s\n' % (self.__class__.__name__, tgt_str)
|
return '%s: %s\n' % (self.__class__.__name__, tgt_str)
|
||||||
|
|
||||||
@feature('doxygen')
|
@feature('doxygen')
|
||||||
|
|
|
@ -85,7 +85,7 @@ class run_do_script(run_do_script_base):
|
||||||
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 %s failed with code %r.\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""" % (
|
||||||
self.inputs[0].nice_path(), ret, self.env.LOGFILEPATH, log_tail))
|
self.inputs[0].abspath(), ret, self.env.LOGFILEPATH, log_tail))
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def check_erase_log_file(self):
|
def check_erase_log_file(self):
|
||||||
|
@ -99,7 +99,6 @@ class run_do_script(run_do_script_base):
|
||||||
kwargs = {'file': self.env.LOGFILEPATH, 'mode': 'r', 'encoding': self.env.STATAENCODING}
|
kwargs = {'file': self.env.LOGFILEPATH, 'mode': 'r', 'encoding': self.env.STATAENCODING}
|
||||||
else:
|
else:
|
||||||
kwargs = {'name': self.env.LOGFILEPATH, 'mode': 'r'}
|
kwargs = {'name': self.env.LOGFILEPATH, 'mode': 'r'}
|
||||||
|
|
||||||
with open(**kwargs) as log:
|
with open(**kwargs) as log:
|
||||||
log_tail = log.readlines()[-10:]
|
log_tail = log.readlines()[-10:]
|
||||||
for line in log_tail:
|
for line in log_tail:
|
||||||
|
@ -132,9 +131,9 @@ def apply_run_do_script(tg):
|
||||||
for x in tg.to_list(getattr(tg, 'deps', [])):
|
for x in tg.to_list(getattr(tg, 'deps', [])):
|
||||||
node = tg.path.find_resource(x)
|
node = tg.path.find_resource(x)
|
||||||
if not node:
|
if not node:
|
||||||
tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.nice_path()))
|
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.nice_path()))
|
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 = []
|
||||||
|
|
|
@ -56,7 +56,7 @@ class run_m_script(run_m_script_base):
|
||||||
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 %s returned the error %r\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""" % (
|
||||||
self.inputs[0].nice_path(), ret, logfile, '\n'.join(tail)))
|
self.inputs[0].abspath(), ret, logfile, '\n'.join(tail)))
|
||||||
else:
|
else:
|
||||||
os.remove(logfile)
|
os.remove(logfile)
|
||||||
return ret
|
return ret
|
||||||
|
@ -81,9 +81,9 @@ def apply_run_m_script(tg):
|
||||||
for x in tg.to_list(getattr(tg, 'deps', [])):
|
for x in tg.to_list(getattr(tg, 'deps', [])):
|
||||||
node = tg.path.find_resource(x)
|
node = tg.path.find_resource(x)
|
||||||
if not node:
|
if not node:
|
||||||
tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.nice_path()))
|
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.nice_path()))
|
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 = []
|
||||||
|
|
|
@ -97,9 +97,9 @@ def apply_run_py_script(tg):
|
||||||
for x in tg.to_list(getattr(tg, 'deps', [])):
|
for x in tg.to_list(getattr(tg, 'deps', [])):
|
||||||
node = tg.path.find_resource(x)
|
node = tg.path.find_resource(x)
|
||||||
if not node:
|
if not node:
|
||||||
tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.nice_path()))
|
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.nice_path()))
|
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 = []
|
||||||
|
|
|
@ -54,7 +54,7 @@ class run_r_script(run_r_script_base):
|
||||||
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 %s returned the error %r\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""" % (
|
||||||
self.inputs[0].nice_path(), ret, logfile, '\n'.join(tail)))
|
self.inputs[0].abspath(), ret, logfile, '\n'.join(tail)))
|
||||||
else:
|
else:
|
||||||
os.remove(logfile)
|
os.remove(logfile)
|
||||||
return ret
|
return ret
|
||||||
|
@ -78,9 +78,9 @@ def apply_run_r_script(tg):
|
||||||
for x in tg.to_list(getattr(tg, 'deps', [])):
|
for x in tg.to_list(getattr(tg, 'deps', [])):
|
||||||
node = tg.path.find_resource(x)
|
node = tg.path.find_resource(x)
|
||||||
if not node:
|
if not node:
|
||||||
tg.bld.fatal('Could not find dependency %r for running %r' % (x, src_node.nice_path()))
|
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.nice_path()))
|
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 = []
|
||||||
|
|
Loading…
Reference in New Issue