本文整理汇总了Python中TaskGen类的典型用法代码示例。如果您正苦于以下问题:Python TaskGen类的具体用法?Python TaskGen怎么用?Python TaskGen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TaskGen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_missing_mapping
def test_missing_mapping(self):
# no mapping for extension
bld = self.make_bld()
obj = TaskGen.task_gen(bld=bld)
obj.source = self._source_file_path
self._write_source("int main() {return 0;}")
self.failUnlessRaises(Utils.WafError, obj.apply_core)
示例2: new_task_gen
def new_task_gen(self,*k,**kw):
kw['bld']=self
if len(k)==0:return TaskGen.task_gen(*k,**kw)
cls_name=k[0]
try:cls=TaskGen.task_gen.classes[cls_name]
except KeyError:raise Utils.WscriptError('%s is not a valid task generator -> %s'%(cls_name,[x for x in TaskGen.task_gen.classes]))
else:return cls(*k,**kw)
示例3: new_task_gen
def new_task_gen(self, *k, **kw):
if self.task_gen_cache_names:
self.task_gen_cache_names = {}
kw['bld'] = self
if len(k) == 0:
ret = TaskGen.task_gen(*k, **kw)
else:
cls_name = k[0]
try: cls = TaskGen.task_gen.classes[cls_name]
except KeyError: raise Utils.WscriptError('{0!s} is not a valid task generator -> {1!s}'.format(cls_name, [x for x in TaskGen.task_gen.classes]))
ret = cls(*k, **kw)
return ret
示例4: test_white_no_sources_specified
def test_white_no_sources_specified(self):
# white-box test: no sources were specified
# add apply_verif to taskgen
import Tools.ccroot
Options.commands['configure'] = False
env = Environment.Environment()
bld = Build.bld = Build.BuildContext()
bld.set_env('default', env)
blddir = os.path.join(self._test_dir_root, 'b')
bld.load_dirs(self._test_dir_root, blddir)
obj = TaskGen.task_gen(bld=bld)
# TODO: make sure it works with apply_core too
self.failUnlessRaises(Utils.WafError, obj.apply_verif)
示例5: test_validate_find_srcs_absolute
def test_validate_find_srcs_absolute(self):
# find sources in dirs cannot get absoulte paths
bld = self.make_bld()
obj = TaskGen.task_gen(bld=bld)
self.failUnlessRaises(Utils.WafError, obj.find_sources_in_dirs, self._test_dir_root)
示例6: return
if not nd: nd = x.find_resource(name+'.ml')
if nd:
found_lst.append(nd)
break
else:
raw_lst.append(name)
return (found_lst, raw_lst)
native_lst=['native', 'all', 'c_object']
bytecode_lst=['bytecode', 'all']
class ocaml_taskgen(TaskGen.task_gen):
def __init__(self, *k, **kw):
TaskGen.task_gen.__init__(self, *k, **kw)
TaskGen.bind_feature('ocaml', 'apply_core')
@taskgen
@feature('ocaml')
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,
示例7: decide_ext
#!/usr/bin/env python
# encoding: utf-8
# John O'Meara, 2006
# Thomas Nagy, 2006-2008
"Flex processing"
import TaskGen
def decide_ext(self, node):
if 'cxx' in self.features: return '.lex.cc'
else: return '.lex.c'
TaskGen.declare_chain(
name = 'flex',
rule = '${FLEX} -o${TGT} ${FLEXFLAGS} ${SRC}',
ext_in = '.l',
ext_out = '.c .cxx',
decider = decide_ext,
)
def detect(conf):
conf.find_program('flex', var='FLEX', mandatory=True)
conf.env['FLEXFLAGS'] = ''
示例8: __call__
def __call__(self, *k, **kw):
if self.task_gen_cache_names:
self.task_gen_cache_names = {}
kw["bld"] = self
return TaskGen.task_gen(*k, **kw)
示例9: edje
def edje(self):
self.default_chmod=0664
bld_rule = '${EDJE} '+'-id '+self.cwd+' -fd '+self.cwd+' ${SRC} ${TGT}'
TaskGen.declare_chain(name='edje_cc', rule=bld_rule, ext_in='.edc', ext_out='.edj', reentrant=0, install=None)
示例10: cscan
def cscan(self):
txt = self.inputs[0].read(self.env)
mods = []
for m in re_cyt.finditer(txt):
mods.append(m.group(1))
incs = getattr(self.generator, 'cython_includes', [])
incs = [self.generator.path.find_dir(x) for x in incs]
incs.append(self.inputs[0].parent)
found = []
missing = []
for x in mods:
for y in incs:
k = y.find_resource(x + '.pxd')
if k:
found.append(k)
break
else:
missing.append(x)
return (found, missing)
TaskGen.declare_chain(name='cython', rule='${CYTHON} ${CYTHONFLAGS} ${SRC} -o ${TGT}', ext_in=['.pyx'], ext_out=['.c'], scan=cscan)
def detect(conf):
conf.find_program('cython', var='CYTHON', mandatory=True)
示例11: default_cython
if copy:
copy.close()
try:
os.remove(src_file)
except OSError:
pass
except IOError:
pass
else:
os.rename(copy_file, src_file)
return 0
f = TaskGen.declare_chain(
name = 'cythonc',
action = cython_run,
ext_in = '.pyx',
ext_out = '.c',
reentrant = True,
after='apply_cython_extra',
scan=scan_deps)
@TaskGen.feature('cython')
@TaskGen.before('apply_core')
def default_cython(self):
Utils.def_attrs(self,
cython_includes = '',
no_timestamp = False)
@TaskGen.feature('cython')
@TaskGen.after('apply_core')
def apply_cython_incpaths(self):
"""Used to build _CYTHONINCFLAGS, and the dependencies scanner (when ready).
示例12: __call__
def __call__(self, *k, **kw):
kw['bld'] = self
return TaskGen.task_gen(*k, **kw)
示例13: init_f
task = self.create_task('fortranpp')
task.inputs = [node]
task.outputs = [node.change_ext(obj_ext)]
self.compiled_tasks.append(task)
return task
#################################################### Task generators
# we reuse a lot of code from ccroot.py
FORTRAN = 'init_f default_cc apply_incpaths apply_defines_cc apply_type_vars apply_lib_vars add_extra_flags apply_obj_vars_cc'.split()
FPROGRAM = 'apply_verif vars_target_cprogram install_target_cstaticlib apply_objdeps apply_obj_vars '.split()
FSHLIB = 'apply_verif vars_target_cstaticlib install_target_cstaticlib install_target_cshlib apply_objdeps apply_obj_vars apply_vnum'.split()
FSTATICLIB = 'apply_verif vars_target_cstaticlib install_target_cstaticlib apply_objdeps apply_obj_vars '.split()
TaskGen.bind_feature('fortran', FORTRAN)
TaskGen.bind_feature('fprogram', FPROGRAM)
TaskGen.bind_feature('fshlib', FSHLIB)
TaskGen.bind_feature('fstaticlib', FSTATICLIB)
TaskGen.declare_order('init_f', 'apply_lib_vars')
TaskGen.declare_order('default_cc', 'apply_core')
@feature('fortran')
@before('apply_type_vars')
@after('default_cc')
def init_f(self):
# PATH flags:
# - CPPPATH: same as C, for pre-processed fortran files
# - FORTRANMODPATH: where to look for modules (.mod)
# - FORTRANMODOUTPATH: where to *put* modules (.mod)
示例14: Copyright
# encoding: utf-8
# inkscape-convert - Convert svg files to pdf
# Copyright (C) 2009 Michael Budde
import TaskGen
TaskGen.declare_chain(
name='inkscape-svg-convert',
action='${INKSCAPE} ${INKSCAPEFLAGS} --export-pdf=${TGT} ${SRC}',
ext_in='.svg',
ext_out='.pdf',
reentrant=False)
def detect(conf):
conf.find_program('inkscape', var='INKSCAPE', mandatory=True)
conf.env['INKSCAPEFLAGS'] = ''
示例15: decide_ext
#!/usr/bin/env python
# encoding: utf-8
# John O'Meara, 2006
"Bison processing"
import TaskGen
def decide_ext(self, node):
c_ext = '.tab.c'
if node.name.endswith('.yc'): c_ext = '.tab.cc'
if '-d' in self.env['BISONFLAGS']:
return [c_ext, c_ext.replace('c', 'h')]
else:
return c_ext
TaskGen.declare_chain(
name = 'bison',
rule = 'cd ${SRC[0].bld_dir(env)} && ${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}',
ext_in = '.y .yc .yy',
decider = decide_ext,
before = 'cc cxx',
)
def detect(conf):
bison = conf.find_program('bison', var='BISON', mandatory=True)
v = conf.env
v['BISONFLAGS'] = '-d'