本文整理汇总了Python中waflib.TaskGen.after_method函数的典型用法代码示例。如果您正苦于以下问题:Python after_method函数的具体用法?Python after_method怎么用?Python after_method使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了after_method函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: warn
try:
conf.find_program('python',var='PYTHON')
except conf.errors.ConfigurationError:
warn("could not find a python executable, setting to sys.executable '%s'"%sys.executable)
conf.env.PYTHON=sys.executable
if conf.env.PYTHON!=sys.executable:
warn("python executable '%s' different from sys.executable '%s'"%(conf.env.PYTHON,sys.executable))
conf.env.PYTHON=conf.cmd_to_list(conf.env.PYTHON)
v=conf.env
v['PYCMD']='"import sys, py_compile;py_compile.compile(sys.argv[1], sys.argv[2])"'
v['PYFLAGS']=''
v['PYFLAGS_OPT']='-O'
v['PYC']=getattr(Options.options,'pyc',1)
v['PYO']=getattr(Options.options,'pyo',1)
def options(opt):
opt.add_option('--nopyc',action='store_false',default=1,help='Do not install bytecode compiled .pyc files (configuration) [Default:install]',dest='pyc')
opt.add_option('--nopyo',action='store_false',default=1,help='Do not install optimised compiled .pyo files (configuration) [Default:install]',dest='pyo')
extension('.py')(process_py)
feature('py')(feature_py)
feature('pyext')(init_pyext)
before_method('propagate_uselib_vars','apply_link')(init_pyext)
after_method('apply_bundle')(init_pyext)
feature('pyext')(set_bundle)
before_method('apply_link','apply_bundle')(set_bundle)
before_method('propagate_uselib_vars')(init_pyembed)
feature('pyembed')(init_pyembed)
conf(get_python_variables)
conf(check_python_headers)
conf(check_python_version)
conf(check_python_module)
示例2: configure
color='YELLOW'
run_str='${MCS} ${CSTYPE} ${CSFLAGS} ${ASS_ST:ASSEMBLIES} ${RES_ST:RESOURCES} ${OUT} ${SRC}'
def configure(conf):
csc=getattr(Options.options,'cscbinary',None)
if csc:
conf.env.MCS=csc
conf.find_program(['csc','mcs','gmcs'],var='MCS')
conf.env.ASS_ST='/r:%s'
conf.env.RES_ST='/resource:%s'
conf.env.CS_NAME='csc'
if str(conf.env.MCS).lower().find('mcs')>-1:
conf.env.CS_NAME='mono'
def options(opt):
opt.add_option('--with-csc-binary',type='string',dest='cscbinary')
class fake_csshlib(Task.Task):
color='YELLOW'
inst_to=None
def runnable_status(self):
for x in self.outputs:
x.sig=Utils.h_file(x.abspath())
return Task.SKIP_ME
def read_csshlib(self,name,paths=[]):
return self(name=name,features='fake_lib',lib_paths=paths,lib_type='csshlib')
feature('cs')(apply_cs)
before_method('process_source')(apply_cs)
feature('cs')(use_cs)
after_method('apply_cs')(use_cs)
feature('cs')(debug_cs)
after_method('apply_cs','use_cs')(debug_cs)
conf(read_csshlib)
示例3: getattr
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
# reuse some code
feature('scalac')(javaw.use_javac_files)
after_method('apply_scalac')(javaw.use_javac_files)
feature('scalac')(javaw.set_classpath)
after_method('apply_scalac', 'use_scalac_files')(javaw.set_classpath)
SOURCE_RE = '**/*.scala'
class scalac(javaw.javac):
color = 'GREEN'
vars = ['CLASSPATH', 'SCALACFLAGS', 'SCALAC', 'OUTDIR']
def runnable_status(self):
"""
Wait for dependent tasks to be complete, then read the file system to find the input nodes.
"""
for t in self.run_after:
示例4: process_rpath
if Options.options.want_rpath:
def process_rpath(vars_,coreval):
for d in vars_:
var=d.upper()
value=env['LIBPATH_'+var]
if value:
core=env[coreval]
accu=[]
for lib in value:
if var!='QTCORE':
if lib in core:
continue
accu.append('-Wl,--rpath='+lib)
env['RPATH_'+var]=accu
process_rpath(vars,'LIBPATH_QTCORE')
process_rpath(vars_debug,'LIBPATH_QTCORE_DEBUG')
def options(opt):
opt.add_option('--want-rpath',action='store_true',default=False,dest='want_rpath',help='enable the rpath for qt libraries')
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)
示例5: taskgen_method
node=x.find_node(y)
if node:
node.sig=Utils.h_file(node.abspath())
break
else:
continue
break
else:
raise Errors.WafError('could not find library %r'%self.name)
self.link_task=self.create_task('fake_%s'%self.lib_type,[],[node])
self.target=self.name
taskgen_method(create_compiled_task)
taskgen_method(to_incnodes)
feature('c','cxx','d','go','asm','fc','includes')(apply_incpaths)
after_method('propagate_uselib_vars','process_source')(apply_incpaths)
feature('c','cxx','d','go','fc','asm')(apply_link)
after_method('process_source')(apply_link)
taskgen_method(use_rec)
feature('c','cxx','d','use','fc')(process_use)
before_method('apply_incpaths','propagate_uselib_vars')(process_use)
after_method('apply_link','process_source')(process_use)
taskgen_method(get_uselib_vars)
feature('c','cxx','d','fc','javac','cs','uselib')(propagate_uselib_vars)
after_method('process_use')(propagate_uselib_vars)
feature('cshlib','cxxshlib')(apply_implib)
after_method('apply_link')(apply_implib)
feature('cshlib','cxxshlib','dshlib','fcshlib','vnum')(apply_vnum)
after_method('apply_link')(apply_vnum)
conf(read_shlib)
conf(read_stlib)
示例6: runnable_status
def runnable_status(self):
return Task.SKIP_ME
def add_those_o_files(self, node):
tsk = self.create_task("fake_o", [], node)
try:
self.compiled_tasks.append(tsk)
except AttributeError:
self.compiled_tasks = [tsk]
taskgen_method(create_compiled_task)
taskgen_method(to_incnodes)
feature("c", "cxx", "d", "go", "asm", "fc", "includes")(apply_incpaths)
after_method("propagate_uselib_vars", "process_source")(apply_incpaths)
feature("c", "cxx", "d", "go", "fc", "asm")(apply_link)
after_method("process_source")(apply_link)
taskgen_method(use_rec)
feature("c", "cxx", "d", "use", "fc")(process_use)
before_method("apply_incpaths", "propagate_uselib_vars")(process_use)
after_method("apply_link", "process_source")(process_use)
taskgen_method(add_objects_from_tgen)
taskgen_method(get_uselib_vars)
feature("c", "cxx", "d", "fc", "javac", "cs", "uselib")(propagate_uselib_vars)
after_method("process_use")(propagate_uselib_vars)
feature("cshlib", "cxxshlib", "fcshlib")(apply_implib)
after_method("apply_link")(apply_implib)
feature("cshlib", "cxxshlib", "dshlib", "fcshlib", "vnum")(apply_vnum)
after_method("apply_link")(apply_vnum)
conf(read_shlib)
示例7: options
def options(opt):
opt.add_option(
"--nopyc",
action="store_false",
default=1,
help="Do not install bytecode compiled .pyc files (configuration) [Default:install]",
dest="pyc",
)
opt.add_option(
"--nopyo",
action="store_false",
default=1,
help="Do not install optimised compiled .pyo files (configuration) [Default:install]",
dest="pyo",
)
extension(".py")(process_py)
feature("py")(feature_py)
feature("pyext")(init_pyext)
before_method("propagate_uselib_vars", "apply_link")(init_pyext)
after_method("apply_bundle")(init_pyext)
feature("pyext")(set_bundle)
before_method("apply_link", "apply_bundle")(set_bundle)
before_method("propagate_uselib_vars")(init_pyembed)
feature("pyembed")(init_pyembed)
conf(get_python_variables)
conf(check_python_headers)
conf(check_python_version)
conf(check_python_module)
示例8: conf
for x in tasks:
if x.hasrun!=Task.SUCCESS:
self.end_msg(kw.get('errmsg','no'),color='YELLOW')
self.fatal(kw.get('fatalmsg',None)or'One of the tests has failed, see the config.log for more information')
self.end_msg('ok')
conf(parse_flags)
conf(ret_msg)
conf(validate_cfg)
conf(exec_cfg)
conf(check_cfg)
conf(validate_c)
conf(post_check)
conf(check)
feature('test_exec')(test_exec_fun)
after_method('apply_link')(test_exec_fun)
conf(run_c_code)
conf(check_cxx)
conf(check_cc)
conf(define)
conf(undefine)
conf(define_cond)
conf(is_defined)
conf(get_define)
conf(have_define)
conf(write_config_header)
conf(get_config_header)
conf(cc_add_flags)
conf(cxx_add_flags)
conf(link_add_flags)
conf(cc_load_tools)
示例9: create_plan9c_task
# 5. 6c import
create_plan9c_task(cgo_import)
# 6. add some of the gcc tasks to compiled_tasks
for task in tg.compiled_tasks:
if task.inputs[0].name.endswith('_cgo_main.c'):
continue
self.compiled_tasks.append(task)
# restore the group
self.bld.set_group(current_group)
decorate(
feature('cgo'),
before_method('apply_incpaths', 'propagate_uselib_vars'),
after_method('apply_link', 'process_source'),
process_use,
)
decorate(
feature('cgo'),
after_method('process_use'),
propagate_uselib_vars,
)
def check_tool_loaded(conf, thetool):
for tool in conf.tools:
if tool['tool'] == thetool:
return True
return False
def configure(conf):
示例10: feature
conf.check(
header_name="jni.h",
define_name="HAVE_JNI_H",
lib="jvm",
libpath=d,
includes=incDirs,
uselib_store="JAVA",
uselib="JAVA",
)
except:
pass
else:
break
else:
conf.fatal("could not find lib jvm in %r (see config.log)" % libDirs)
feature("javac")(apply_java)
before_method("process_source")(apply_java)
feature("javac")(use_javac_files)
after_method("apply_java")(use_javac_files)
feature("javac")(set_classpath)
after_method("apply_java", "propagate_uselib_vars", "use_javac_files")(set_classpath)
feature("jar")(jar_files)
after_method("apply_java", "use_javac_files")(jar_files)
before_method("process_source")(jar_files)
feature("jar")(use_jar_files)
after_method("jar_files")(use_jar_files)
conf(check_java_class)
conf(check_jni_headers)
示例11: decorate
obj_node = self.path.find_or_declare(self.target + '.%s' % self.env.GOCHAR)
task = self.create_task('go', src_nodes, obj_node)
try:
self.compiled_tasks.append(task)
except AttributeError:
self.compiled_tasks = [task]
def decorate(*args):
decorators = args[:-1]
func = args[-1]
for d in reversed(decorators):
func = d(func)
decorate(
feature('go'),
after_method('propagate_uselib_vars', 'process_source'),
apply_incpaths,
)
decorate(
feature('goprogram', 'gopackage'),
after_method('process_source'),
apply_link,
)
########################################################################
# Configuration
########################################################################
@conf
def find_go_command(self):
# find go command, we will use it to run go tools
示例12: hasattr
if not hasattr(test.__class__, '__oldstr__'):
test.__class__.__oldstr__ = test.__class__.__str__
test.__class__.__str__ = systest_task_str
test.__class__.run = systest_task_run
test.__unicode__ = systest_task_str
test.sys = sysname
test.ram = sdramname or sramname or ""
test.rom = romname
test.atstr = atstr
test.filename = filename
test.ut_exec = exec_list + param
print(' '.join(test.ut_exec))
from waflib.TaskGen import feature, after_method, before_method, task_gen
feature('systest')(make_systest)
after_method('apply_link')(make_systest)
# ASM hooks for the gcc compiler
def s_hook(self,node):
return self.create_compiled_task('c',node)
TaskGen.extension('.S')(s_hook)
MKPROM = Task.task_factory( 'MKPROM',
func = '${MKPROM} ${_MKPROMFLAGS} -o ${TGT} ${SRC}',
color = 'YELLOW')
MKPROM_TSKS = list()
def make_prom(self):
"""Create mkprom task"""
示例13: macapp
class macapp(Task.Task):
color = "PINK"
def run(self):
self.outputs[0].parent.mkdir()
shutil.copy2(self.inputs[0].srcpath(), self.outputs[0].abspath())
class macplist(Task.Task):
color = "PINK"
ext_in = [".bin"]
def run(self):
if getattr(self, "code", None):
txt = self.code
else:
txt = self.inputs[0].read()
self.outputs[0].write(txt)
feature("c", "cxx")(set_macosx_deployment_target)
taskgen_method(create_bundle_dirs)
feature("cprogram", "cxxprogram")(create_task_macapp)
after_method("apply_link")(create_task_macapp)
feature("cprogram", "cxxprogram")(create_task_macplist)
after_method("apply_link")(create_task_macplist)
feature("cshlib", "cxxshlib")(apply_bundle)
before_method("apply_link", "propagate_uselib_vars")(apply_bundle)
示例14: getattr
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)
"""
示例15: grep_for_endianness
return ebcdic_mm[i] + ebcdic_ii[i];
}
extern int foo;
'''
class grep_for_endianness(Task.Task):
color='PINK'
def run(self):
txt=self.inputs[0].read(flags='rb').decode('iso8859-1')
if txt.find('LiTTleEnDian')>-1:
self.generator.tmp.append('little')
elif txt.find('BIGenDianSyS')>-1:
self.generator.tmp.append('big')
else:
return-1
def grep_for_endianness_fun(self):
self.create_task('grep_for_endianness',self.compiled_tasks[0].outputs[0])
def check_endianness(self):
tmp=[]
def check_msg(self):
return tmp[0]
self.check(fragment=ENDIAN_FRAGMENT,features='c grep_for_endianness',msg="Checking for endianness",define='ENDIANNESS',tmp=tmp,okmsg=check_msg)
return tmp[0]
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)
feature('grep_for_endianness')(grep_for_endianness_fun)
after_method('process_source')(grep_for_endianness_fun)
conf(check_endianness)