Simplify BuilContext.post_group

This commit is contained in:
Thomas Nagy 2017-07-29 09:19:36 +02:00
parent 2dac65fea9
commit 549fe8cd42
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
1 changed files with 12 additions and 19 deletions

View File

@ -728,23 +728,21 @@ class BuildContext(Context.Context):
Post task generators from the group indexed by self.current_group; used internally Post task generators from the group indexed by self.current_group; used internally
by :py:meth:`waflib.Build.BuildContext.get_build_iterator` by :py:meth:`waflib.Build.BuildContext.get_build_iterator`
""" """
if self.targets == '*': def tgpost(tg):
for tg in self.groups[self.current_group]:
try: try:
f = tg.post f = tg.post
except AttributeError: except AttributeError:
pass pass
else: else:
f() f()
if self.targets == '*':
for tg in self.groups[self.current_group]:
tgpost(tg)
elif self.targets: elif self.targets:
if self.current_group < self._min_grp: if self.current_group < self._min_grp:
for tg in self.groups[self.current_group]: for tg in self.groups[self.current_group]:
try: tgpost(tg)
f = tg.post
except AttributeError:
pass
else:
f()
else: else:
for tg in self._exact_tg: for tg in self._exact_tg:
tg.post() tg.post()
@ -757,13 +755,8 @@ class BuildContext(Context.Context):
Logs.warn('CWD %s is not under %s, forcing --targets=* (run distclean?)', ln.abspath(), self.srcnode.abspath()) Logs.warn('CWD %s is not under %s, forcing --targets=* (run distclean?)', ln.abspath(), self.srcnode.abspath())
ln = self.srcnode ln = self.srcnode
for tg in self.groups[self.current_group]: for tg in self.groups[self.current_group]:
try:
f = tg.post
except AttributeError:
pass
else:
if tg.path.is_child_of(ln): if tg.path.is_child_of(ln):
f() tgpost(tg)
def get_tasks_group(self, idx): def get_tasks_group(self, idx):
""" """