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 lst = tg.tasks
for tsk in lst: for tsk in lst:
do_exec = False do_exec = False
for node in getattr(tsk, 'inputs', []): for node in tsk.inputs:
if matcher(node, output=False): if matcher(node, output=False):
do_exec = True do_exec = True
break break
for node in getattr(tsk, 'outputs', []): for node in tsk.outputs:
if matcher(node, output=True): if matcher(node, output=True):
do_exec = True do_exec = True
break break

View File

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

View File

@ -313,7 +313,7 @@ def apply_qt5(self):
if getattr(self, 'update', None) and Options.options.trans_qt5: if getattr(self, 'update', None) and Options.options.trans_qt5:
cxxnodes = [a.inputs[0] for a in self.compiled_tasks] + [ 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: for x in qmtasks:
self.create_task('trans_update', cxxnodes, x.inputs) self.create_task('trans_update', cxxnodes, x.inputs)

View File

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

View File

@ -69,7 +69,7 @@ def get_next_task(self):
break break
else: else:
# so far so good, now consider the nodes # 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: if x in canceled_nodes:
tsk.hasrun = Task.CANCELED tsk.hasrun = Task.CANCELED
self.cancel_next(tsk) self.cancel_next(tsk)