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


Python TaskGen.feature方法代码示例

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


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

示例1: enhance_lib

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
def enhance_lib():
	"""
	modify existing classes and methods
	"""
	for m in meths_typos:
		replace(m)

	# catch '..' in ant_glob patterns
	old_ant_glob = Node.Node.ant_glob
	def ant_glob(self, *k, **kw):
		for x in k[0].split('/'):
			if x == '..':
				Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" % k[0])
		return old_ant_glob(self, *k, **kw)
	Node.Node.ant_glob = ant_glob

	# catch conflicting ext_in/ext_out/before/after declarations
	old = Task.is_before
	def is_before(t1, t2):
		ret = old(t1, t2)
		if ret and old(t2, t1):
			Logs.error('Contradictory order constraints in classes %r %r' % (t1, t2))
		return ret
	Task.is_before = is_before

	# check for bld(feature='cshlib') where no 'c' is given - this can be either a mistake or on purpose
	# so we only issue a warning
	def check_err_features(self):
		lst = self.to_list(self.features)
		if 'shlib' in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in ('c', 'cxx', 'd', 'fc'):
			if not x in lst and lst and lst[0] in [x+y for y in ('program', 'shlib', 'stlib')]:
				Logs.error('%r features is probably missing %r' % (self, x))
	TaskGen.feature('*')(check_err_features)
开发者ID:SjB,项目名称:waf,代码行数:37,代码来源:errcheck.py

示例2: enhance_lib

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
def enhance_lib():
	for m in meths_typos:
		replace(m)
	old_ant_glob=Node.Node.ant_glob
	def ant_glob(self,*k,**kw):
		for x in k[0].split('/'):
			if x=='..':
				Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'"%k[0])
		return old_ant_glob(self,*k,**kw)
	Node.Node.ant_glob=ant_glob
	old=Task.is_before
	def is_before(t1,t2):
		ret=old(t1,t2)
		if ret and old(t2,t1):
			Logs.error('Contradictory order constraints in classes %r %r'%(t1,t2))
		return ret
	Task.is_before=is_before
	def check_err_features(self):
		lst=self.to_list(self.features)
		if'shlib'in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in('c','cxx','d','fc'):
			if not x in lst and lst and lst[0]in[x+y for y in('program','shlib','stlib')]:
				Logs.error('%r features is probably missing %r'%(self,x))
	TaskGen.feature('*')(check_err_features)
开发者ID:RunarFreyr,项目名称:waz,代码行数:27,代码来源:errcheck.py

示例3: enhance_lib

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
def enhance_lib():
	for m in meths_typos:
		replace(m)
	old_ant_glob=Node.Node.ant_glob
	def ant_glob(self,*k,**kw):
		if k:
			lst=Utils.to_list(k[0])
			for pat in lst:
				if'..'in pat.split('/'):
					Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'"%k[0])
		return old_ant_glob(self,*k,**kw)
	Node.Node.ant_glob=ant_glob
	old=Task.is_before
	def is_before(t1,t2):
		ret=old(t1,t2)
		if ret and old(t2,t1):
			Logs.error('Contradictory order constraints in classes %r %r'%(t1,t2))
		return ret
	Task.is_before=is_before
	def check_err_features(self):
		lst=self.to_list(self.features)
		if'shlib'in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in('c','cxx','d','fc'):
			if not x in lst and lst and lst[0]in[x+y for y in('program','shlib','stlib')]:
				Logs.error('%r features is probably missing %r'%(self,x))
	TaskGen.feature('*')(check_err_features)
	def check_err_order(self):
		if not hasattr(self,'rule'):
			for x in('before','after','ext_in','ext_out'):
				if hasattr(self,x):
					Logs.warn('Erroneous order constraint %r on non-rule based task generator %r'%(x,self))
		else:
			for x in('before','after'):
				for y in self.to_list(getattr(self,x,[])):
					if not Task.classes.get(y,None):
						Logs.error('Erroneous order constraint %s=%r on %r'%(x,y,self))
	TaskGen.feature('*')(check_err_order)
	old_compile=Build.BuildContext.compile
	def check_compile(self):
		check_invalid_constraints(self)
		try:
			ret=old_compile(self)
		finally:
			check_same_targets(self)
		return ret
	Build.BuildContext.compile=check_compile
	def getattri(self,name,default=None):
		if name=='append'or name=='add':
			raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique')
		elif name=='prepend':
			raise Errors.WafError('env.prepend does not exist: use env.prepend_value')
		if name in self.__slots__:
			return object.__getattr__(self,name,default)
		else:
			return self[name]
	ConfigSet.ConfigSet.__getattr__=getattri
