cwd must be a Node object

This commit is contained in:
Thomas Nagy 2016-01-02 01:54:52 +01:00
parent 7b26ce74d1
commit 43e26b5bef
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
11 changed files with 20 additions and 13 deletions

View File

@ -439,6 +439,10 @@ class Context(ctx):
kw['stdin'] = Utils.subprocess.PIPE
del kw['input']
if 'cwd' in kw:
if not isinstance(kw['cwd'], str):
kw['cwd'] = kw['cwd'].abspath()
try:
p = subprocess.Popen(cmd, **kw)
(out, err) = p.communicate(**wargs)

View File

@ -93,7 +93,7 @@ class Node(object):
def __str__(self):
"String representation (name), for debugging purposes"
return self.name
return self.abspath()
def __repr__(self):
"String representation (abspath), for debugging purposes"

View File

@ -35,7 +35,7 @@ def big_bison(self, node):
outs.append(node.change_ext('.tab.h'))
tsk = self.create_task('bison', node, outs)
tsk.cwd = node.parent.get_bld().abspath()
tsk.cwd = node.parent.get_bld()
# and the c/cxx file must be compiled too
self.source.append(outs[0])

View File

@ -132,7 +132,7 @@ class mcs(Task.Task):
if not kw.get('cwd', None):
kw['cwd'] = bld.cwd
except AttributeError:
bld.cwd = kw['cwd'] = bld.variant_dir
kw['cwd'] = bld.bldnode
try:
tmp = None

View File

@ -167,7 +167,7 @@ class fcprogram_test(fcprogram):
kw['shell'] = isinstance(cmd, str)
kw['stdout'] = kw['stderr'] = Utils.subprocess.PIPE
kw['cwd'] = bld.variant_dir
kw['cwd'] = bld.bldnode
bld.out = bld.err = ''
bld.to_log('command: %s\n' % cmd)

View File

@ -387,7 +387,7 @@ class glib_gresource_base(Task.Task):
if not kw.get('cwd', None):
kw['cwd'] = bld.cwd
except AttributeError:
kw['cwd'] = bld.bldnode.abspath()
kw['cwd'] = bld.bldnode
kw['quiet'] = Context.BOTH
cmd = Utils.subst_vars('${GLIB_COMPILE_RESOURCES} --sourcedir=%s --sourcedir=%s --generate-dependencies %s' % (

View File

@ -260,7 +260,7 @@ class javac(Task.Task):
env = self.env
gen = self.generator
bld = gen.bld
wd = bld.bldnode.abspath()
wd = bld.bldnode
def to_list(xx):
if isinstance(xx, str): return [xx]
return xx
@ -325,7 +325,7 @@ class javadoc(Task.Task):
def run(self):
env = self.env
bld = self.generator.bld
wd = bld.bldnode.abspath()
wd = bld.bldnode
#add src node + bld node (for generated java code)
srcpath = self.generator.path.abspath() + os.sep + self.generator.srcdir

View File

@ -1104,7 +1104,7 @@ def exec_command_msvc(self, *k, **kw):
if not kw.get('cwd', None):
kw['cwd'] = bld.cwd
except AttributeError:
bld.cwd = kw['cwd'] = bld.variant_dir
kw['cwd'] = bld.bldnode
ret = self.exec_response_command(k[0], **kw)
if not ret and getattr(self, 'do_manifest', None):

View File

@ -117,9 +117,9 @@ class tex(Task.Task):
Logs.info('runner: %r' % cmd)
try:
if not kw.get('cwd', None):
kw['cwd'] = bld.cwd
kw['cwd'] = bld.cwd.abspath()
except AttributeError:
bld.cwd = kw['cwd'] = bld.variant_dir
kw['cwd'] = bld.bldnode.abspath()
return Utils.subprocess.Popen(cmd, **kw).wait()
def scan_aux(self, node):
@ -350,7 +350,7 @@ class tex(Task.Task):
env.append_value('XELATEXFLAGS', '-interaction=batchmode')
# important, set the cwd for everybody
self.cwd = self.inputs[0].parent.get_bld().abspath()
self.cwd = self.inputs[0].parent.get_bld()
Logs.info('first pass on %s' % self.__class__.__name__)

View File

@ -85,7 +85,7 @@ class batch_task(Task.Task):
srclst.append(t.inputs[0].abspath())
self.env.SRCLST = srclst
self.cwd = slaves[0].outputs[0].parent.abspath()
self.cwd = slaves[0].outputs[0].parent
if self.slaves[0].__class__.__name__ == 'c':
ret = c_fun(self)

View File

@ -70,7 +70,7 @@ def exec_command(self, cmd, **kw):
if not kw.get('cwd', None):
kw['cwd'] = bld.cwd
except AttributeError:
bld.cwd = kw['cwd'] = bld.variant_dir
kw['cwd'] = bld.bldnode
args = self.get_strace_args()
fname = self.get_strace_file()
@ -103,6 +103,9 @@ def parse_strace_deps(self, path, cwd):
except OSError:
pass
if not isinstance(cwd, str):
cwd = cwd.abspath()
nodes = []
bld = self.generator.bld
try: