• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python waflib.TaskGen类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: enable_support

def enable_support(cc, cxx):
    if cxx or not cc:
        make_cxx_batch = TaskGen.extension(".cpp", ".cc", ".cxx", ".C", ".c++")(make_batch_fun("cxx"))
    if cc:
        make_c_batch = TaskGen.extension(".c")(make_batch_fun("c"))
    else:
        TaskGen.task_gen.mappings[".c"] = TaskGen.task_gen.mappings[".cpp"]
开发者ID:maksqwe,项目名称:jack2,代码行数:7,代码来源:unity.py


示例2: _build_pdf

def _build_pdf(ctx):
    from waflib import TaskGen

    TaskGen.declare_chain(
        name    = 'rst2latex',
        rule    = '${RST2LATEX} ${RST2LATEX_FLAGS} ${SRC} ${TGT}',
        ext_in  = '.rst',
        ext_out = '.tex' )

    TaskGen.declare_chain(
        name    = 'pdflatex',
        rule    = '${PDFLATEX} ${PDFLATEX_FLAGS} ${SRC}; ' * 2,
        ext_in  = '.tex',
        ext_out = '.pdf',
        shell   = True )

    ctx.env.RST2LATEX_FLAGS = [
        '--config=' + ctx.srcnode.abspath() + '/DOCS/man/docutils.conf'
    ]

    ctx.env.PDFLATEX_FLAGS = [
        '--interaction=batchmode',
        '--output-directory=DOCS/man/en/',
        '--jobname=mpv'
    ]

    ctx(source = 'DOCS/man/en/mpv.rst')
    _add_rst_manual_dependencies(ctx)
    ctx.install_files(ctx.env.DOCDIR, ['DOCS/man/en/mpv.pdf'])
开发者ID:keeperofdakeys,项目名称:mpv,代码行数:29,代码来源:wscript_build.py


示例3: enhance_lib

def enhance_lib():
	"""
	modify existing classes and methods
	"""
	for m in meths_typos:
		replace(m)

	# catch '..' in ant_glob patterns
	old_ant_glob = Node.Node.ant_glob
	def ant_glob(self, *k, **kw):
		for x in k[0].split('/'):
			if x == '..':
				Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" % k[0])
		return old_ant_glob(self, *k, **kw)
	Node.Node.ant_glob = ant_glob

	# catch conflicting ext_in/ext_out/before/after declarations
	old = Task.is_before
	def is_before(t1, t2):
		ret = old(t1, t2)
		if ret and old(t2, t1):
			Logs.error('Contradictory order constraints in classes %r %r' % (t1, t2))
		return ret
	Task.is_before = is_before

	# check for bld(feature='cshlib') where no 'c' is given - this can be either a mistake or on purpose
	# so we only issue a warning
	def check_err_features(self):
		lst = self.to_list(self.features)
		if 'shlib' in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in ('c', 'cxx', 'd', 'fc'):
			if not x in lst and lst and lst[0] in [x+y for y in ('program', 'shlib', 'stlib')]:
				Logs.error('%r features is probably missing %r' % (self, x))
	TaskGen.feature('*')(check_err_features)
开发者ID:SjB,项目名称:waf,代码行数:35,代码来源:errcheck.py


示例4: enhance_lib

def enhance_lib():
	for m in meths_typos:
		replace(m)
	old_ant_glob=Node.Node.ant_glob
	def ant_glob(self,*k,**kw):
		for x in k[0].split('/'):
			if x=='..':
				Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'"%k[0])
		return old_ant_glob(self,*k,**kw)
	Node.Node.ant_glob=ant_glob
	old=Task.is_before
	def is_before(t1,t2):
		ret=old(t1,t2)
		if ret and old(t2,t1):
			Logs.error('Contradictory order constraints in classes %r %r'%(t1,t2))
		return ret
	Task.is_before=is_before
	def check_err_features(self):
		lst=self.to_list(self.features)
		if'shlib'in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in('c','cxx','d','fc'):
			if not x in lst and lst and lst[0]in[x+y for y in('program','shlib','stlib')]:
				Logs.error('%r features is probably missing %r'%(self,x))
	TaskGen.feature('*')(check_err_features)
开发者ID:RunarFreyr,项目名称:waz,代码行数:25,代码来源:errcheck.py


示例5: enable_support

def enable_support(cc, cxx):
	if cxx or not cc:
		TaskGen.extension('.cpp', '.cc', '.cxx', '.C', '.c++')(make_batch_fun('cxx'))
	if cc:
		TaskGen.extension('.c')(make_batch_fun('c'))
	else:
		TaskGen.task_gen.mappings['.c'] = TaskGen.task_gen.mappings['.cpp']