开发者ID:AKASeon,项目名称:Whatever,代码行数:59,代码来源:errcheck.py

示例4: enhance_lib

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
def enhance_lib():
	"""
	modify existing classes and methods
	"""
	for m in meths_typos:
		replace(m)

	# catch '..' in ant_glob patterns
	old_ant_glob = Node.Node.ant_glob
	def ant_glob(self, *k, **kw):
		for x in k[0].split('/'):
			if x == '..':
				Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" % k[0])
		return old_ant_glob(self, *k, **kw)
	Node.Node.ant_glob = ant_glob

	# catch conflicting ext_in/ext_out/before/after declarations
	old = Task.is_before
	def is_before(t1, t2):
		ret = old(t1, t2)
		if ret and old(t2, t1):
			Logs.error('Contradictory order constraints in classes %r %r' % (t1, t2))
		return ret
	Task.is_before = is_before

	# check for bld(feature='cshlib') where no 'c' is given - this can be either a mistake or on purpose
	# so we only issue a warning
	def check_err_features(self):
		lst = self.to_list(self.features)
		if 'shlib' in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in ('c', 'cxx', 'd', 'fc'):
			if not x in lst and lst and lst[0] in [x+y for y in ('program', 'shlib', 'stlib')]:
				Logs.error('%r features is probably missing %r' % (self, x))
	TaskGen.feature('*')(check_err_features)

	# check for @extension used with @feature/@before/@after
	old_compile = Build.BuildContext.compile
	def check_compile(self):
		feat = set([])
		for x in list(TaskGen.feats.values()):
			feat.union(set(x))
		for (x, y) in TaskGen.task_gen.prec.items():
			feat.add(x)
			feat.union(set(y))
		ext = set([])
		for x in TaskGen.task_gen.mappings.values():
			ext.add(x.__name__)
		invalid = ext & feat
		if invalid:
			Logs.error('The methods %r have invalid annotations:  @extension <-> @feature/@before/@after' % list(invalid))

		return old_compile(self)
	Build.BuildContext.compile = check_compile
开发者ID:ita1024,项目名称:node,代码行数:56,代码来源:errcheck.py

示例5: enhance_lib

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
def enhance_lib():
	for m in meths_typos:
		replace(m)
	old_ant_glob=Node.Node.ant_glob
	def ant_glob(self,*k,**kw):
		if k:
			for x in k[0].split('/'):
				if x=='..':
					Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'"%k[0])
		return old_ant_glob(self,*k,**kw)
	Node.Node.ant_glob=ant_glob
	old=Task.is_before
	def is_before(t1,t2):
		ret=old(t1,t2)
		if ret and old(t2,t1):
			Logs.error('Contradictory order constraints in classes %r %r'%(t1,t2))
		return ret
	Task.is_before=is_before
	def check_err_features(self):
		lst=self.to_list(self.features)
		if'shlib'in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in('c','cxx','d','fc'):
			if not x in lst and lst and lst[0]in[x+y for y in('program','shlib','stlib')]:
				Logs.error('%r features is probably missing %r'%(self,x))
	TaskGen.feature('*')(check_err_features)
	old_compile=Build.BuildContext.compile
	def check_compile(self):
		feat=set([])
		for x in list(TaskGen.feats.values()):
			feat.union(set(x))
		for(x,y)in TaskGen.task_gen.prec.items():
			feat.add(x)
			feat.union(set(y))
		ext=set([])
		for x in TaskGen.task_gen.mappings.values():
			ext.add(x.__name__)
		invalid=ext&feat
		if invalid:
			Logs.error('The methods %r have invalid annotations:  @extension <-> @feature/@before/@after'%list(invalid))
		return old_compile(self)
	Build.BuildContext.compile=check_compile
	def getattr(self,name):
		if name=='append'or name=='add':
			raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique')
		elif name=='prepend':
			raise Errors.WafError('env.prepend does not exist: use env.prepend_value')
		if name in self.__slots__:
			return object.__getattr__(self,name)
		else:
			return self[name]
	ConfigSet.ConfigSet.__getattr__=getattr
