• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python waflib.Task类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中waflib.Task的典型用法代码示例。如果您正苦于以下问题:Python Task类的具体用法?Python Task怎么用?Python Task使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Task类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: process_rule

def process_rule(self):
	if not getattr(self,'rule',None):
		return
	name=str(getattr(self,'name',None)or self.target or self.rule)
	cls=Task.task_factory(name,self.rule,getattr(self,'vars',[]),shell=getattr(self,'shell',True),color=getattr(self,'color','BLUE'))
	tsk=self.create_task(name)
	if getattr(self,'target',None):
		if isinstance(self.target,str):
			self.target=self.target.split()
		if not isinstance(self.target,list):
			self.target=[self.target]
		for x in self.target:
			if isinstance(x,str):
				tsk.outputs.append(self.path.find_or_declare(x))
			else:
				x.parent.mkdir()
				tsk.outputs.append(x)
		if getattr(self,'install_path',None):
			self.bld.install_files(self.install_path,tsk.outputs)
	if getattr(self,'source',None):
		tsk.inputs=self.to_nodes(self.source)
		self.source=[]
	if getattr(self,'scan',None):
		cls.scan=self.scan
	if getattr(self,'cwd',None):
		tsk.cwd=self.cwd
	if getattr(self,'update_outputs',None)or getattr(self,'on_results',None):
		Task.update_outputs(cls)
	if getattr(self,'always',None):
		Task.always_run(cls)
	for x in['after','before','ext_in','ext_out']:
		setattr(cls,x,getattr(self,x,[]))
开发者ID:AKASeon,项目名称:Whatever,代码行数:32,代码来源:TaskGen.py


示例2: set_precedence_constraints

def set_precedence_constraints(tasks):
	cstr_groups = Utils.defaultdict(list)
	for x in tasks:
		x.run_after = SetOfTasks(x)
		x.run_after_groups = []
		x.waiting_sets = []

		h = x.hash_constraints()
		cstr_groups[h].append(x)

	# create sets which can be reused for all tasks
	for k in cstr_groups.keys():
		cstr_groups[k] = set(cstr_groups[k])

	# this list should be short
	for key1, key2 in itertools.combinations(cstr_groups.keys(), 2):
		group1 = cstr_groups[key1]
		group2 = cstr_groups[key2]
		# get the first entry of the set
		t1 = next(iter(group1))
		t2 = next(iter(group2))

		# add the constraints based on the comparisons
		if Task.is_before(t1, t2):
			for x in group2:
				x.run_after_groups.append(group1)
			for k in group1:
				k.waiting_sets.append(group1)
		elif Task.is_before(t2, t1):
			for x in group1:
				x.run_after_groups.append(group2)
			for k in group2:
				k.waiting_sets.append(group2)
开发者ID:AleemDev,项目名称:waf,代码行数:33,代码来源:mem_reducer.py


示例3: process_rule

def process_rule(self):
	if not getattr(self,'rule',None):
		return
	name=str(getattr(self,'name',None)or self.target or getattr(self.rule,'__name__',self.rule))
	try:
		cache=self.bld.cache_rule_attr
	except AttributeError:
		cache=self.bld.cache_rule_attr={}
	cls=None
	if getattr(self,'cache_rule','True'):
		try:
			cls=cache[(name,self.rule)]
		except KeyError:
			pass
	if not cls:
		cls=Task.task_factory(name,self.rule,getattr(self,'vars',[]),shell=getattr(self,'shell',True),color=getattr(self,'color','BLUE'),scan=getattr(self,'scan',None))
		if getattr(self,'scan',None):
			cls.scan=self.scan
		elif getattr(self,'deps',None):
			def scan(self):
				nodes=[]
				for x in self.generator.to_list(getattr(self.generator,'deps',None)):
					node=self.generator.path.find_resource(x)
					if not node:
						self.generator.bld.fatal('Could not find %r (was it declared?)'%x)
					nodes.append(node)
				return[nodes,[]]
			cls.scan=scan
		if getattr(self,'update_outputs',None):
			Task.update_outputs(cls)
		if getattr(self,'always',None):
			Task.always_run(cls)
		for x in('after','before','ext_in','ext_out'):
			setattr(cls,x,getattr(self,x,[]))
		if getattr(self,'cache_rule','True'):
			cache[(name,self.rule)]=cls
		if getattr(self,'cls_str',None):
			setattr(cls,'__str__',self.cls_str)
		if getattr(self,'cls_keyword',None):
			setattr(cls,'keyword',self.cls_keyword)
	tsk=self.create_task(name)
	if getattr(self,'target',None):
		if isinstance(self.target,str):
			self.target=self.target.split()
		if not isinstance(self.target,list):
			self.target=[self.target]
		for x in self.target:
			if isinstance(x,str):
				tsk.outputs.append(self.path.find_or_declare(x))
			else:
				x.parent.mkdir()
				tsk.outputs.append(x)
		if getattr(self,'install_path',None):
			self.bld.install_files(self.install_path,tsk.outputs)
	if getattr(self,'source',None):
		tsk.inputs=self.to_nodes(self.source)
		self.source=[]
	if getattr(self,'cwd',None):
		tsk.cwd=self.cwd