开发者ID:BillTian,项目名称:waf,代码行数:7,代码来源:unity.py


示例6: enhance_lib

def enhance_lib():
	for m in meths_typos:
		replace(m)
	old_ant_glob=Node.Node.ant_glob
	def ant_glob(self,*k,**kw):
		if k:
			lst=Utils.to_list(k[0])
			for pat in lst:
				if'..'in pat.split('/'):
					Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'"%k[0])
		return old_ant_glob(self,*k,**kw)
	Node.Node.ant_glob=ant_glob
	old=Task.is_before
	def is_before(t1,t2):
		ret=old(t1,t2)
		if ret and old(t2,t1):
			Logs.error('Contradictory order constraints in classes %r %r'%(t1,t2))
		return ret
	Task.is_before=is_before
	def check_err_features(self):
		lst=self.to_list(self.features)
		if'shlib'in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in('c','cxx','d','fc'):
			if not x in lst and lst and lst[0]in[x+y for y in('program','shlib','stlib')]:
				Logs.error('%r features is probably missing %r'%(self,x))
	TaskGen.feature('*')(check_err_features)
	def check_err_order(self):
		if not hasattr(self,'rule'):
			for x in('before','after','ext_in','ext_out'):
				if hasattr(self,x):
					Logs.warn('Erroneous order constraint %r on non-rule based task generator %r'%(x,self))
		else:
			for x in('before','after'):
				for y in self.to_list(getattr(self,x,[])):
					if not Task.classes.get(y,None):
						Logs.error('Erroneous order constraint %s=%r on %r'%(x,y,self))
	TaskGen.feature('*')(check_err_order)
	old_compile=Build.BuildContext.compile
	def check_compile(self):
		check_invalid_constraints(self)
		try:
			ret=old_compile(self)
		finally:
			check_same_targets(self)
		return ret
	Build.BuildContext.compile=check_compile
	def getattri(self,name,default=None):
		if name=='append'or name=='add':
			raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique')
		elif name=='prepend':
			raise Errors.WafError('env.prepend does not exist: use env.prepend_value')
		if name in self.__slots__:
			return object.__getattr__(self,name,default)
		else:
			return self[name]
	ConfigSet.ConfigSet.__getattr__=getattri
开发者ID:AKASeon,项目名称:Whatever,代码行数:57,代码来源:errcheck.py


示例7: enhance_lib

def enhance_lib():
	"""
	modify existing classes and methods
	"""
	for m in meths_typos:
		replace(m)

	# catch '..' in ant_glob patterns
	old_ant_glob = Node.Node.ant_glob
	def ant_glob(self, *k, **kw):
		for x in k[0].split('/'):
			if x == '..':
				Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" % k[0])
		return old_ant_glob(self, *k, **kw)
	Node.Node.ant_glob = ant_glob

	# catch conflicting ext_in/ext_out/before/after declarations
	old = Task.is_before
	def is_before(t1, t2):
		ret = old(t1, t2)
		if ret and old(t2, t1):
			Logs.error('Contradictory order constraints in classes %r %r' % (t1, t2))
		return ret
	Task.is_before = is_before

	# check for bld(feature='cshlib') where no 'c' is given - this can be either a mistake or on purpose
	# so we only issue a warning
	def check_err_features(self):
		lst = self.to_list(self.features)
		if 'shlib' in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in ('c', 'cxx', 'd', 'fc'):
			if not x in lst and lst and lst[0] in [x+y for y in ('program', 'shlib', 'stlib')]:
				Logs.error('%r features is probably missing %r' % (self, x))
	TaskGen.feature('*')(check_err_features)

	# check for @extension used with @feature/@before/@after
	old_compile = Build.BuildContext.compile
	def check_compile(self):
		feat = set([])
		for x in list(TaskGen.feats.values()):
			feat.union(set(x))
		for (x, y) in TaskGen.task_gen.prec.items():
			feat.add(x)
			feat.union(set(y))
		ext = set([])
		for x in TaskGen.task_gen.mappings.values():
			ext.add(x.__name__)
		invalid = ext & feat
		if invalid:
			Logs.error('The methods %r have invalid annotations:  @extension <-> @feature/@before/@after' % list(invalid))

		return old_compile(self)
	Build.BuildContext.compile = check_compile
开发者ID:ita1024,项目名称:node,代码行数:54,代码来源:errcheck.py