开发者ID:spo11,项目名称:archlinux,代码行数:54,代码来源:errcheck.py

示例6: enhance_lib

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
def enhance_lib():
	"""
	modify existing classes and methods
	"""
	for m in meths_typos:
		replace(m)

	# catch '..' in ant_glob patterns
	def ant_glob(self, *k, **kw):
		if k:
			lst=Utils.to_list(k[0])
			for pat in lst:
				if '..' in pat.split('/'):
					Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" % k[0])
		if kw.get('remove', True):
			try:
				if self.is_child_of(self.ctx.bldnode) and not kw.get('quiet', False):
					Logs.error('Using ant_glob on the build folder (%r) is dangerous (quiet=True to disable this warning)' % self)
			except AttributeError:
				pass
		return self.old_ant_glob(*k, **kw)
	Node.Node.old_ant_glob = Node.Node.ant_glob
	Node.Node.ant_glob = ant_glob

	# catch conflicting ext_in/ext_out/before/after declarations
	old = Task.is_before
	def is_before(t1, t2):
		ret = old(t1, t2)
		if ret and old(t2, t1):
			Logs.error('Contradictory order constraints in classes %r %r' % (t1, t2))
		return ret
	Task.is_before = is_before

	# check for bld(feature='cshlib') where no 'c' is given - this can be either a mistake or on purpose
	# so we only issue a warning
	def check_err_features(self):
		lst = self.to_list(self.features)
		if 'shlib' in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in ('c', 'cxx', 'd', 'fc'):
			if not x in lst and lst and lst[0] in [x+y for y in ('program', 'shlib', 'stlib')]:
				Logs.error('%r features is probably missing %r' % (self, x))
	TaskGen.feature('*')(check_err_features)

	# check for erroneous order constraints
	def check_err_order(self):
		if not hasattr(self, 'rule') and not 'subst' in Utils.to_list(self.features):
			for x in ('before', 'after', 'ext_in', 'ext_out'):
				if hasattr(self, x):
					Logs.warn('Erroneous order constraint %r on non-rule based task generator %r' % (x, self))
		else:
			for x in ('before', 'after'):
				for y in self.to_list(getattr(self, x, [])):
					if not Task.classes.get(y, None):
						Logs.error('Erroneous order constraint %s=%r on %r (no such class)' % (x, y, self))
	TaskGen.feature('*')(check_err_order)

	# check for @extension used with @feature/@before_method/@after_method
	def check_compile(self):
		check_invalid_constraints(self)
		try:
			ret = self.orig_compile()
		finally:
			check_same_targets(self)
		return ret
	Build.BuildContext.orig_compile = Build.BuildContext.compile
	Build.BuildContext.compile = check_compile

	# check for invalid build groups #914
	def use_rec(self, name, **kw):
		try:
			y = self.bld.get_tgen_by_name(name)
		except Errors.WafError:
			pass
		else:
			idx = self.bld.get_group_idx(self)
			odx = self.bld.get_group_idx(y)
			if odx > idx:
				msg = "Invalid 'use' across build groups:"
				if Logs.verbose > 1:
					msg += '\n  target %r\n  uses:\n  %r' % (self, y)
				else:
					msg += " %r uses %r (try 'waf -v -v' for the full error)" % (self.name, name)
				raise Errors.WafError(msg)
		self.orig_use_rec(name, **kw)
	TaskGen.task_gen.orig_use_rec = TaskGen.task_gen.use_rec
	TaskGen.task_gen.use_rec = use_rec

	# check for env.append
	def getattri(self, name, default=None):
		if name == 'append' or name == 'add':
			raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique')
		elif name == 'prepend':
			raise Errors.WafError('env.prepend does not exist: use env.prepend_value')
		if name in self.__slots__:
			return object.__getattr__(self, name, default)
		else:
			return self[name]
	ConfigSet.ConfigSet.__getattr__ = getattri