开发者ID:hakiri,项目名称:sdn-ns-3,代码行数:59,代码来源:TaskGen.py


示例4: process_rule

def process_rule(self):
    """
    Process the attribute ``rule``. When present, :py:meth:`waflib.TaskGen.process_source` is disabled::

        def build(bld):
            bld(rule='cp ${SRC} ${TGT}', source='wscript', target='bar.txt')
    """
    if not getattr(self, 'rule', None):
        return

    # create the task class
    name = str(getattr(self, 'name', None) or self.target or self.rule)
    cls = Task.task_factory(name, self.rule,
        getattr(self, 'vars', []),
        shell=getattr(self, 'shell', True), color=getattr(self, 'color', 'BLUE'))

    # now create one instance
    tsk = self.create_task(name)

    if getattr(self, 'target', None):
        if isinstance(self.target, str):
            self.target = self.target.split()
        if not isinstance(self.target, list):
            self.target = [self.target]
        for x in self.target:
            if isinstance(x, str):
                tsk.outputs.append(self.path.find_or_declare(x))
            else:
                x.parent.mkdir() # if a node was given, create the required folders
                tsk.outputs.append(x)
        if getattr(self, 'install_path', None):
            # from waf 1.5
            # although convenient, it does not 1. allow to name the target file and 2. symlinks
            # TODO remove in waf 1.7
            self.bld.install_files(self.install_path, tsk.outputs)

    if getattr(self, 'source', None):
        tsk.inputs = self.to_nodes(self.source)
        # bypass the execution of process_source by setting the source to an empty list
        self.source = []

    if getattr(self, 'scan', None):
        cls.scan = self.scan

    if getattr(self, 'cwd', None):
        tsk.cwd = self.cwd

    # TODO remove on_results in waf 1.7
    if getattr(self, 'update_outputs', None) or getattr(self, 'on_results', None):
        Task.update_outputs(cls)

    if getattr(self, 'always', None):
        Task.always_run(cls)

    for x in ['after', 'before', 'ext_in', 'ext_out']:
        setattr(cls, x, getattr(self, x, []))
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:56,代码来源:TaskGen.py


示例5: declare_chain

def declare_chain(name='',rule=None,reentrant=None,color='BLUE',ext_in=[],ext_out=[],before=[],after=[],decider=None,scan=None,install_path=None,shell=False):
	ext_in=Utils.to_list(ext_in)
	ext_out=Utils.to_list(ext_out)
	if not name:
		name=rule
	cls=Task.task_factory(name,rule,color=color,ext_in=ext_in,ext_out=ext_out,before=before,after=after,scan=scan,shell=shell)
	def x_file(self,node):
		ext=decider and decider(self,node)or cls.ext_out
		if ext_in:
			_ext_in=ext_in[0]
		tsk=self.create_task(name,node)
		cnt=0
		keys=set(self.mappings.keys())|set(self.__class__.mappings.keys())
		for x in ext:
			k=node.change_ext(x,ext_in=_ext_in)
			tsk.outputs.append(k)
			if reentrant!=None:
				if cnt<int(reentrant):
					self.source.append(k)
			else:
				for y in keys:
					if k.name.endswith(y):
						self.source.append(k)
						break
			cnt+=1
		if install_path:
			self.bld.install_files(install_path,tsk.outputs)
		return tsk
	for x in cls.ext_in:
		task_gen.mappings[x]=x_file
	return x_file
开发者ID:PseudoSky,项目名称:voodoo,代码行数:31,代码来源:TaskGen.py


示例6: make_interpreted_test