示例8: enhance_lib

def enhance_lib():
	for m in meths_typos:
		replace(m)
	old_ant_glob=Node.Node.ant_glob
	def ant_glob(self,*k,**kw):
		if k:
			for x in k[0].split('/'):
				if x=='..':
					Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'"%k[0])
		return old_ant_glob(self,*k,**kw)
	Node.Node.ant_glob=ant_glob
	old=Task.is_before
	def is_before(t1,t2):
		ret=old(t1,t2)
		if ret and old(t2,t1):
			Logs.error('Contradictory order constraints in classes %r %r'%(t1,t2))
		return ret
	Task.is_before=is_before
	def check_err_features(self):
		lst=self.to_list(self.features)
		if'shlib'in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in('c','cxx','d','fc'):
			if not x in lst and lst and lst[0]in[x+y for y in('program','shlib','stlib')]:
				Logs.error('%r features is probably missing %r'%(self,x))
	TaskGen.feature('*')(check_err_features)
	old_compile=Build.BuildContext.compile
	def check_compile(self):
		feat=set([])
		for x in list(TaskGen.feats.values()):
			feat.union(set(x))
		for(x,y)in TaskGen.task_gen.prec.items():
			feat.add(x)
			feat.union(set(y))
		ext=set([])
		for x in TaskGen.task_gen.mappings.values():
			ext.add(x.__name__)
		invalid=ext&feat
		if invalid:
			Logs.error('The methods %r have invalid annotations:  @extension <-> @feature/@before/@after'%list(invalid))
		return old_compile(self)
	Build.BuildContext.compile=check_compile
	def getattr(self,name):
		if name=='append'or name=='add':
			raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique')
		elif name=='prepend':
			raise Errors.WafError('env.prepend does not exist: use env.prepend_value')
		if name in self.__slots__:
			return object.__getattr__(self,name)
		else:
			return self[name]
	ConfigSet.ConfigSet.__getattr__=getattr
开发者ID:spo11,项目名称:archlinux,代码行数:52,代码来源:errcheck.py


示例9: __call__

	def __call__(self, *k, **kw):
		"""Creates a task generator"""
		kw['bld'] = self
		ret = TaskGen.task_gen(*k, **kw)
		self.task_gen_cache_names = {} # reset the cache, each time
		self.add_to_group(ret, group=kw.get('group', None))
		return ret
开发者ID:zsx,项目名称:waf,代码行数:7,代码来源:Build.py


示例10: before

def before(*k):
	for key, val in repl.items():
		if key in k:
			if Logs.verbose > 1:
				Logs.info('before %s -> %s' % (key, val))
			k.replace(key, val)
	return TaskGen.before_method(*k)
开发者ID:dfroger,项目名称:waf,代码行数:7,代码来源:compat15.py


示例11: after

def after(*k):
	for key, val in repl.items():
		if key in k:
			if Logs.verbose > 1:
				Logs.error('after %s -> %s' % (key, val))
			k.replace(key, val)
	return TaskGen.after_method(*k)
开发者ID:dfroger,项目名称:waf,代码行数:7,代码来源:compat15.py


示例12: _build_pdf

def _build_pdf(ctx):
    from waflib import TaskGen

    TaskGen.declare_chain(
        name="rst2latex", rule="${RST2LATEX} ${RST2LATEX_FLAGS} ${SRC} ${TGT}", ext_in=".rst", ext_out=".tex"
    )

    TaskGen.declare_chain(
        name="pdflatex", rule="${PDFLATEX} ${PDFLATEX_FLAGS} ${SRC}; " * 2, ext_in=".tex", ext_out=".pdf", shell=True
    )

    ctx.env.RST2LATEX_FLAGS = ["--config=" + ctx.srcnode.abspath() + "/DOCS/man/docutils.conf"]

    ctx.env.PDFLATEX_FLAGS = ["--interaction=batchmode", "--output-directory=DOCS/man/en/", "--jobname=mpv"]

    ctx(source="DOCS/man/en/mpv.rst")
    _add_rst_manual_dependencies(ctx)
    ctx.install_files(ctx.env.DOCDIR, ["DOCS/man/en/mpv.pdf"])
开发者ID:hobbit19,项目名称:mpv,代码行数:18,代码来源:wscript_build.py