开发者ID:Jajcus,项目名称:jack2,代码行数:101,代码来源:errcheck.py

示例7: init_lua

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
#! /usr/bin/env python
# encoding: utf-8
# WARNING! All changes made to this file will be lost!

from waflib import TaskGen,Utils
TaskGen.declare_chain(name='luac',rule='${LUAC} -s -o ${TGT} ${SRC}',ext_in='.lua',ext_out='.luac',reentrant=False)
def init_lua(self):
	self.default_chmod=Utils.O755
def configure(conf):
	conf.find_program('luac',var='LUAC')

TaskGen.feature('lua')(init_lua)
开发者ID:RunarFreyr,项目名称:waz,代码行数:14,代码来源:lua.py

示例8: set_def

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
		set_def('GO_PLATFORM', platform.machine())

	if conf.env.GO_PLATFORM == 'x86_64':
		set_def('GO_COMPILER', '6g')
		set_def('GO_LINKER', '6l')
	elif conf.env.GO_PLATFORM in ('i386', 'i486', 'i586', 'i686'):
		set_def('GO_COMPILER', '8g')
		set_def('GO_LINKER', '8l')
	elif conf.env.GO_PLATFORM == 'arm':
		set_def('GO_COMPILER', '5g')
		set_def('GO_LINKER', '5l')
		set_def('GO_EXTENSION', '.5')

	if not (conf.env.GO_COMPILER or conf.env.GO_LINKER):
		raise conf.fatal('Unsupported platform ' + platform.machine())

	set_def('GO_PACK', 'gopack')
	set_def('gopackage_PATTERN', '%s.a')
	set_def('CPPPATH_ST', '-I%s')

	set_def('GOMAKE_FLAGS', ['--quiet'])
	conf.find_program(conf.env.GO_COMPILER, var='GOC')
	conf.find_program(conf.env.GO_LINKER,   var='GOL')
	conf.find_program(conf.env.GO_PACK,     var='GOP')

	conf.find_program('cgo',                var='CGO')

TaskGen.feature('go')(process_use)
TaskGen.feature('go')(propagate_uselib_vars)

开发者ID:DigitalDan05,项目名称:waf,代码行数:31,代码来源:go.py

示例9: add_obj_file

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
		self.link_task.inputs.append(node)
def add_obj_file(self,file):
	if not hasattr(self,'obj_files'):self.obj_files=[]
	if not'process_obj_files'in self.meths:self.meths.append('process_obj_files')
	self.obj_files.append(file)
old_define=Configure.ConfigurationContext.__dict__['define']
def define(self,key,val,quote=True):
	old_define(self,key,val,quote)
	if key.startswith('HAVE_'):
		self.env[key]=1
old_undefine=Configure.ConfigurationContext.__dict__['undefine']
def undefine(self,key):
	old_undefine(self,key)
	if key.startswith('HAVE_'):
		self.env[key]=0
def set_incdirs(self,val):
	Logs.warn('compat: change "export_incdirs" by "export_includes"')
	self.export_includes=val
TaskGen.task_gen.export_incdirs=property(None,set_incdirs)

TaskGen.feature('d')(old_importpaths)
TaskGen.before('apply_incpaths')(old_importpaths)
TaskGen.feature('c','cxx','d')(apply_uselib_local)
TaskGen.before('apply_incpaths','propagate_uselib_vars')(apply_uselib_local)
TaskGen.after('apply_link','process_source')(apply_uselib_local)
TaskGen.feature('cprogram','cxxprogram','cstlib','cxxstlib','cshlib','cxxshlib','dprogram','dstlib','dshlib')(apply_objdeps)
TaskGen.after('apply_link')(apply_objdeps)
TaskGen.after('apply_link')(process_obj_files)
TaskGen.taskgen_method(add_obj_file)
Configure.conf(define)
Configure.conf(undefine)
开发者ID:HariKishan8,项目名称:Networks,代码行数:33,代码来源:compat15.py

