本文整理汇总了Python中waflib.Task.set_precedence_constraints方法的典型用法代码示例。如果您正苦于以下问题:Python Task.set_precedence_constraints方法的具体用法?Python Task.set_precedence_constraints怎么用?Python Task.set_precedence_constraints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Task
的用法示例。
在下文中一共展示了Task.set_precedence_constraints方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_build_iterator
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import set_precedence_constraints [as 别名]
def get_build_iterator(self):
"""
Creates a Python generator object that returns lists of tasks that may be processed in parallel.
:return: tasks which can be executed immediatly
:rtype: generator returning lists of :py:class:`waflib.Task.TaskBase`
"""
self.cur = 0
if self.targets and self.targets != '*':
(self._min_grp, self._exact_tg) = self.get_targets()
global lazy_post
if self.post_mode != POST_LAZY:
while self.cur < len(self.groups):
self.post_group()
self.cur += 1
self.cur = 0
while self.cur < len(self.groups):
# first post the task generators for the group
if self.post_mode != POST_AT_ONCE:
self.post_group()
# then extract the tasks
tasks = self.get_tasks_group(self.cur)
# if the constraints are set properly (ext_in/ext_out, before/after)
# the call to set_file_constraints may be removed (can be a 15% penalty on no-op rebuilds)
# (but leave set_file_constraints for the installation step)
#
# if the tasks have only files, set_file_constraints is required but set_precedence_constraints is not necessary
#
Task.set_file_constraints(tasks)
Task.set_precedence_constraints(tasks)
self.cur_tasks = tasks
self.cur += 1
if not tasks: # return something else the build will stop
continue
yield tasks
while 1:
yield []
示例2: get_build_iterator
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import set_precedence_constraints [as 别名]
def get_build_iterator(self):
"""creates a generator object that returns tasks executable in parallel (yield)"""
self.cur = 0
if self.targets and self.targets != '*':
(self._min_grp, self._exact_tg) = self.get_targets()
global lazy_post
if self.post_mode != POST_LAZY:
while self.cur < len(self.groups):
self.post_group()
self.cur += 1
self.cur = 0
while self.cur < len(self.groups):
# first post the task generators for the group
if self.post_mode != POST_AT_ONCE:
self.post_group()
# then extract the tasks
tasks = []
for tg in self.groups[self.cur]:
# TODO a try-except might be more efficient
if isinstance(tg, Task.TaskBase):
tasks.append(tg)
else:
tasks.extend(tg.tasks)
# if the constraints are set properly (ext_in/ext_out, before/after)
# the call to set_file_constraints may be removed (can be a 15% penalty on no-op rebuilds)
# (but leave set_file_constraints for the installation step)
#
# if the tasks have only files, set_file_constraints is required but set_precedence_constraints is not necessary
#
Task.set_file_constraints(tasks)
Task.set_precedence_constraints(tasks)
self.cur += 1
if not tasks: # return something else the build will stop
continue
yield tasks
while 1:
yield []
示例3: get_build_iterator
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import set_precedence_constraints [as 别名]
def get_build_iterator(self):
self.cur = 0
if self.targets and self.targets != "*":
(self._min_grp, self._exact_tg) = self.get_targets()
global lazy_post
if self.post_mode != POST_LAZY:
while self.cur < len(self.groups):
self.post_group()
self.cur += 1
self.cur = 0
while self.cur < len(self.groups):
if self.post_mode != POST_AT_ONCE:
self.post_group()
tasks = self.get_tasks_group(self.cur)
Task.set_file_constraints(tasks)
Task.set_precedence_constraints(tasks)
self.cur_tasks = tasks
self.cur += 1
if not tasks:
continue
yield tasks
while 1:
yield []
示例4: get_build_iterator
# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import set_precedence_constraints [as 别名]
def get_build_iterator(self):
if not self.files:
while 1:
yield super(MakeContext, self).get_build_iterator()
for g in self.groups:
for tg in g:
try:
f = tg.post
except AttributeError:
pass
else:
f()
provides = {}
uses = {}
all_tasks = []
tasks = []
for pat in self.files.split(','):
matcher = self.get_matcher(pat)
for tg in g:
if isinstance(tg, Task.TaskBase):
lst = [tg]
else:
lst = tg.tasks
for tsk in lst:
all_tasks.append(tsk)
do_exec = False
for node in getattr(tsk, 'inputs', []):
try:
uses[node].append(tsk)
except:
uses[node] = [tsk]
if matcher(node, output=False):
do_exec = True
break
for node in getattr(tsk, 'outputs', []):
try:
provides[node].append(tsk)
except:
provides[node] = [tsk]
if matcher(node, output=True):
do_exec = True
break
if do_exec:
tasks.append(tsk)
# so we have the tasks that we need to process, the list of all tasks,
# the map of the tasks providing nodes, and the map of tasks using nodes
if not tasks:
# if there are no tasks matching, return everything in the current group
result = all_tasks
else:
# this is like a big filter...
result = set([])
seen = set([])
cur = set(tasks)
while cur:
result |= cur
tosee = set([])
for tsk in cur:
for node in getattr(tsk, 'inputs', []):
if node in seen:
continue
seen.add(node)
tosee |= set(provides.get(node, []))
cur = tosee
result = list(result)
Task.set_file_constraints(result)
Task.set_precedence_constraints(result)
yield result
while 1:
yield []
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:82,代码来源:make.py