当前位置: 首页>>代码示例>>Python>>正文


Python Task.always_run方法代码示例

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


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

示例1: process_rule

# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import always_run [as 别名]
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,代码行数:34,代码来源:TaskGen.py

示例2: process_rule

# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import always_run [as 别名]
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,代码行数:61,代码来源:TaskGen.py

示例3: process_rule

# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import always_run [as 别名]
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,代码行数:58,代码来源:TaskGen.py

示例4: process_rule

# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import always_run [as 别名]
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,代码行数:40,代码来源:TaskGen.py

示例5: process_rule

# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import always_run [as 别名]
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)

	# or we can put the class in a cache for performance reasons
	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

	# 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, 'cwd', None):
		tsk.cwd = self.cwd
开发者ID:jcnoir,项目名称:waf,代码行数:84,代码来源:TaskGen.py

示例6: print

# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import always_run [as 别名]
                    cmd,
                    cwd=self.env.GBENCHMARK_BUILD,
                    quiet=Context.BOTH,
                )
            return 0
        except WafError as e:
            print(e)
            if hasattr(e, 'stderr'):
                print('')
                print(e.stderr)
            return 1

    def __str__(self):
        return 'Google Benchmark'

gbenchmark_build = Task.always_run(Task.update_outputs(gbenchmark_build))

build_task = None

@feature('gbenchmark')
@before_method('process_use')
def append_gbenchmark_use(self):
    self.use = self.to_list(getattr(self, 'use', []))
    if 'GBENCHMARK' not in self.use:
        self.use.append('GBENCHMARK')

@feature('gbenchmark')
@after_method('process_source')
def wait_for_gbenchmark_build(self):
    global build_task
开发者ID:brunoChr,项目名称:URUS8,代码行数:32,代码来源:gbenchmark.py

示例7: __str__

# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import always_run [as 别名]
    def __str__(self):
        config_name = self.generator.config_taskgen.name
        target = self.generator.cmake_target
        return '%s %s' % (config_name, target)

    def keyword(self):
        return 'CMake Build'

# allow tasks to depend on possible headers or other resources if the user
# declares outputs for the cmake build
cmake_build_task = Task.update_outputs(cmake_build_task)

# the cmake-generated build system is responsible of managing its own
# dependencies
cmake_build_task = Task.always_run(cmake_build_task)

@feature('cmake_configure')
def process_cmake_configure(self):
    if not hasattr(self, 'name'):
        self.bld.fatal('cmake_configure: taskgen is missing name')
    if not hasattr(self, 'cmake_src'):
        self.bld.fatal('cmake_configure: taskgen is missing cmake_src')

    if not isinstance(self.cmake_src, Node.Node):
        self.cmake_src = self.bld.path.find_dir(self.cmake_src)

    if not hasattr(self, 'cmake_bld'):
        self.cmake_bld = self.cmake_src.get_bld()
    elif not isinstance(self.cmake_bld, Node.Node):
        self.cmake_bld = self.bld.bldnode.make_node(self.cmake_bld)
开发者ID:3drobotics,项目名称:ardupilot-solo-rebase,代码行数:32,代码来源:cmake.py

示例8: process_rule

# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import always_run [as 别名]
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 getattr(self.rule, "__name__", self.rule))

    # or we can put the class in a cache for performance reasons
    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

            # 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):
            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, "cwd", None):
        tsk.cwd = self.cwd
开发者ID:maksqwe,项目名称:jack2,代码行数:87,代码来源:TaskGen.py

示例9: process_rule

# 需要导入模块: from waflib import Task [as 别名]
# 或者: from waflib.Task import always_run [as 别名]
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
    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:couchjd,项目名称:playground,代码行数:66,代码来源:TaskGen.py


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