示例13: __call__

	def __call__(self, *k, **kw):
		# this is one way of doing it, one could use a task generator method too
		bld = kw['bld'] = bld_proxy(self)
		ret = TaskGen.task_gen(*k, **kw)
		self.task_gen_cache_names = {}
		self.add_to_group(ret, group=kw.get('group'))
		ret.bld = bld
		bld.set_key(ret.path.abspath().replace(os.sep, '') + str(ret.idx))
		return ret
开发者ID:ventosus,项目名称:lv2,代码行数:9,代码来源:fast_partial.py


示例14: __call__

	def __call__(self, *k, **kw):
		"""
		Create a task generator, adding it to the current build group. The following forms are equivalent::

			def build(bld):
				tg = bld(a=1, b=2)

			def build(bld):
				tg = bld()
				tg.a = 1
				tg.b = 2
		"""
		kw['bld'] = self
		ret = TaskGen.task_gen(*k, **kw)
		self.task_gen_cache_names = {} # reset the cache, each time
		self.add_to_group(ret, group=kw.get('group', None))
		return ret
开发者ID:SjB,项目名称:waf,代码行数:17,代码来源:Build.py


示例15: __call__

	def __call__(self, *k, **kw):
		"""
		Create a task generator and add it to the current build group. The following forms are equivalent::

			def build(bld):
				tg = bld(a=1, b=2)

			def build(bld):
				tg = bld()
				tg.a = 1
				tg.b = 2

			def build(bld):
				tg = TaskGen.task_gen(a=1, b=2)
				bld.add_to_group(tg, None)

		:param group: group name to add the task generator to
		:type group: string
		"""
		kw['bld'] = self
		ret = TaskGen.task_gen(*k, **kw)
		self.task_gen_cache_names = {} # reset the cache, each time
		self.add_to_group(ret, group=kw.get('group'))
		return ret
开发者ID:blablack,项目名称:ams-lv2,代码行数:24,代码来源:Build.py


示例16: build


#.........这里部分代码省略.........
        ( "video/out/win_state.c"),
        ( "video/out/x11_common.c",              "x11" ),
        ( "video/out/drm_common.c",              "drm" ),

        ## osdep
        ( getch2_c ),
        ( "osdep/io.c" ),
        ( "osdep/timer.c" ),
        ( timer_c ),
        ( "osdep/threads.c" ),

        ( "osdep/ar/HIDRemote.m",                "apple-remote" ),
        ( "osdep/macosx_application.m",          "cocoa" ),
        ( "osdep/macosx_events.m",               "cocoa" ),
        ( "osdep/semaphore_osx.c" ),
        ( "osdep/subprocess.c" ),
        ( "osdep/subprocess-posix.c",            "posix-spawn" ),
        ( "osdep/subprocess-win.c",              "os-win32" ),
        ( "osdep/path-macosx.m",                 "cocoa" ),
        ( "osdep/path-unix.c"),
        ( "osdep/path-win.c",                    "os-win32" ),
        ( "osdep/path-win.c",                    "os-cygwin" ),
        ( "osdep/glob-win.c",                    "glob-win32-replacement" ),
        ( "osdep/w32_keyboard.c",                "os-win32" ),
        ( "osdep/w32_keyboard.c",                "os-cygwin" ),
        ( "osdep/mpv.rc",                        "win32-executable" ),
        ( "osdep/win32/pthread.c",               "win32-internal-pthreads"),

        ## tree_allocator
        "ta/ta.c", "ta/ta_talloc.c", "ta/ta_utils.c"
    ]

    if ctx.dependency_satisfied('win32-executable'):
        from waflib import TaskGen

        TaskGen.declare_chain(
            name    = 'windres',
            rule    = '${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}',
            ext_in  = '.rc',
            ext_out = '-rc.o',
            color   = 'PINK')

        ctx.env.WINDRES_FLAGS = [
            '--include-dir={0}'.format(ctx.bldnode.abspath()),
            '--include-dir={0}'.format(ctx.srcnode.abspath())
        ]

        for node in 'osdep/mpv.exe.manifest etc/mpv-icon.ico'.split():
            ctx.add_manual_dependency(
                ctx.path.find_node('osdep/mpv.rc'),
                ctx.path.find_node(node))

        version = ctx.bldnode.find_node('version.h')
        if version:
            ctx.add_manual_dependency(
                ctx.path.find_node('osdep/mpv.rc'),
                version)

    if ctx.dependency_satisfied('cplayer') or ctx.dependency_satisfied('test'):
        ctx(
            target       = "objects",
            source       = ctx.filtered_sources(sources),
            use          = ctx.dependencies_use(),
            includes     = _all_includes(ctx),
            features     = "c",
        )
