Simplify task.inputs/task.outputs usage

This commit is contained in:
Thomas Nagy 2017-02-19 11:05:44 +01:00
parent 0c541f606a
commit 1c3c49d0fb
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
5 changed files with 13 additions and 11 deletions

View File

@ -1372,11 +1372,11 @@ class StepContext(BuildContext):
lst = tg.tasks
for tsk in lst:
do_exec = False
for node in getattr(tsk, 'inputs', []):
for node in tsk.inputs:
if matcher(node, output=False):
do_exec = True
break
for node in getattr(tsk, 'outputs', []):
for node in tsk.outputs:
if matcher(node, output=True):
do_exec = True
break

View File

@ -867,10 +867,12 @@ def set_file_constraints(tasks):
ins = Utils.defaultdict(set)
outs = Utils.defaultdict(set)
for x in tasks:
for a in getattr(x, 'inputs', []) + getattr(x, 'dep_nodes', []):
ins[id(a)].add(x)
for a in getattr(x, 'outputs', []):
outs[id(a)].add(x)
for a in x.inputs:
ins[a].add(x)
for a in x.dep_nodes:
ins[a].add(x)
for a in x.outputs:
outs[a].add(x)
links = set(ins.keys()).intersection(outs.keys())
for k in links:

View File

@ -313,7 +313,7 @@ def apply_qt5(self):
if getattr(self, 'update', None) and Options.options.trans_qt5:
cxxnodes = [a.inputs[0] for a in self.compiled_tasks] + [
a.inputs[0] for a in self.tasks if getattr(a, 'inputs', None) and a.inputs[0].name.endswith('.ui')]
a.inputs[0] for a in self.tasks if a.inputs and a.inputs[0].name.endswith('.ui')]
for x in qmtasks:
self.create_task('trans_update', cxxnodes, x.inputs)

View File

@ -56,7 +56,7 @@ class MakeContext(BuildContext):
all_tasks.append(tsk)
do_exec = False
for node in getattr(tsk, 'inputs', []):
for node in tsk.inputs:
try:
uses[node].append(tsk)
except:
@ -66,7 +66,7 @@ class MakeContext(BuildContext):
do_exec = True
break
for node in getattr(tsk, 'outputs', []):
for node in tsk.outputs:
try:
provides[node].append(tsk)
except:
@ -93,7 +93,7 @@ class MakeContext(BuildContext):
result |= cur
tosee = set()
for tsk in cur:
for node in getattr(tsk, 'inputs', []):
for node in tsk.inputs:
if node in seen:
continue
seen.add(node)

View File

@ -69,7 +69,7 @@ def get_next_task(self):
break
else:
# so far so good, now consider the nodes
for x in getattr(tsk, 'inputs', []) + getattr(tsk, 'deps', []):
for x in tsk.inputs + getattr(tsk, 'deps', []):
if x in canceled_nodes:
tsk.hasrun = Task.CANCELED
self.cancel_next(tsk)