def get_build_iterator(self):
     if self.targets and self.targets != '*':
         (self._min_grp, self._exact_tg) = self.get_targets()
     if self.post_mode != POST_LAZY:
         for self.current_group, _ in enumerate(self.groups):
             self.post_group()
     for self.current_group, _ in enumerate(self.groups):
         if self.post_mode != POST_AT_ONCE:
             self.post_group()
         tasks = self.get_tasks_group(self.current_group)
         Task.set_file_constraints(tasks)
         Task.set_precedence_constraints(tasks)
         self.cur_tasks = tasks
         if tasks:
             yield tasks
     while 1:
         yield []
Esempio n. 2
0
File: Build.py Progetto: jhasse/waf
	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 []
Esempio n. 3
0
    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 []
Esempio n. 4
0
File: Build.py Progetto: zsx/waf
	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 []
Esempio n. 5
0
	def get_build_iterator(self):
		self.current_group=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.current_group<len(self.groups):
				self.post_group()
				self.current_group+=1
			self.current_group=0
		while self.current_group<len(self.groups):
			if self.post_mode!=POST_AT_ONCE:
				self.post_group()
			tasks=self.get_tasks_group(self.current_group)
			Task.set_file_constraints(tasks)
			Task.set_precedence_constraints(tasks)
			self.cur_tasks=tasks
			if tasks:
				yield tasks
			self.current_group+=1
		while 1:
			yield[]
Esempio n. 6
0
 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 []
	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 []
Esempio n. 8
0
    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.Task):
                        lst = [tg]
                    else:
                        lst = tg.tasks
                    for tsk in lst:
                        all_tasks.append(tsk)

                        do_exec = False
                        for node in tsk.inputs:
                            try:
                                uses[node].append(tsk)
                            except:
                                uses[node] = [tsk]

                            if matcher(node, output=False):
                                do_exec = True
                                break

                        for node in 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 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 []