开发者ID:da1l6,项目名称:mpv,代码行数:67,代码来源:wscript_build.py


示例17: build


#.........这里部分代码省略.........
        ("video/out/vo_opengl_old.c", "gl"),
        ("video/out/vo_sdl.c", "sdl2"),
        ("video/out/vo_vaapi.c", "vaapi"),
        ("video/out/vo_vdpau.c", "vdpau"),
        ("video/out/vo_wayland.c", "wayland"),
        ("video/out/vo_x11.c", "x11"),
        ("video/out/vo_xv.c", "xv"),
        ("video/out/w32_common.c", "gdi"),
        ("video/out/wayland_common.c", "wayland"),
        ("video/out/x11_common.c", "x11"),
        ## osdep
        (getch2_c),
        ("osdep/io.c"),
        ("osdep/numcores.c"),
        ("osdep/timer.c"),
        (timer_c),
        ("osdep/threads.c"),
        ("osdep/ar/HIDRemote.m", "cocoa"),
        ("osdep/macosx_application.m", "cocoa"),
        ("osdep/macosx_events.m", "cocoa"),
        ("osdep/path-macosx.m", "cocoa"),
        ("osdep/path-win.c", "os-win32"),
        ("osdep/path-win.c", "os-cygwin"),
        ("osdep/glob-win.c", "glob-win32-replacement"),
        ("osdep/priority.c", "priority"),
        ("osdep/mpv.rc", "win32-executable"),
        ## tree_allocator
        "ta/ta.c",
        "ta/ta_talloc.c",
        "ta/ta_utils.c",
    ]

    if ctx.dependency_satisfied("win32-executable"):
        from waflib import TaskGen

        TaskGen.declare_chain(
            name="windres",
            rule="${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}",
            ext_in=".rc",
            ext_out="-rc.o",
            color="PINK",
        )

        ctx.env.WINDRES_FLAGS = [
            "--include-dir={0}".format(ctx.bldnode.abspath()),
            "--include-dir={0}".format(ctx.srcnode.abspath()),
        ]

        for node in "osdep/mpv.exe.manifest etc/mpv-icon.ico".split():
            ctx.add_manual_dependency(ctx.path.find_node("osdep/mpv.rc"), ctx.path.find_node(node))

    cprog_kwargs = {}
    if ctx.dependency_satisfied("macosx-bundle"):
        import os

        basepath = "TOOLS/osxbundle/mpv.app/Contents"
        cprog_kwargs["mac_app"] = True
        cprog_kwargs["mac_plist"] = os.path.join(basepath, "Info.plist")

        resources_glob = os.path.join(basepath, "Resources", "*")
        resources_nodes = ctx.srcnode.ant_glob(resources_glob)
        resources = [node.srcpath() for node in resources_nodes]
        cprog_kwargs["mac_resources"] = resources

        for resource in resources:
            res_basename = os.path.basename(resource)
开发者ID:hobbit19,项目名称:mpv,代码行数:67,代码来源:wscript_build.py


示例18: proc

    if not env.PROC_TNS_ADMIN:
        env.PROC_TNS_ADMIN = cnf.options.tns_admin
    if not env.PROC_CONNECTION:
        env.PROC_CONNECTION = cnf.options.connection
    cnf.find_program("proc", var="PROC", path_list=env.PROC_ORACLE + path.sep + "bin")


def proc(tsk):
    env = tsk.env
    gen = tsk.generator
    bld = gen.bld
    inc_nodes = gen.to_incnodes(Utils.to_list(getattr(gen, "includes", [])) + env["INCLUDES"])

    # FIXME the if-else construct will not work in python 2
    cmd = (
        [env.PROC]
        + ["SQLCHECK=SEMANTICS"]
        + (["SYS_INCLUDE=(" + ",".join(env.PROC_INCLUDES) + ")"] if env.PROC_INCLUDES else [])
        + ["INCLUDE=(" + ",".join([i.bldpath() for i in inc_nodes]) + ")"]
        + ["userid=" + env.PROC_CONNECTION]
        + ["INAME=" + tsk.inputs[0].bldpath()]
        + ["ONAME=" + tsk.outputs[0].bldpath()]
    )
    exec_env = {"ORACLE_HOME": env.PROC_ORACLE, "LD_LIBRARY_PATH": env.PROC_ORACLE + path.sep + "lib"}
    if env.PROC_TNS_ADMIN:
        exec_env["TNS_ADMIN"] = env.PROC_TNS_ADMIN
    return tsk.exec_command(cmd, env=exec_env)