def make_interpreted_test(self):
	"""Create interpreted unit tests."""
	for x in ['test_scripts_source', 'test_scripts_template']:
		if not hasattr(self, x):
			Logs.warn('a test_scripts taskgen i missing %s' % x)
			return

	self.ut_run, lst = Task.compile_fun(self.test_scripts_template, shell=getattr(self, 'test_scripts_shell', False))

	script_nodes = self.to_nodes(self.test_scripts_source)
	for script_node in script_nodes:
		tsk = self.create_task('utest', [script_node])
		tsk.vars = lst + tsk.vars
		tsk.env['SCRIPT'] = script_node.path_from(tsk.get_cwd())

	self.handle_ut_cwd('test_scripts_cwd')

	env = getattr(self, 'test_scripts_env', None)
	if env:
		self.ut_env = env
	else:
		self.ut_env = dict(os.environ)

	paths = getattr(self, 'test_scripts_paths', {})
	for (k,v) in paths.items():
		p = self.ut_env.get(k, '').split(os.pathsep)
		if isinstance(v, str):
			v = v.split(os.pathsep)
		self.ut_env[k] = os.pathsep.join(p + v)
开发者ID:blablack,项目名称:ams-lv2,代码行数:29,代码来源:waf_unit_test.py


示例7: make_pytest

def make_pytest(self):
	"""
	Creates a ``utest`` task with a modified PYTHONPATH environment for Python.
	"""
	nodes = self.to_nodes(self.pytest_source)
	tsk = self.create_task('utest', nodes)
	tsk.dep_nodes.extend(self.pytest_dep_nodes)

	if getattr(self, 'ut_str', None):
		self.ut_run, lst = Task.compile_fun(self.ut_str, shell=getattr(self, 'ut_shell', False))
		tsk.vars = lst + tsk.vars

	if getattr(self, 'ut_cwd', None):
		if isinstance(self.ut_cwd, str):
			# we want a Node instance
			if os.path.isabs(self.ut_cwd):
				self.ut_cwd = self.bld.root.make_node(self.ut_cwd)
			else:
				self.ut_cwd = self.path.make_node(self.ut_cwd)
	else:
		if tsk.inputs:
			self.ut_cwd = tsk.inputs[0].parent
		else:
			raise Errors.WafError("no valid input files for pytest task, check pytest_source value")

	if not self.ut_cwd.exists():
		self.ut_cwd.mkdir()

	self.ut_env = dict(os.environ)
	self.ut_env['PYTHONPATH'] = os.pathsep.join(self.pytest_paths) + self.ut_env.get('PYTHONPATH', '')
开发者ID:JodyGoldberg,项目名称:waf,代码行数:30,代码来源:pytest.py


示例8: declare_chain

def declare_chain(
    name="",
    rule=None,
    reentrant=True,
    color="BLUE",
    ext_in=[],
    ext_out=[],
    before=[],
    after=[],
    decider=None,
    scan=None,
):
    ext_in = Utils.to_list(ext_in)
    ext_out = Utils.to_list(ext_out)
    cls = Task.task_factory(
        name, rule, color=color, ext_in=ext_in, ext_out=ext_out, before=before, after=after, scan=scan
    )

    def x_file(self, node):
        ext = decider and decider(self, node) or cls.ext_out
        if ext_in:
            _ext_in = ext_in[0]
        out_source = [node.change_ext(x, ext_in=_ext_in) for x in ext]
        if reentrant:
            for i in range(reentrant):
                self.source.append(out_source[i])
        tsk = self.create_task(name, node, out_source)

    for x in cls.ext_in:
        task_gen.mappings[x] = x_file
    return x_file
开发者ID:spo11,项目名称:archlinux,代码行数:31,代码来源:TaskGen.py


示例9: compile_template

def compile_template(line):
    """
        Compile a template expression into a python function (like jsps, but way shorter)
        """
    extr = []

    def repl(match):
        g = match.group
        if g("dollar"):
            return "$"
        elif g("backslash"):
            return "\\"
        elif g("subst"):
            extr.append(g("code"))
            return "<<|@|>>"
        return None

    line2 = reg_act.sub(repl, line)
    params = line2.split("<<|@|>>")
    assert extr

    indent = 0
    buf = []
    app = buf.append

    def app(txt):
        buf.append(indent * "\t" + txt)

    for x in range(len(extr)):
        if params[x]:
            app("lst.append(%r)" % params[x])

        f = extr[x]
        if f.startswith("if") or f.startswith("for"):
            app(f + ":")
            indent += 1
        elif f.startswith("py:"):
            app(f[3:])
        elif f.startswith("endif") or f.startswith("endfor"):
            indent -= 1
        elif f.startswith("else") or f.startswith("elif"):
            indent -= 1
            app(f + ":")
            indent += 1
        elif f.startswith("xml:"):
            app("lst.append(xml_escape(%s))" % f[4:])
        else:
            # app('lst.append((%s) or "cannot find %s")' % (f, f))
            app("lst.append(%s)" % f)

    if extr:
        if params[-1]:
            app("lst.append(%r)" % params[-1])

    fun = COMPILE_TEMPLATE % "\n\t".join(buf)
    # print(fun)
    return Task.funex(fun)
