本文整理汇总了Python中waflib.TaskGen.feature函数的典型用法代码示例。如果您正苦于以下问题:Python feature函数的具体用法?Python feature怎么用?Python feature使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了feature函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sorted
return sorted(seen, key=methodcaller('srcpath')), None
def keyword(self):
return "Documenting module"
def __str__(self):
return self.env.MODULE
class gz(Task):
run_str = "gzip -c ${SRC} > ${TGT}"
def keyword(self):
return "Compressing"
feature("entrypynt")(feature_py)
# This makes sure install_from is either None or a Node which generate_python_starter relies upon.
@feature("entrypynt")
@after_method("feature_py")
def compose_environment(self):
parent = getattr(self, 'parent', None)
if parent:
self.env = parent.env
else:
env = self.env
def flag(*args):
env.append_value("MANPAGERFLAGS", args)
short_desc = getattr(self, 'short', None)
if short_desc:
flag("-d", "'{}'".format(short_desc))
示例2: getattr
bld.cwd=kw['cwd']=bld.variant_dir
ret=self.exec_response_command(k[0],**kw)
if not ret and getattr(self,'do_manifest',None):
ret=self.exec_mf()
return ret
for k in'c cxx winrc cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib qxx'.split():
cls=Task.classes.get(k,None)
if cls:
cls.exec_command=exec_command_msvc
cls.exec_response_command=exec_response_command
cls.quote_response_command=quote_response_command
cls.exec_mf=exec_mf
conf(get_msvc_version)
conf(gather_wsdk_versions)
conf(gather_msvc_versions)
conf(gather_icl_versions)
conf(get_msvc_versions)
conf(print_all_msvc_detected)
conf(find_lt_names_msvc)
conf(libname_msvc)
conf(check_lib_msvc)
conf(check_libs_msvc)
conf(no_autodetect)
conf(autodetect)
conf(find_msvc)
conf(msvc_common_flags)
after('apply_link')(apply_flags_msvc)
feature('c','cxx')(apply_flags_msvc)
feature('cprogram','cshlib','cxxprogram','cxxshlib')(apply_manifest)
after('apply_link')(apply_manifest)
示例3: len
self.env.INCLUDES_RUBYEXT=cpppath
self.env.CFLAGS_RUBYEXT=read_config('CCDLFLAGS')
self.env.rubyext_PATTERN='%s.'+read_config('DLEXT')[0]
flags=read_config('LDSHARED')
while flags and flags[0][0]!='-':
flags=flags[1:]
if len(flags)>1 and flags[1]=="ppc":
flags=flags[2:]
self.env.LINKFLAGS_RUBYEXT=flags
self.env.LINKFLAGS_RUBYEXT+=read_config('LIBS')
self.env.LINKFLAGS_RUBYEXT+=read_config('LIBRUBYARG_SHARED')
if Options.options.rubyarchdir:
self.env.ARCHDIR_RUBY=Options.options.rubyarchdir
else:
self.env.ARCHDIR_RUBY=read_config('sitearchdir')[0]
if Options.options.rubylibdir:
self.env.LIBDIR_RUBY=Options.options.rubylibdir
else:
self.env.LIBDIR_RUBY=read_config('sitelibdir')[0]
def options(opt):
opt.add_option('--with-ruby-archdir',type='string',dest='rubyarchdir',help='Specify directory where to install arch specific files')
opt.add_option('--with-ruby-libdir',type='string',dest='rubylibdir',help='Specify alternate ruby library path')
opt.add_option('--with-ruby-binary',type='string',dest='rubybinary',help='Specify alternate ruby binary')
feature('rubyext')(init_rubyext)
before('apply_incpaths','apply_lib_vars','apply_bundle','apply_link')(init_rubyext)
after('vars_target_cshlib')(init_rubyext)
feature('rubyext')(apply_ruby_so_name)
before('apply_link','propagate_uselib')(apply_ruby_so_name)
conf(check_ruby_version)
conf(check_ruby_ext_devel)
示例4: summary
tup=(filename,proc.returncode,stdout,stderr)
self.generator.utest_result=tup
testlock.acquire()
try:
bld=self.generator.bld
Logs.debug("ut: %r",tup)
try:
bld.utest_results.append(tup)
except AttributeError:
bld.utest_results=[tup]
finally:
testlock.release()
def summary(bld):
lst=getattr(bld,'utest_results',[])
if lst:
Logs.pprint('CYAN','execution summary')
total=len(lst)
tfail=len([x for x in lst if x[1]])
Logs.pprint('CYAN',' tests that pass %d/%d'%(total-tfail,total))
for(f,code,out,err)in lst:
if not code:
Logs.pprint('CYAN',' %s'%f)
Logs.pprint('CYAN',' tests that fail %d/%d'%(tfail,total))
for(f,code,out,err)in lst:
if code:
Logs.pprint('CYAN',' %s'%f)
def options(opt):
opt.add_option('--alltests',action='store_true',default=False,help='Exec all unit tests',dest='all_tests')
feature('test')(make_test)
after('apply_link')(make_test)
示例5: check_jni_headers
def check_jni_headers(conf):
if not conf.env.CC_NAME and not conf.env.CXX_NAME:
conf.fatal('load a compiler first (gcc, g++, ..)')
if not conf.env.JAVA_HOME:
conf.fatal('set JAVA_HOME in the system environment')
javaHome=conf.env['JAVA_HOME'][0]
dir=conf.root.find_dir(conf.env.JAVA_HOME[0]+'/include')
f=dir.ant_glob('**/(jni|jni_md).h')
incDirs=[x.parent.abspath()for x in f]
dir=conf.root.find_dir(conf.env.JAVA_HOME[0])
f=dir.ant_glob('**/*jvm.(so|dll)')
libDirs=[x.parent.abspath()for x in f]or[javaHome]
for i,d in enumerate(libDirs):
if conf.check(header_name='jni.h',define_name='HAVE_JNI_H',lib='jvm',libpath=d,includes=incDirs,uselib_store='JAVA',uselib='JAVA'):
break
else:
conf.fatal('could not find lib jvm in %r (see config.log)'%libDirs)
feature('javac')(apply_java)
before('process_source')(apply_java)
feature('javac')(use_javac_files)
after('apply_java')(use_javac_files)
feature('javac')(set_classpath)
after('apply_java','propagate_uselib_vars','use_javac_files')(set_classpath)
feature('jar')(jar_files)
after('apply_java','use_javac_files')(jar_files)
before('process_source')(jar_files)
feature('jar')(use_jar_files)
after('jar_files')(use_jar_files)
conf(check_java_class)
conf(check_jni_headers)
示例6: gcj
conf.env.GCJFLAGS_gcj_shlib = ['-fPIC']
class gcj(Task.Task):
run_str = '${GCJ} ${GCJFLAGS} -classpath ${CLASSPATH} -c -o ${TGT} ${SRC}'
class gcj_program(ccroot.link_task):
run_str = '${GCJLINK} ${GCJLINKFLAGS} ${SRC} -o ${TGT}'
color = 'YELLOW'
class gcj_shlib(gcj_program):
pass
ccroot.USELIB_VARS['gcj'] = set(['CLASSPATH', 'JAVACFLAGS', 'GCJFLAGS'])
ccroot.USELIB_VARS['gcj_program'] = set(['CLASSPATH', 'JAVACFLAGS', 'GCJLINKFLAGS'])
ccroot.USELIB_VARS['gcj_shlib'] = set(['CLASSPATH', 'JAVACFLAGS', 'GCJLINKFLAGS'])
feature('gcj_program', 'gcj_shlib')(ccroot.apply_link)
feature('gcj_program', 'gcj_shlib')(ccroot.propagate_uselib_vars)
@feature('gcj')
@after('propagate_uselib_vars', 'apply_gcj')
def set_gcj_classpath(self):
lst = [isinstance(x, str) and x or x.abspath() for x in self.env.CLASSPATH]
self.env.CLASSPATH = os.pathsep.join(lst) + os.pathsep
@feature('gcj')
@before('apply_java')
def apply_gcj(self):
if 'javac' in self.features:
self.bld.fatal('feature gcj_native is not compatible with javac %r' % self)
srcdir = getattr(self, 'srcdir', '')
示例7: fcprogram_test
inst_to='${LIBDIR}'
class fcprogram_test(fcprogram):
def can_retrieve_cache(self):
return False
def runnable_status(self):
ret=super(fcprogram_test,self).runnable_status()
if ret==Task.SKIP_ME:
ret=Task.RUN_ME
return ret
def exec_command(self,cmd,**kw):
bld=self.generator.bld
kw['shell']=isinstance(cmd,str)
kw['stdout']=kw['stderr']=Utils.subprocess.PIPE
kw['cwd']=bld.variant_dir
bld.out=bld.err=''
bld.to_log('command: %s\n'%cmd)
kw['output']=0
try:
(bld.out,bld.err)=bld.cmd_and_log(cmd,**kw)
except Exception ,e:
return-1
if bld.out:
bld.to_log("out: %s\n"%bld.out)
if bld.err:
bld.to_log("err: %s\n"%bld.err)
class fcstlib(ccroot.stlink_task):
pass
feature('fcprogram','fcshlib','fcstlib','fcprogram_test')(dummy)
extension('.f','.f90','.F','.F90','.for','.FOR')(fc_hook)
conf(modfile)
示例8: configure
self.bld.add_post_fun(compile_schemas_callback)
self.bld._compile_schemas_registered=True
Task.task_factory('glib_genmarshal',func=genmarshal_func,vars=['GLIB_GENMARSHAL_PREFIX','GLIB_GENMARSHAL'],color='BLUE',ext_out=['.h'])
Task.task_factory('glib_mkenums','${GLIB_MKENUMS} ${GLIB_MKENUMS_OPTIONS} ${GLIB_MKENUMS_SOURCE} > ${GLIB_MKENUMS_TARGET}',color='PINK',ext_out=['.h'])
Task.task_factory('glib_validate_schema','rm -f ${GLIB_VALIDATE_SCHEMA_OUTPUT} && ${GLIB_COMPILE_SCHEMAS} --dry-run ${GLIB_COMPILE_SCHEMAS_OPTIONS} && touch ${GLIB_VALIDATE_SCHEMA_OUTPUT}',color='PINK')
def configure(conf):
conf.find_program('glib-genmarshal',var='GLIB_GENMARSHAL')
conf.find_perl_program('glib-mkenums',var='GLIB_MKENUMS')
conf.find_program('glib-compile-schemas',var='GLIB_COMPILE_SCHEMAS',mandatory=False)
def getstr(varname):
return getattr(Options.options,varname,getattr(conf.env,varname,''))
gsettingsschemadir=getstr('GSETTINGSSCHEMADIR')
if not gsettingsschemadir:
datadir=getstr('DATADIR')
if not datadir:
prefix=conf.env['PREFIX']
datadir=os.path.join(prefix,'share')
gsettingsschemadir=os.path.join(datadir,'glib-2.0','schemas')
conf.env['GSETTINGSSCHEMADIR']=gsettingsschemadir
def options(opt):
opt.add_option('--gsettingsschemadir',help='GSettings schema location [Default: ${datadir}/glib-2.0/schemas]',default='',dest='GSETTINGSSCHEMADIR')
taskgen_method(add_marshal_file)
before('process_source')(process_marshal)
taskgen_method(add_enums_from_template)
taskgen_method(add_enums)
before('process_source')(process_enums)
taskgen_method(add_settings_schemas)
taskgen_method(add_settings_enums)
feature('glib2')(process_settings)
示例9: check_perl_ext_devel
self.end_msg(False)
return None
self.end_msg(r or True)
return r
def check_perl_ext_devel(self):
env=self.env
perl=env.PERL
if not perl:
self.fatal('find perl first')
def read_out(cmd):
return Utils.to_list(self.cmd_and_log(perl+cmd))
env['LINKFLAGS_PERLEXT']=read_out(" -MConfig -e'print $Config{lddlflags}'")
env['INCLUDES_PERLEXT']=read_out(" -MConfig -e'print \"$Config{archlib}/CORE\"'")
env['CFLAGS_PERLEXT']=read_out(" -MConfig -e'print \"$Config{ccflags} $Config{cccdlflags}\"'")
env['XSUBPP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/xsubpp$Config{exe_ext}\"'")
env['EXTUTILS_TYPEMAP']=read_out(" -MConfig -e'print \"$Config{privlib}/ExtUtils/typemap\"'")
if not getattr(Options.options,'perlarchdir',None):
env['ARCHDIR_PERL']=self.cmd_and_log(perl+" -MConfig -e'print $Config{sitearch}'")
else:
env['ARCHDIR_PERL']=getattr(Options.options,'perlarchdir')
env['perlext_PATTERN']='%s.'+self.cmd_and_log(perl+" -MConfig -e'print $Config{dlext}'")
def options(opt):
opt.add_option('--with-perl-binary',type='string',dest='perlbinary',help='Specify alternate perl binary',default=None)
opt.add_option('--with-perl-archdir',type='string',dest='perlarchdir',help='Specify directory where to install arch specific files',default=None)
before_method('apply_incpaths','apply_link','propagate_uselib_vars')(init_perlext)
feature('perlext')(init_perlext)
extension('.xs')(xsubpp_file)
conf(check_perl_version)
conf(check_perl_module)
conf(check_perl_ext_devel)
示例10: po
if re_linguas.match(lang):
node=self.path.find_resource(os.path.join(podir,re_linguas.match(lang).group()+'.po'))
task=self.create_task('po',node,node.change_ext('.mo'))
if inst:
filename=task.outputs[0].name
(langname,ext)=os.path.splitext(filename)
inst_file=inst+os.sep+langname+os.sep+'LC_MESSAGES'+os.sep+appname+'.mo'
self.bld.install_as(inst_file,task.outputs[0],chmod=getattr(self,'chmod',Utils.O644),env=task.env)
else:
Logs.pprint('RED',"Error no LINGUAS file found in po directory")
class po(Task.Task):
run_str='${MSGFMT} -o ${TGT} ${SRC}'
color='BLUE'
class intltool(Task.Task):
run_str='${INTLTOOL} ${INTLFLAGS} ${INTLCACHE} ${INTLPODIR} ${SRC} ${TGT}'
color='BLUE'
def configure(conf):
conf.find_program('msgfmt',var='MSGFMT')
conf.find_perl_program('intltool-merge',var='INTLTOOL')
prefix=conf.env.PREFIX
datadir=conf.env.DATADIR
if not datadir:
datadir=os.path.join(prefix,'share')
conf.define('LOCALEDIR',os.path.join(datadir,'locale').replace('\\','\\\\'))
conf.define('DATADIR',datadir.replace('\\','\\\\'))
if conf.env.CC or conf.env.CXX:
conf.check(header_name='locale.h')
before_method('process_source')(apply_intltool_in_f)
feature('intltool_in')(apply_intltool_in_f)
feature('intltool_po')(apply_intltool_po)
示例11: feature
if self.env.CXX:
kw['features']=['cxx','cxxprogram']
else:
kw['features']=['c','cprogram']
kw['fragment']=LARGE_FRAGMENT
kw['msg']='Checking for large file support'
ret=True
try:
if self.env.DEST_BINFMT!='pe':
ret=self.check(**kw)
except self.errors.ConfigurationError:
pass
else:
if ret:
return True
kw['msg']='Checking for -D_FILE_OFFSET_BITS=64'
kw['defines']=['_FILE_OFFSET_BITS=64']
try:
ret=self.check(**kw)
except self.errors.ConfigurationError:
pass
else:
self.define('_FILE_OFFSET_BITS',64)
return ret
self.fatal('There is no support for large files')
feature('link_lib_test')(link_lib_test_fun)
before_method('process_source')(link_lib_test_fun)
conf(check_library)
conf(check_inline)
conf(check_large_file)
示例12: configure
Task.task_factory(
"intltool", "${INTLTOOL} ${INTLFLAGS} ${INTLCACHE} ${INTLPODIR} ${SRC} ${TGT}", color="BLUE", ext_in=".bin"
)
def configure(conf):
conf.find_program("msgfmt", var="MSGFMT")
conf.find_perl_program("intltool-merge", var="INTLTOOL")
def getstr(varname):
return getattr(Options.options, varname, "")
prefix = conf.env["PREFIX"]
datadir = getstr("datadir")
if not datadir:
datadir = os.path.join(prefix, "share")
conf.define("LOCALEDIR", os.path.join(datadir, "locale"))
conf.define("DATADIR", datadir)
if conf.env["CC"] or conf.env["CXX"]:
conf.check(header_name="locale.h")
def options(opt):
opt.add_option("--want-rpath", type="int", default=1, dest="want_rpath", help="set rpath to 1 or 0 [Default 1]")
opt.add_option("--datadir", type="string", default="", dest="datadir", help="read-only application data")
before("process_source")(iapply_intltool_in_f)
feature("intltool_in")(iapply_intltool_in_f)
feature("intltool_po")(apply_intltool_po)
示例13: feature
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import pprint
pp = pprint.pprint
from waflib import Utils
from waflib import Task, TaskGen
from waflib.TaskGen import feature
from .vendor.distlib.database import make_graph
#...do not invoke default rule/ext methods!
TaskGen.feats['*'].clear()
feature('*')(Utils.nada)
@feature('zpy-requirements')
def zpy_requirements(gen):
env = gen.env
bld = gen.bld
zpy = bld.zpy
_tsk = getattr(gen, 'task', 'ZPyTask_Requirements')
for dist in getattr(gen, 'source', tuple()):
out = bld.bldnode.make_node(str(dist.key))
tsk = gen.create_task(_tsk, tgt=out.make_node('setup.py'))
tsk.dist = dist
示例14: extension
)
opt.add_option(
"--header-ext", type="string", default="", help="header extension for moc files", dest="qt_header_ext"
)
for i in "qtdir qtbin qtlibs".split():
opt.add_option("--" + i, type="string", default="", dest=i)
if sys.platform == "darwin":
opt.add_option(
"--no-qt4-framework",
action="store_false",
help="do not use the framework version of Qt4 in OS X",
dest="use_qt4_osxframework",
default=True,
)
opt.add_option(
"--translate", action="store_true", help="collect translation strings", dest="trans_qt4", default=False
)
extension(*EXT_RCC)(create_rcc_task)
extension(*EXT_UI)(create_uic_task)
extension(".ts")(add_lang)
feature("qt4")(apply_qt4)
after_method("apply_link")(apply_qt4)
extension(*EXT_QT4)(cxx_hook)
conf(find_qt4_binaries)
conf(find_qt4_libraries)
conf(simplify_qt4_libs)
conf(add_qt4_rpath)
conf(set_qt4_libs_to_check)
示例15: getattr
else:
no_nodes.append(x)
self.source = no_nodes
bintype = getattr(self, 'type', self.gen.endswith('.dll') and 'library' or 'exe')
self.cs_task = tsk = self.create_task('fsc', cs_nodes, self.path.find_or_declare(self.gen))
tsk.env.CSTYPE = '/target:%s' % bintype
tsk.env.OUT = '/out:%s' % tsk.outputs[0].abspath()
inst_to = getattr(self, 'install_path', bintype=='exe' and '${BINDIR}' or '${LIBDIR}')
if inst_to:
# note: we are making a copy, so the files added to cs_task.outputs won't be installed automatically
mod = getattr(self, 'chmod', bintype=='exe' and Utils.O755 or Utils.O644)
self.install_task = self.add_install_files(install_to=inst_to, install_from=self.cs_task.outputs[:], chmod=mod)
feature('fs')(cs.use_cs)
after_method('apply_fsc')(cs.use_cs)
feature('fs')(cs.debug_cs)
after_method('apply_fsc', 'use_cs')(cs.debug_cs)
class fsc(Task.Task):
"""
Compile F# files
"""
color = 'YELLOW'
run_str = '${FSC} ${CSTYPE} ${CSFLAGS} ${ASS_ST:ASSEMBLIES} ${RES_ST:RESOURCES} ${OUT} ${SRC}'
def configure(conf):
"""
Find a F# compiler, set the variable FSC for the compiler and FS_NAME (mono or fsc)