本文整理汇总了Python中waflib.Utils.def_attrs方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.def_attrs方法的具体用法?Python Utils.def_attrs怎么用?Python Utils.def_attrs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Utils
的用法示例。
在下文中一共展示了Utils.def_attrs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_copy
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_copy(self):
Utils.def_attrs(self, fun=copy_func)
self.default_install_path = 0
lst = self.to_list(self.source)
self.meths.remove('process_source')
for filename in lst:
node = self.path.find_resource(filename)
if not node: raise Errors.WafError('cannot find input file %s for processing' % filename)
target = self.target
if not target or len(lst)>1: target = node.name
# TODO the file path may be incorrect
newnode = self.path.find_or_declare(target)
tsk = self.create_task('copy', node, newnode)
tsk.fun = self.fun
tsk.chmod = getattr(self, 'chmod', Utils.O644)
if not tsk.env:
tsk.debug()
raise Errors.WafError('task without an environment')
示例2: init_ml
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def init_ml(self):
Utils.def_attrs(self,
type = 'all',
incpaths_lst = [],
bld_incpaths_lst = [],
mlltasks = [],
mlytasks = [],
mlitasks = [],
native_tasks = [],
bytecode_tasks = [],
linktasks = [],
bytecode_env = None,
native_env = None,
compiled_tasks = [],
includes = '',
uselib = '',
are_deps_set = 0)
示例3: apply_subst
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_subst(self):
Utils.def_attrs(self, fun=subst_func)
lst = self.to_list(self.source)
self.meths.remove('process_source')
self.dict = getattr(self, 'dict', {})
for filename in lst:
node = self.path.find_resource(filename)
if not node: raise Errors.WafError('cannot find input file %s for processing' % filename)
if self.target:
newnode = self.path.find_or_declare(self.target)
else:
newnode = node.change_ext('')
try:
self.dict = self.dict.get_merged_dict()
except AttributeError:
pass
if self.dict and not self.env['DICT_HASH']:
self.env = self.env.derive()
keys = list(self.dict.keys())
keys.sort()
lst = [self.dict[x] for x in keys]
self.env['DICT_HASH'] = str(Utils.h_list(lst))
tsk = self.create_task('copy', node, newnode)
tsk.fun = self.fun
tsk.dict = self.dict
tsk.dep_vars = ['DICT_HASH']
tsk.chmod = getattr(self, 'chmod', Utils.O644)
if not tsk.env:
tsk.debug()
raise Errors.WafError('task without an environment')
####################
## command-output ####
####################
示例4: init_cmd_output
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def init_cmd_output(self):
Utils.def_attrs(self,
stdin = None,
stdout = None,
stderr = None,
# the command to execute
command = None,
# whether it is an external command; otherwise it is assumed
# to be an executable binary or script that lives in the
# source or build tree.
command_is_external = False,
# extra parameters (argv) to pass to the command (excluding
# the command itself)
argv = [],
# dependencies to other objects -> this is probably not what you want (ita)
# values must be 'task_gen' instances (not names!)
dependencies = [],
# dependencies on env variable contents
dep_vars = [],
# input files that are implicit, i.e. they are not
# stdin, nor are they mentioned explicitly in argv
hidden_inputs = [],
# output files that are implicit, i.e. they are not
# stdout, nor are they mentioned explicitly in argv
hidden_outputs = [],
# change the subprocess to this cwd (must use obj.input_dir() or output_dir() here)
cwd = None,
# OS environment variables to pass to the subprocess
# if None, use the default environment variables unchanged
os_env = None)
示例5: init_command
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def init_command(self):
Utils.def_attrs(self,
# other variables that can be used in the command: ${VARIABLE}
variables = None,
rule='')
示例6: apply_java
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_java(self):
Utils.def_attrs(self,jarname='',classpath='',sourcepath='.',srcdir='.',jar_mf_attributes={},jar_mf_classpath=[])
nodes_lst=[]
outdir=getattr(self,'outdir',None)
if outdir:
if not isinstance(outdir,Node.Node):
outdir=self.path.get_bld().make_node(self.outdir)
else:
outdir=self.path.get_bld()
outdir.mkdir()
self.outdir=outdir
self.env['OUTDIR']=outdir.abspath()
self.javac_task=tsk=self.create_task('javac')
tmp=[]
srcdir=getattr(self,'srcdir','')
if isinstance(srcdir,Node.Node):
srcdir=[srcdir]
for x in Utils.to_list(srcdir):
if isinstance(x,Node.Node):
y=x
else:
y=self.path.find_dir(x)
if not y:
self.bld.fatal('Could not find the folder %s from %s'%(x,self.path))
tmp.append(y)
tsk.srcdir=tmp
if getattr(self,'compat',None):
tsk.env.append_value('JAVACFLAGS',['-source',self.compat])
if hasattr(self,'sourcepath'):
fold=[isinstance(x,Node.Node)and x or self.path.find_dir(x)for x in self.to_list(self.sourcepath)]
names=os.pathsep.join([x.srcpath()for x in fold])
else:
names=[x.srcpath()for x in tsk.srcdir]
if names:
tsk.env.append_value('JAVACFLAGS',['-sourcepath',names])
示例7: apply_java
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_java(self):
Utils.def_attrs(self,jarname='',classpath='',sourcepath='.',srcdir='.',jar_mf_attributes={},jar_mf_classpath=[])
outdir=getattr(self,'outdir',None)
if outdir:
if not isinstance(outdir,Node.Node):
outdir=self.path.get_bld().make_node(self.outdir)
else:
outdir=self.path.get_bld()
outdir.mkdir()
self.outdir=outdir
self.env['OUTDIR']=outdir.abspath()
self.javac_task=tsk=self.create_task('javac')
tmp=[]
srcdir=getattr(self,'srcdir','')
if isinstance(srcdir,Node.Node):
srcdir=[srcdir]
for x in Utils.to_list(srcdir):
if isinstance(x,Node.Node):
y=x
else:
y=self.path.find_dir(x)
if not y:
self.bld.fatal('Could not find the folder %s from %s'%(x,self.path))
tmp.append(y)
tsk.srcdir=tmp
if getattr(self,'compat',None):
tsk.env.append_value('JAVACFLAGS',['-source',self.compat])
if hasattr(self,'sourcepath'):
fold=[isinstance(x,Node.Node)and x or self.path.find_dir(x)for x in self.to_list(self.sourcepath)]
names=os.pathsep.join([x.srcpath()for x in fold])
else:
names=[x.srcpath()for x in tsk.srcdir]
if names:
tsk.env.append_value('JAVACFLAGS',['-sourcepath',names])