示例10: deco

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
	def deco(func):
		exclude_taskgen.append(func.__name__)
		setattr(task_gen, func.__name__, func)
		for fun_name in k:
			if not fun_name in task_gen.prec[func.__name__]:
				task_gen.prec[func.__name__].append(fun_name)
		fix_fun_doc(func)
		append_doc(func, 'after', k)
		return func
	return deco
after.__doc__ = TaskGen.after.__doc__
TaskGen.after = after

# replay existing methods
TaskGen.taskgen_method(TaskGen.to_nodes)
TaskGen.feature('*')(TaskGen.process_source)
TaskGen.feature('*')(TaskGen.process_rule)
TaskGen.before('process_source')(TaskGen.process_rule)
TaskGen.feature('seq')(TaskGen.sequence_order)
TaskGen.extension('.pc.in')(TaskGen.add_pcfile)
TaskGen.feature('subst')(TaskGen.process_subst)
TaskGen.before('process_source','process_rule')(TaskGen.process_subst)

from waflib.Task import Task

Task.__dict__['post_run'].__doc__ = "Update the cache files (executed by threads). Override in subclasses."


from waflib import Configure, Build, Errors
confmeths = []
def conf(f):
开发者ID:kenmasumitsu,项目名称:waf,代码行数:33,代码来源:conf.py

示例11: FyppPreprocError

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
                except fypp.FyppError as err:
                        msg = ("%s [%s:%d]"
                               % (err.msg, err.fname, err.span[0] + 1))
                        raise FyppPreprocError(msg)
		return 0

	def scan(self):
		parser = FyppIncludeParser(self.generator.includes_nodes)
		nodes, names = parser.parse(self.inputs[0])
		if Logs.verbose:
			Logs.debug('deps: deps for %r: %r; unresolved: %r' 
				% (self.inputs, nodes, names))
		return (nodes, names)


TaskGen.feature('fypp')(Tools.ccroot.propagate_uselib_vars)
TaskGen.feature('fypp')(Tools.ccroot.apply_incpaths)



################################################################################
# Helper routines
################################################################################

class FyppIncludeParser(object):

	'''Parser for include directives in files preprocessed by Fypp.

	It can not handle conditional includes.
	'''
开发者ID:pseewald,项目名称:cp2k,代码行数:32,代码来源:fypp_preprocessor.py

示例12: enhance_lib

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
def enhance_lib():
    for m in meths_typos:
        replace(m)

    def ant_glob(self, *k, **kw):
        if k:
            lst = Utils.to_list(k[0])
            for pat in lst:
                if ".." in pat.split("/"):
                    Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" % k[0])
        if kw.get("remove", True):
            try:
                if self.is_child_of(self.ctx.bldnode) and not kw.get("quiet", False):
                    Logs.error(
                        "Using ant_glob on the build folder (%r) is dangerous (quiet=True to disable this warning)"
                        % self
                    )
            except AttributeError:
                pass
        return self.old_ant_glob(*k, **kw)

    Node.Node.old_ant_glob = Node.Node.ant_glob
    Node.Node.ant_glob = ant_glob
    old = Task.is_before

    def is_before(t1, t2):
        ret = old(t1, t2)
        if ret and old(t2, t1):
            Logs.error("Contradictory order constraints in classes %r %r" % (t1, t2))
        return ret

    Task.is_before = is_before

    def check_err_features(self):
        lst = self.to_list(self.features)
        if "shlib" in lst:
            Logs.error("feature shlib -> cshlib, dshlib or cxxshlib")
        for x in ("c", "cxx", "d", "fc"):
            if not x in lst and lst and lst[0] in [x + y for y in ("program", "shlib", "stlib")]:
                Logs.error("%r features is probably missing %r" % (self, x))

    TaskGen.feature("*")(check_err_features)

    def check_err_order(self):
        if not hasattr(self, "rule"):
            for x in ("before", "after", "ext_in", "ext_out"):
                if hasattr(self, x):
                    Logs.warn("Erroneous order constraint %r on non-rule based task generator %r" % (x, self))
        else:
            for x in ("before", "after"):
                for y in self.to_list(getattr(self, x, [])):
                    if not Task.classes.get(y, None):
                        Logs.error("Erroneous order constraint %s=%r on %r" % (x, y, self))

    TaskGen.feature("*")(check_err_order)

    def check_compile(self):
        check_invalid_constraints(self)
        try:
            ret = self.orig_compile()
        finally:
            check_same_targets(self)
        return ret

    Build.BuildContext.orig_compile = Build.BuildContext.compile
    Build.BuildContext.compile = check_compile

    def use_rec(self, name, **kw):
        try:
            y = self.bld.get_tgen_by_name(name)
        except Errors.WafError:
            pass
        else:
            idx = self.bld.get_group_idx(self)
            odx = self.bld.get_group_idx(y)
            if odx > idx:
                msg = "Invalid 'use' across build groups:"
                if Logs.verbose > 1:
                    msg += "\n  target %r\n  uses:\n  %r" % (self, y)
                else:
                    msg += " %r uses %r (try 'waf -v -v' for the full error)" % (self.name, name)
                raise Errors.WafError(msg)
        self.orig_use_rec(name, **kw)

    TaskGen.task_gen.orig_use_rec = TaskGen.task_gen.use_rec
    TaskGen.task_gen.use_rec = use_rec

    def getattri(self, name, default=None):
        if name == "append" or name == "add":
            raise Errors.WafError("env.append and env.add do not exist: use env.append_value/env.append_unique")
        elif name == "prepend":
            raise Errors.WafError("env.prepend does not exist: use env.prepend_value")
        if name in self.__slots__:
            return object.__getattr__(self, name, default)
        else:
            return self[name]

    ConfigSet.ConfigSet.__getattr__ = getattri
开发者ID:mirsys,项目名称:glmark2,代码行数:100,代码来源:errcheck.py

示例13: undefine

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
old_undefine = Configure.ConfigurationContext.__dict__["undefine"]


def undefine(self, key):
    old_undefine(self, key)
    if key.startswith("HAVE_"):
        self.env[key] = 0


def set_incdirs(self, val):
    Logs.warn('compat: change "export_incdirs" by "export_includes"')
    self.export_includes = val


TaskGen.task_gen.export_incdirs = property(None, set_incdirs)

TaskGen.feature("d")(old_importpaths)
TaskGen.before("apply_incpaths")(old_importpaths)
TaskGen.feature("c", "cxx", "d")(apply_uselib_local)
TaskGen.before("apply_incpaths", "propagate_uselib_vars")(apply_uselib_local)
TaskGen.after("apply_link", "process_source")(apply_uselib_local)
TaskGen.feature("cprogram", "cxxprogram", "cstlib", "cxxstlib", "cshlib", "cxxshlib", "dprogram", "dstlib", "dshlib")(
    apply_objdeps
)
TaskGen.after("apply_link")(apply_objdeps)
TaskGen.after("apply_link")(process_obj_files)
TaskGen.taskgen_method(add_obj_file)
Configure.conf(define)
Configure.conf(undefine)
开发者ID:RunarFreyr,项目名称:waz,代码行数:31,代码来源:compat15.py

示例14: fix_fun_doc

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
        for fun_name in k:
            if not fun_name in task_gen.prec[func.__name__]:
                task_gen.prec[func.__name__].append(fun_name)
        fix_fun_doc(func)
        append_doc(func, "after", k)
        return func

    return deco


after.__doc__ = TaskGen.after.__doc__
TaskGen.after = after

# replay existing methods
TaskGen.taskgen_method(TaskGen.to_nodes)
TaskGen.feature("*")(TaskGen.process_source)
TaskGen.feature("*")(TaskGen.process_rule)
TaskGen.before("process_source")(TaskGen.process_rule)
TaskGen.feature("seq")(TaskGen.sequence_order)
TaskGen.extension(".pc.in")(TaskGen.add_pcfile)
TaskGen.feature("subst")(TaskGen.process_subst)
TaskGen.before("process_source", "process_rule")(TaskGen.process_subst)