开发者ID:maksqwe,项目名称:jack2,代码行数:57,代码来源:codelite.py


示例10: compile_template

def compile_template(line):
	"""
	Compile a template expression into a python function (like jsps, but way shorter)
	"""
	extr = []
	def repl(match):
		g = match.group
		if g('dollar'): return "$"
		elif g('backslash'):
			return "\\"
		elif g('subst'):
			extr.append(g('code'))
			return "<<|@|>>"
		return None

	line2 = reg_act.sub(repl, line)
	params = line2.split('<<|@|>>')
	assert(extr)


	indent = 0
	buf = []
	dvars = []
	app = buf.append

	def app(txt):
		buf.append(indent * '\t' + txt)

	for x in range(len(extr)):
		if params[x]:
			app("lst.append(%r)" % params[x])

		f = extr[x]
		if f.startswith('if') or f.startswith('for'):
			app(f + ':')
			indent += 1
		elif f.startswith('py:'):
			app(f[3:])
		elif f.startswith('endif') or f.startswith('endfor'):
			indent -= 1
		elif f.startswith('else') or f.startswith('elif'):
			indent -= 1
			app(f + ':')
			indent += 1
		elif f.startswith('xml:'):
			app('lst.append(xml_escape(%s))' % f[4:])
		else:
			#app('lst.append((%s) or "cannot find %s")' % (f, f))
			app('lst.append(%s)' % f)

	if extr:
		if params[-1]:
			app("lst.append(%r)" % params[-1])

	fun = COMPILE_TEMPLATE % "\n\t".join(buf)
	#print(fun)
	return Task.funex(fun)
开发者ID:GrahamDennis,项目名称:xpdeint,代码行数:57,代码来源:msvs.py


示例11: run

	def run(self):
		run_str = """mkdir -p ${TGT[0].parent.abspath()} && echo '<?xml version="1.0"?>

<Library DMSystem="oaDMFileSys">
    <oaDMFileSys libReadOnly="No"
                 origFileSystem="Unix"/>
</Library>' >> ${TGT[0].abspath()}"""
		(f, dvars) = Task.compile_fun(run_str, False)
		return f(self)
开发者ID:hoangt,项目名称:brick,代码行数:9,代码来源:cadence_base.py


示例12: get_build_iterator

	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 []
开发者ID:jhasse,项目名称:waf,代码行数:43,代码来源:Build.py


示例13: get_build_iterator

	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 []
开发者ID:zsx,项目名称:waf,代码行数:43,代码来源:Build.py


示例14: declare_chain

def declare_chain(name='', rule=None, reentrant=True, color='BLUE',
    ext_in=[], ext_out=[], before=[], after=[], decider=None, scan=None, install_path=None, shell=False):
    """
    Create a new mapping and a task class for processing files by extension.
    See Tools/flex.py for an example.

    :param name: name for the task class
    :type name: string
    :param rule: function to execute or string to be compiled in a function
    :type rule: string or function
    :param reentrant: re-inject the output file in the process
    :type reentrant: bool
    :param color: color for the task output
    :type color: string
    :param ext_in: execute the task only after the files of such extensions are created
    :type ext_in: list of string
    :param ext_out: execute the task only before files of such extensions are processed
    :type ext_out: list of string
    :param before: execute instances of this task before classes of the given names
    :type before: list of string
    :param after: execute instances of this task after classes of the given names
    :type after: list of string
    :param decider: if present, use it to create the output nodes for the task
    :type decider: function
    :param scan: scanner function for the task
    :type scan: function
    :param install_path: installation path for the output nodes
    :type install_path: string
    """
    ext_in = Utils.to_list(ext_in)
    ext_out = Utils.to_list(ext_out)
    if not name:
        name = rule
    cls = Task.task_factory(name, rule, color=color, ext_in=ext_in, ext_out=ext_out, before=before, after=after, scan=scan, shell=shell)

    def x_file(self, node):
        ext = decider and decider(self, node) or cls.ext_out
        if ext_in:
            _ext_in = ext_in[0]
        out_source = [node.change_ext(x, ext_in=_ext_in) for x in ext]
        if reentrant:
            for i in range(reentrant):
                self.source.append(out_source[i])
        tsk = self.create_task(name, node, out_source)
        if install_path:
            self.bld.install_files(install_path, out_source)
        return tsk

    for x in cls.ext_in:
        task_gen.mappings[x] = x_file
    return x_file
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:51,代码来源:TaskGen.py