TaskGen.declare_chain(name="proc", rule=proc, ext_in=".pc", ext_out=".c")
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:30,代码来源:proc.py


示例19: enhance_lib

def enhance_lib():
	"""
	modify existing classes and methods
	"""
	for m in meths_typos:
		replace(m)

	# catch '..' in ant_glob patterns
	def ant_glob(self, *k, **kw):
		if k:
			lst=Utils.to_list(k[0])
			for pat in lst:
				if '..' in pat.split('/'):
					Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'" % k[0])
		if kw.get('remove', True):
			try:
				if self.is_child_of(self.ctx.bldnode) and not kw.get('quiet', False):
					Logs.error('Using ant_glob on the build folder (%r) is dangerous (quiet=True to disable this warning)' % self)
			except AttributeError:
				pass
		return self.old_ant_glob(*k, **kw)
	Node.Node.old_ant_glob = Node.Node.ant_glob
	Node.Node.ant_glob = ant_glob

	# catch conflicting ext_in/ext_out/before/after declarations
	old = Task.is_before
	def is_before(t1, t2):
		ret = old(t1, t2)
		if ret and old(t2, t1):
			Logs.error('Contradictory order constraints in classes %r %r' % (t1, t2))
		return ret
	Task.is_before = is_before

	# check for bld(feature='cshlib') where no 'c' is given - this can be either a mistake or on purpose
	# so we only issue a warning
	def check_err_features(self):
		lst = self.to_list(self.features)
		if 'shlib' in lst:
			Logs.error('feature shlib -> cshlib, dshlib or cxxshlib')
		for x in ('c', 'cxx', 'd', 'fc'):
			if not x in lst and lst and lst[0] in [x+y for y in ('program', 'shlib', 'stlib')]:
				Logs.error('%r features is probably missing %r' % (self, x))
	TaskGen.feature('*')(check_err_features)

	# check for erroneous order constraints
	def check_err_order(self):
		if not hasattr(self, 'rule') and not 'subst' in Utils.to_list(self.features):
			for x in ('before', 'after', 'ext_in', 'ext_out'):
				if hasattr(self, x):
					Logs.warn('Erroneous order constraint %r on non-rule based task generator %r' % (x, self))
		else:
			for x in ('before', 'after'):
				for y in self.to_list(getattr(self, x, [])):
					if not Task.classes.get(y, None):
						Logs.error('Erroneous order constraint %s=%r on %r (no such class)' % (x, y, self))
	TaskGen.feature('*')(check_err_order)

	# check for @extension used with @feature/@before_method/@after_method
	def check_compile(self):
		check_invalid_constraints(self)
		try:
			ret = self.orig_compile()
		finally:
			check_same_targets(self)
		return ret
	Build.BuildContext.orig_compile = Build.BuildContext.compile
	Build.BuildContext.compile = check_compile

	# check for invalid build groups #914
	def use_rec(self, name, **kw):
		try:
			y = self.bld.get_tgen_by_name(name)
		except Errors.WafError:
			pass
		else:
			idx = self.bld.get_group_idx(self)
			odx = self.bld.get_group_idx(y)
			if odx > idx:
				msg = "Invalid 'use' across build groups:"
				if Logs.verbose > 1:
					msg += '\n  target %r\n  uses:\n  %r' % (self, y)
				else:
					msg += " %r uses %r (try 'waf -v -v' for the full error)" % (self.name, name)
				raise Errors.WafError(msg)
		self.orig_use_rec(name, **kw)
	TaskGen.task_gen.orig_use_rec = TaskGen.task_gen.use_rec
	TaskGen.task_gen.use_rec = use_rec

	# check for env.append
	def getattri(self, name, default=None):
		if name == 'append' or name == 'add':
			raise Errors.WafError('env.append and env.add do not exist: use env.append_value/env.append_unique')
		elif name == 'prepend':
			raise Errors.WafError('env.prepend does not exist: use env.prepend_value')
		if name in self.__slots__:
			return object.__getattr__(self, name, default)
		else:
			return self[name]
	ConfigSet.ConfigSet.__getattr__ = getattri
开发者ID:Jajcus,项目名称:jack2,代码行数:99,代码来源:errcheck.py


示例20: after

def after(*k):
	k = [repl.get(key, key) for key in k]
	return TaskGen.after_method(*k)
开发者ID:afeldman,项目名称:waf,代码行数:3,代码来源:compat15.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python waflib.Utils类代码示例发布时间:2022-05-26
下一篇:
Python waflib.Task类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap