Issue 1453

This commit is contained in:
Thomas Nagy 2014-05-19 21:32:24 +02:00
parent 6be13a74bb
commit c21317c727
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
7 changed files with 14 additions and 22 deletions

View File

@ -749,13 +749,6 @@ class Node(object):
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):
"Path seen from the build directory default/src/foo.cpp"
return self.path_from(self.ctx.bldnode)

View File

@ -416,8 +416,8 @@ class Task(TaskBase):
def __str__(self):
"string to display to the user"
src_str = ' '.join([a.nice_path() for a in self.inputs])
tgt_str = ' '.join([a.nice_path() for a in self.outputs])
src_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.inputs])
tgt_str = ' '.join([a.path_from(a.ctx.launch_node()) for a in self.outputs])
if self.outputs: sep = ' -> '
else: sep = ''
return '%s: %s%s%s\n' % (self.__class__.__name__.replace('_task', ''), src_str, sep, tgt_str)

View File

@ -163,7 +163,7 @@ class tar(Task.Task):
return Task.Task.runnable_status(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)
@feature('doxygen')

View File

@ -85,7 +85,7 @@ class run_do_script(run_do_script_base):
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].nice_path(), ret, self.env.LOGFILEPATH, log_tail))
self.inputs[0].abspath(), ret, self.env.LOGFILEPATH, log_tail))
return ret
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}
else:
kwargs = {'name': self.env.LOGFILEPATH, 'mode': 'r'}
with open(**kwargs) as log:
log_tail = log.readlines()[-10:]
for line in log_tail:
@ -132,9 +131,9 @@ def apply_run_do_script(tg):
for x in tg.to_list(getattr(tg, 'deps', [])):
node = tg.path.find_resource(x)
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)
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
tg.source = []

View File

@ -56,7 +56,7 @@ class run_m_script(run_m_script_base):
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].nice_path(), ret, logfile, '\n'.join(tail)))
self.inputs[0].abspath(), ret, logfile, '\n'.join(tail)))
else:
os.remove(logfile)
return ret
@ -81,9 +81,9 @@ def apply_run_m_script(tg):
for x in tg.to_list(getattr(tg, 'deps', [])):
node = tg.path.find_resource(x)
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)
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
tg.source = []

View File

@ -97,9 +97,9 @@ def apply_run_py_script(tg):
for x in tg.to_list(getattr(tg, 'deps', [])):
node = tg.path.find_resource(x)
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)
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
tg.source = []

View File

@ -54,7 +54,7 @@ class run_r_script(run_r_script_base):
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].nice_path(), ret, logfile, '\n'.join(tail)))
self.inputs[0].abspath(), ret, logfile, '\n'.join(tail)))
else:
os.remove(logfile)
return ret
@ -78,9 +78,9 @@ def apply_run_r_script(tg):
for x in tg.to_list(getattr(tg, 'deps', [])):
node = tg.path.find_resource(x)
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)
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
tg.source = []