from waflib.Task import Task

Task.__dict__["post_run"].__doc__ = "Update the cache files (executed by threads). Override in subclasses."


from waflib import Configure, Build

confmeths = []
开发者ID:yotann,项目名称:waf,代码行数:33,代码来源:conf.py

示例15: enhance_lib

# 需要导入模块: from waflib import TaskGen [as 别名]
# 或者: from waflib.TaskGen import feature [as 别名]
def enhance_lib():
	"""
	modify existing classes and methods
	"""
	for m in meths_typos:
		replace(m)

	# catch '..' in ant_glob patterns
	old_ant_glob = Node.Node.ant_glob
	def ant_glob(self, *k, **kw):
		if k:
			for x in k[0].split('/'):
				if x == '..':
					Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" % k[0])
		return old_ant_glob(self, *k, **kw)
	Node.Node.ant_glob = ant_glob

	# catch conflicting ext_in/ext_out/before/after declarations
	old = Task.is_before
	def is_before(t1, t2):
		ret = old(t1, t2)
		if ret and old(t2, t1):
			Logs.error('Contradictory order constraints in classes %r %r' % (t1, t2))
		return ret
	Task.is_before = is_before

	# check for bld(feature='cshlib') where no 'c' is given - this can be either a mistake or on purpose
	# so we only issue a warning
	def check_err_features(self):
		lst = self.to_list(self.features)
		if 'shlib' in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in ('c', 'cxx', 'd', 'fc'):
			if not x in lst and lst and lst[0] in [x+y for y in ('program', 'shlib', 'stlib')]:
				Logs.error('%r features is probably missing %r' % (self, x))
	TaskGen.feature('*')(check_err_features)

	# check for erroneous order constraints
	def check_err_order(self):
		if not hasattr(self, 'rule'):
			for x in ('before', 'after', 'ext_in', 'ext_out'):
				if hasattr(self, x):
					Logs.warn('Erroneous order constraint %r on non-rule based task generator %r' % (x, self))
		else:
			for x in ('before', 'after'):
				for y in self.to_list(getattr(self, x, [])):
					if not Task.classes.get(y, None):
						Logs.error('Erroneous order constraint %s=%r on %r' % (x, y, self))
	TaskGen.feature('*')(check_err_order)

	# check for @extension used with @feature/@before_method/@after_method
	old_compile = Build.BuildContext.compile
	def check_compile(self):
		feat = set([])
		for x in list(TaskGen.feats.values()):
			feat.union(set(x))
		for (x, y) in TaskGen.task_gen.prec.items():
			feat.add(x)
			feat.union(set(y))
		ext = set([])
		for x in TaskGen.task_gen.mappings.values():
			ext.add(x.__name__)
		invalid = ext & feat
		if invalid:
			Logs.error('The methods %r have invalid annotations:  @extension <-> @feature/@before_method/@after_method' % list(invalid))

		# the build scripts have been read, so we can check for invalid after/before attributes on task classes
		for cls in list(Task.classes.values()):
			for x in ('before', 'after'):
				for y in Utils.to_list(getattr(cls, x, [])):
					if not Task.classes.get(y, None):
						Logs.error('Erroneous order constraint %r=%r on task class %r' % (x, y, cls.__name__))

		return old_compile(self)
	Build.BuildContext.compile = check_compile

	# check for env.append
	def getattri(self, name, default=None):
		if name == 'append' or name == 'add':
			raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique')
		elif name == 'prepend':
			raise Errors.WafError('env.prepend does not exist: use env.prepend_value')
		if name in self.__slots__:
			return object.__getattr__(self, name, default)
		else:
			return self[name]
	ConfigSet.ConfigSet.__getattr__ = getattri
开发者ID:jrossi,项目名称:waf,代码行数:89,代码来源:errcheck.py


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