示例15: process_rule

def process_rule(self):
    if not getattr(self, "rule", None):
        return
    name = str(getattr(self, "name", None) or self.target or self.rule)
    cls = Task.task_factory(
        name,
        self.rule,
        getattr(self, "vars", []),
        shell=getattr(self, "shell", True),
        color=getattr(self, "color", "BLUE"),
    )
    tsk = self.create_task(name)
    if getattr(self, "target", None):
        if isinstance(self.target, str):
            self.target = self.target.split()
        if not isinstance(self.target, list):
            self.target = [self.target]
        for x in self.target:
            if isinstance(x, str):
                tsk.outputs.append(self.path.find_or_declare(x))
            else:
                x.parent.mkdir()
                tsk.outputs.append(x)
        if getattr(self, "install_path", None):
            self.bld.install_files(self.install_path, tsk.outputs)
    if getattr(self, "source", None):
        tsk.inputs = self.to_nodes(self.source)
        self.source = []
    if getattr(self, "scan", None):
        cls.scan = self.scan
    if getattr(self, "cwd", None):
        tsk.cwd = self.cwd
    if getattr(self, "update_outputs", None) or getattr(self, "on_results", None):
        Task.update_outputs(cls)
    if getattr(self, "always", None):
        Task.always_run(cls)
    for x in ["after", "before", "ext_in", "ext_out"]:
        setattr(cls, x, getattr(self, x, []))
开发者ID:spo11,项目名称:archlinux,代码行数:38,代码来源:TaskGen.py


示例16: get_build_iterator

 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 []
开发者ID:asivakum,项目名称:EE563Project,代码行数:23,代码来源:Build.py


示例17: make_pytest

def make_pytest(self):
	"""
	Creates a ``utest`` task with a populated environment for Python if not specified in ``ut_env``:

	- Paths in `pytest_paths` attribute are used to populate PYTHONPATH
	- Paths in `pytest_libpaths` attribute are used to populate the system library path (e.g. LD_LIBRARY_PATH)
	"""
	nodes = self.to_nodes(self.pytest_source)
	tsk = self.create_task('utest', nodes)
	
	tsk.dep_nodes.extend(self.pytest_dep_nodes)
	if getattr(self, 'ut_str', None):
		self.ut_run, lst = Task.compile_fun(self.ut_str, shell=getattr(self, 'ut_shell', False))
		tsk.vars = lst + tsk.vars

	if getattr(self, 'ut_cwd', None):
		if isinstance(self.ut_cwd, str):
			# we want a Node instance
			if os.path.isabs(self.ut_cwd):
				self.ut_cwd = self.bld.root.make_node(self.ut_cwd)
			else:
				self.ut_cwd = self.path.make_node(self.ut_cwd)
	else:
		if tsk.inputs:
			self.ut_cwd = tsk.inputs[0].parent
		else:
			raise Errors.WafError("no valid input files for pytest task, check pytest_source value")

	if not self.ut_cwd.exists():
		self.ut_cwd.mkdir()

	if not hasattr(self, 'ut_env'):
		self.ut_env = dict(os.environ)
		def add_paths(var, lst):
			# Add list of paths to a variable, lst can contain strings or nodes
			lst = [ str(n) for n in lst ]
			Logs.debug("ut: %s: Adding paths %s=%s", self, var, lst)
			self.ut_env[var] = os.pathsep.join(lst) + os.pathsep + self.ut_env.get(var, '')

		# Prepend dependency paths to PYTHONPATH and LD_LIBRARY_PATH
		add_paths('PYTHONPATH', self.pytest_paths)

		if Utils.is_win32:
			add_paths('PATH', self.pytest_libpaths)
		elif Utils.unversioned_sys_platform() == 'darwin':
			add_paths('DYLD_LIBRARY_PATH', self.pytest_libpaths)
			add_paths('LD_LIBRARY_PATH', self.pytest_libpaths)
		else:
			add_paths('LD_LIBRARY_PATH', self.pytest_libpaths)
