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


Python TaskGen.extension函数代码示例

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


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

示例1: 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)
开发者ID:AKASeon,项目名称:Whatever,代码行数:31,代码来源:perl.py

示例2: 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)
开发者ID:FlavioFalcao,项目名称:osmbrowser,代码行数:31,代码来源:qt4.py

示例3: bison

#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/svn/docs/wafbook/single.html#_obtaining_the_waf_file

from waflib import Task
from waflib.TaskGen import extension
class bison(Task.Task):
	color='BLUE'
	run_str='${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}'
	ext_out=['.h']
def big_bison(self,node):
	has_h='-d'in self.env['BISONFLAGS']
	outs=[]
	if node.name.endswith('.yc'):
		outs.append(node.change_ext('.tab.cc'))
		if has_h:
			outs.append(node.change_ext('.tab.hh'))
	else:
		outs.append(node.change_ext('.tab.c'))
		if has_h:
			outs.append(node.change_ext('.tab.h'))
	tsk=self.create_task('bison',node,outs)
	tsk.cwd=node.parent.get_bld().abspath()
	self.source.append(outs[0])
def configure(conf):
	conf.find_program('bison',var='BISON')
	conf.env.BISONFLAGS=['-d']

extension('.y','.yc','.yy')(big_bison)
开发者ID:HariKishan8,项目名称:Networks,代码行数:29,代码来源:bison.py

示例4: add_those_o_files

		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)
conf(read_stlib)
feature('fake_lib')(process_lib)
extension('.o','.obj')(add_those_o_files)
开发者ID:ETLin,项目名称:ns3-h264-svc,代码行数:30,代码来源:ccroot.py

示例5: configure

#! /usr/bin/env python
# encoding: utf-8

import waflib.Tools.asm
from waflib.TaskGen import feature, extension
from waflib import Task

def configure(conf):
	yasm=conf.find_program(['yasm'],var='YASM',path_list=['/usr/bin','/usr/local/bin'])
	if not yasm:conf.fatal('could not find yasm, install it or set PATH env var')
	conf.env.AS_TGT_F=['-o']
	conf.env.ASLNK_TGT_F=['-o']

def apply_yasm_vars(self):
	self.env.append_value('YASM_FLAGS',self.to_list(getattr(self,'yasm_flags',[])))
	self.env.append_value('YASM_INCLUDES'," -I".join([''] + self.to_list(self.env.INCPATHS)).split())
feature('asm')(apply_yasm_vars)

Task.simple_task_type('yasm','${YASM} ${YASM_FLAGS} ${YASM_INCLUDES} ${SRC} -o ${TGT}',color='BLUE',ext_out='.o',shell=False)

def yasm_hook(self,node):
	self.meths.append('apply_yasm_vars')
	return self.create_compiled_task('yasm',node)

extension('.s')(yasm_hook)
开发者ID:leonardoruilova,项目名称:metta,代码行数:25,代码来源:yasm.py

示例6: check_ruby_module

		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 check_ruby_module(self,module_name):
	self.start_msg('Ruby module %s'%module_name)
	try:
		self.cmd_and_log([self.env['RUBY'],'-e','require \'%s\';puts 1'%module_name])
	except:
		self.end_msg(False)
		self.fatal('Could not find the ruby module %r'%module_name)
	self.end_msg(True)
def process(self,node):
	tsk=self.create_task('run_ruby',node)
class run_ruby(Task.Task):
	run_str='${RUBY} ${RBFLAGS} -I ${SRC[0].parent.abspath()} ${SRC}'
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_method('apply_incpaths','apply_lib_vars','apply_bundle','apply_link')(init_rubyext)
feature('rubyext')(apply_ruby_so_name)
before_method('apply_link','propagate_uselib')(apply_ruby_so_name)
conf(check_ruby_version)
conf(check_ruby_ext_devel)
conf(check_ruby_module)
extension('.rb')(process)
开发者ID:ETLin,项目名称:ns3-h264-svc,代码行数:30,代码来源:ruby.py

示例7: asm

import waflib.Task
from waflib.Tools.ccroot import link_task, stlink_task
from waflib.TaskGen import extension, feature


class asm(Task.Task):
    color = "BLUE"
    run_str = "${AS} ${ASFLAGS} ${CPPPATH_ST:INCPATHS} ${AS_SRC_F}${SRC} ${AS_TGT_F}${TGT}"


def asm_hook(self, node):
    return self.create_compiled_task("asm", node)


class asmprogram(link_task):
    run_str = "${ASLINK} ${AS_TGT_F}${TGT} ${SRC}"
    ext_out = [".bin"]
    inst_to = "${BINDIR}"
    chmod = Utils.O755


class asmshlib(asmprogram):
    inst_to = "${LIBDIR}"


class asmstlib(stlink_task):
    pass


extension(".s", ".S", ".asm", ".ASM", ".spp", ".SPP")(asm_hook)
开发者ID:abdo5520,项目名称:AVS-NS3,代码行数:30,代码来源:asm.py

示例8: 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)
开发者ID:ETLin,项目名称:ns3-h264-svc,代码行数:31,代码来源:fc.py

示例9: add_lua

#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file

from waflib.TaskGen import extension
from waflib import Task,Utils
def add_lua(self,node):
	tsk=self.create_task('luac',node,node.change_ext('.luac'))
	inst_to=getattr(self,'install_path',self.env.LUADIR and'${LUADIR}'or None)
	if inst_to:
		self.bld.install_files(inst_to,tsk.outputs)
	return tsk
class luac(Task.Task):
	run_str='${LUAC} -s -o ${TGT} ${SRC}'
	color='PINK'
def configure(conf):
	conf.find_program('luac',var='LUAC')

extension('.lua')(add_lua)
开发者ID:ETLin,项目名称:ns3-h264-svc,代码行数:19,代码来源:lua.py

示例10: len

			self.allmasters = []

		if not node.parent in self.masters:
			m = self.masters[node.parent] = self.master = self.create_task('batch')
			self.allmasters.append(m)
		else:
			m = self.masters[node.parent]
			if len(m.slaves) > MAX_BATCH:
				m = self.masters[node.parent] = self.master = self.create_task('batch')
				self.allmasters.append(m)

		m.add_slave(task)
		return task
	return n_hook

extension('.c')(hook('c'))
extension('.cpp','.cc','.cxx','.C','.c++')(hook('cxx'))

@feature('cprogram', 'cshlib', 'cstaticlib', 'cxxprogram', 'cxxshlib', 'cxxstlib')
@after_method('apply_link')
def link_after_masters(self):
	if getattr(self, 'allmasters', None):
		for m in self.allmasters:
			self.link_task.set_run_after(m)

# Modify the c and cxx task classes - in theory it would be better to
# create subclasses and to re-map the c/c++ extensions
#
for x in ['c', 'cxx']:
	t = Task.classes[x]
	def run(self):
开发者ID:Dzshiftt,项目名称:Gnomescroll,代码行数:31,代码来源:batched_cc.py

示例11: len

        if not node.parent in self.masters:
            m = self.masters[node.parent] = self.master = self.create_task("batch")
            self.allmasters.append(m)
        else:
            m = self.masters[node.parent]
            if len(m.slaves) > MAX_BATCH:
                m = self.masters[node.parent] = self.master = self.create_task("batch")
                self.allmasters.append(m)

        m.add_slave(task)
        return task

    return n_hook


extension(".c")(hook("c"))
extension(".cpp", ".cc", ".cxx", ".C", ".c++")(hook("cxx"))


@feature("cprogram", "cshlib", "cstaticlib", "cxxprogram", "cxxshlib", "cxxstlib")
@after_method("apply_link")
def link_after_masters(self):
    if getattr(self, "allmasters", None):
        for m in self.allmasters:
            self.link_task.set_run_after(m)


# Modify the c and cxx task classes - in theory it would be better to
# create subclasses and to re-map the c/c++ extensions
#
for x in ["c", "cxx"]:
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:31,代码来源:batched_cc.py

示例12: getattr

        self.check_cfg(**pkg_args)
    if not self.env["HAVE_GTHREAD"]:
        pkg_args = {"package": "gthread-2.0", "uselib_store": "GTHREAD", "args": "--cflags --libs"}
        if getattr(Options.options, "vala_target_glib", None):
            pkg_args["atleast_version"] = Options.options.vala_target_glib
        self.check_cfg(**pkg_args)


def configure(self):
    self.load("gnu_dirs")
    self.check_vala_deps()
    self.check_vala()


def options(opt):
    opt.load("gnu_dirs")
    valaopts = opt.add_option_group("Vala Compiler Options")
    valaopts.add_option(
        "--vala-target-glib",
        default=None,
        dest="vala_target_glib",
        metavar="MAJOR.MINOR",
        help="Target version of glib for Vala GObject code generation",
    )


extension(".vala", ".gs")(vala_file)
conf(find_valac)
conf(check_vala)
conf(check_vala_deps)
开发者ID:spo11,项目名称:archlinux,代码行数:30,代码来源:vala.py

示例13: bison


class bison(Task.Task):
    color = "BLUE"
    run_str = "${BISON} ${BISONFLAGS} ${SRC[0].abspath()} -o ${TGT[0].name}"
    ext_out = [".h"]


def big_bison(self, node):
    has_h = "-d" in self.env["BISONFLAGS"]
    outs = []
    if node.name.endswith(".yc"):
        outs.append(node.change_ext(".tab.cc"))
        if has_h:
            outs.append(node.change_ext(".tab.hh"))
    else:
        outs.append(node.change_ext(".tab.c"))
        if has_h:
            outs.append(node.change_ext(".tab.h"))
    tsk = self.create_task("bison", node, outs)
    tsk.cwd = node.parent.get_bld().abspath()
    self.source.append(outs[0])


def configure(conf):
    conf.find_program("bison", var="BISON")
    conf.env.BISONFLAGS = ["-d"]


extension(".y", ".yc", ".yy")(big_bison)
开发者ID:mirsys,项目名称:glmark2,代码行数:28,代码来源:bison.py

示例14: 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)
开发者ID:ETLin,项目名称:ns3-h264-svc,代码行数:31,代码来源:python.py

示例15: 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)
开发者ID:janbre,项目名称:NUTS,代码行数:30,代码来源:python.py


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