开发者ID:blablack,项目名称:ams-lv2,代码行数:49,代码来源:pytest.py


示例18: make_test

def make_test(self):
	"""Create the unit test task. There can be only one unit test task by task generator."""
	if not getattr(self, 'link_task', None):
		return

	tsk = self.create_task('utest', self.link_task.outputs)
	if getattr(self, 'ut_str', None):
		self.ut_run, lst = Task.compile_fun(self.ut_str, shell=getattr(self, 'ut_shell', False))
		tsk.vars = lst + tsk.vars

	if getattr(self, 'ut_cwd', None):
		if isinstance(self.ut_cwd, str):
			# we want a Node instance
			if os.path.isabs(self.ut_cwd):
				self.ut_cwd = self.bld.root.make_node(self.ut_cwd)
			else:
				self.ut_cwd = self.path.make_node(self.ut_cwd)
	else:
		self.ut_cwd = tsk.inputs[0].parent

	if not hasattr(self, 'ut_paths'):
		paths = []
		for x in self.tmp_use_sorted:
			try:
				y = self.bld.get_tgen_by_name(x).link_task
			except AttributeError:
				pass
			else:
				if not isinstance(y, ccroot.stlink_task):
					paths.append(y.outputs[0].parent.abspath())
		self.ut_paths = os.pathsep.join(paths) + os.pathsep

	if not hasattr(self, 'ut_env'):
		self.ut_env = dct = dict(os.environ)
		def add_path(var):
			dct[var] = self.ut_paths + dct.get(var,'')
		if Utils.is_win32:
			add_path('PATH')
		elif Utils.unversioned_sys_platform() == 'darwin':
			add_path('DYLD_LIBRARY_PATH')
			add_path('LD_LIBRARY_PATH')
		else:
			add_path('LD_LIBRARY_PATH')
开发者ID:ArduPilot,项目名称:waf,代码行数:43,代码来源:waf_unit_test.py


示例19: declare_chain

def declare_chain(name='', rule=None, reentrant=True, color='BLUE',
	ext_in=[], ext_out=[], before=[], after=[], decider=None, scan=None):
	"""
	see Tools/flex.py for an example
	while i do not like such wrappers, some people really do
	"""

	cls = Task.task_factory(name, rule, color=color, ext_in=ext_in, ext_out=ext_out, before=before, after=after, scan=scan)

	def x_file(self, node):
		ext = decider and decider(self, node) or cls.ext_out
		out_source = [node.change_ext(x) for x in ext]
		if reentrant:
			for i in range(reentrant):
				self.source.append(out_source[i])
		tsk = self.create_task(name, node, out_source)

	for x in cls.ext_in:
		task_gen.mappings[x] = x_file
	return x_file
开发者ID:zsx,项目名称:waf,代码行数:20,代码来源:TaskGen.py


示例20: declare_chain

def declare_chain(name='',rule=None,reentrant=True,color='BLUE',ext_in=[],ext_out=[],before=[],after=[],decider=None,scan=None,install_path=None,shell=False):
	ext_in=Utils.to_list(ext_in)
	ext_out=Utils.to_list(ext_out)
	if not name:
		name=rule
	cls=Task.task_factory(name,rule,color=color,ext_in=ext_in,ext_out=ext_out,before=before,after=after,scan=scan,shell=shell)
	def x_file(self,node):
		ext=decider and decider(self,node)or cls.ext_out
		if ext_in:
			_ext_in=ext_in[0]
		out_source=[node.change_ext(x,ext_in=_ext_in)for x in ext]
		if reentrant:
			for i in range(reentrant):
				self.source.append(out_source[i])
		tsk=self.create_task(name,node,out_source)
		if install_path:
			self.bld.install_files(install_path,out_source)
		return tsk
	for x in cls.ext_in:
		task_gen.mappings[x]=x_file
	return x_file
开发者ID:AKASeon,项目名称:Whatever,代码行数:21,代码来源:TaskGen.py



注:本文中的waflib.Task类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python waflib.TaskGen类代码示例发布时间:2022-05-26
下一篇:
Python waflib.Logs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap