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


Python Utils.def_attrs方法代码示例

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


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

示例1: apply_java

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_java(self):
    Utils.def_attrs(
        self, jarname="", classpath="", sourcepath=".", srcdir=".", jar_mf_attributes={}, jar_mf_classpath=[]
    )
    nodes_lst = []
    if not self.classpath:
        if not self.env["CLASSPATH"]:
            self.env["CLASSPATH"] = ".." + os.pathsep + "."
    else:
        self.env["CLASSPATH"] = self.classpath
    if isinstance(self.srcdir, self.path.__class__):
        srcdir_node = self.srcdir
    else:
        srcdir_node = self.path.find_dir(self.srcdir)
    if not srcdir_node:
        raise Errors.WafError("could not find srcdir %r" % self.srcdir)
    self.env["OUTDIR"] = [srcdir_node.get_src().srcpath()]
    self.javac_task = tsk = self.create_task("javac")
    tsk.srcdir = srcdir_node
    if getattr(self, "compat", None):
        tsk.env.append_value("JAVACFLAGS", ["-source", self.compat])
    if hasattr(self, "sourcepath"):
        fold = [
            isinstance(x, self.path.__class__) and x or self.path.find_dir(x) for x in self.to_list(self.sourcepath)
        ]
        names = os.pathsep.join([x.srcpath() for x in fold])
    else:
        names = srcdir_node.srcpath()
    if names:
        tsk.env.append_value("JAVACFLAGS", ["-sourcepath", names])
开发者ID:RunarFreyr,项目名称:waz,代码行数:32,代码来源:javaw.py

示例2: apply_java

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_java(self):
	Utils.def_attrs(self,jarname='',classpath='',sourcepath='.',srcdir='.',jar_mf_attributes={},jar_mf_classpath=[])
	nodes_lst=[]
	outdir=getattr(self,'outdir',None)
	if outdir:
		if not isinstance(outdir,Node.Node):
			outdir=self.path.get_bld().make_node(self.outdir)
	else:
		outdir=self.path.get_bld()
	outdir.mkdir()
	self.env['OUTDIR']=outdir.abspath()
	self.javac_task=tsk=self.create_task('javac')
	tmp=[]
	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
	if getattr(self,'compat',None):
		tsk.env.append_value('JAVACFLAGS',['-source',self.compat])
	if hasattr(self,'sourcepath'):
		fold=[isinstance(x,Node.Node)and x or self.path.find_dir(x)for x in self.to_list(self.sourcepath)]
		names=os.pathsep.join([x.srcpath()for x in fold])
	else:
		names=[x.srcpath()for x in tsk.srcdir]
	if names:
		tsk.env.append_value('JAVACFLAGS',['-sourcepath',names])
开发者ID:spo11,项目名称:archlinux,代码行数:36,代码来源:javaw.py

示例3: apply_haxe

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_haxe(self):
    Utils.def_attrs(self,
        target="", classpath="", flags="", libs="", swflib=None);

    classpath = Utils.to_list(self.classpath)
    flags = Utils.to_list(self.flags)
    target = self.target;

    inputs = []

    if target.endswith(".swf"):
        flags += ["-swf", target, "--flash-strict", "-D", "nativeTrace"]
        if (self.swflib is not None):
            swflib = self.path.get_bld().make_node(self.swflib)
            inputs += [swflib]
            flags += ["-swf-lib", str(swflib)]
    elif target.endswith(".js"):
        flags += ["-js", target]
    elif target.endswith(".n"):
        flags += ["-neko", target]
    else:
        raise "Unsupported target file type!"

    for lib in Utils.to_list(self.libs):
        flags += ["-lib", lib]

    task = self.create_task("haxe", inputs, self.path.get_bld().make_node(target))
    task.classpath = [self.path.find_node(cp) for cp in classpath]
    task.env.flags = flags
    self.haxe_task = task
开发者ID:flyingstar16,项目名称:flambe,代码行数:32,代码来源:haxe.py

示例4: apply_copy

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_copy(self):
    Utils.def_attrs(self, fun=copy_func)
    self.default_install_path = 0

    lst = self.to_list(self.source)
    self.meths.remove("process_source")

    for filename in lst:
        node = self.path.find_resource(filename)
        if not node:
            raise Errors.WafError("cannot find input file %s for processing" % filename)

        target = self.target
        if not target or len(lst) > 1:
            target = node.name

        # TODO the file path may be incorrect
        newnode = self.path.find_or_declare(target)

        tsk = self.create_task("copy", node, newnode)
        tsk.fun = self.fun
        tsk.chmod = getattr(self, "chmod", Utils.O644)

        if not tsk.env:
            tsk.debug()
            raise Errors.WafError("task without an environment")
开发者ID:RunarFreyr,项目名称:waz,代码行数:28,代码来源:misc.py

示例5: apply_scalac

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_scalac(self):

	Utils.def_attrs(self, jarname='', classpath='',
		sourcepath='.', srcdir='.',
		jar_mf_attributes={}, jar_mf_classpath=[])

	outdir = getattr(self, 'outdir', None)
	if outdir:
		if not isinstance(outdir, Node.Node):
			outdir = self.path.get_bld().make_node(self.outdir)
	else:
		outdir = self.path.get_bld()
	outdir.mkdir()
	self.env['OUTDIR'] = outdir.abspath()

	self.scalac_task = tsk = self.create_task('scalac')
	tmp = []

	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
开发者ID:BillTian,项目名称:waf,代码行数:32,代码来源:scala.py

示例6: init_cmd_output

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def init_cmd_output(self):
    Utils.def_attrs(
        self,
        stdin=None,
        stdout=None,
        stderr=None,
        # the command to execute
        command=None,
        # whether it is an external command; otherwise it is assumed
        # to be an executable binary or script that lives in the
        # source or build tree.
        command_is_external=False,
        # extra parameters (argv) to pass to the command (excluding
        # the command itself)
        argv=[],
        # dependencies to other objects -> this is probably not what you want (ita)
        # values must be 'task_gen' instances (not names!)
        dependencies=[],
        # dependencies on env variable contents
        dep_vars=[],
        # input files that are implicit, i.e. they are not
        # stdin, nor are they mentioned explicitly in argv
        hidden_inputs=[],
        # output files that are implicit, i.e. they are not
        # stdout, nor are they mentioned explicitly in argv
        hidden_outputs=[],
        # change the subprocess to this cwd (must use obj.input_dir() or output_dir() here)
        cwd=None,
        # OS environment variables to pass to the subprocess
        # if None, use the default environment variables unchanged
        os_env=None,
    )
开发者ID:RunarFreyr,项目名称:waz,代码行数:34,代码来源:misc.py

示例7: apply_haxe

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_haxe(self):
    Utils.def_attrs(self,
        target="", classpath="", flags="", libs="", swflib=None);

    classpath = Utils.to_list(self.classpath)
    flags = Utils.to_list(self.flags)
    target = self.target;

    inputs = []
    outputs = [ self.path.get_bld().make_node(target) ]

    if target.endswith(".swf"):
        flags += ["-swf", target, "--flash-strict", "-D", "nativeTrace",
            "-swf-header", "640:480:60:ffffff"]
        if (self.swflib is not None):
            swflib = self.path.get_bld().make_node(self.swflib)
            inputs += [swflib]
            flags += ["-swf-lib", str(swflib)]
    elif target.endswith(".js"):
        if "-debug" in flags:
            outputs += [self.path.get_bld().make_node(target + ".map")]
        flags += ["-js", target, "--js-modern"]
    elif target.endswith(".n"):
        flags += ["-neko", target]
    else:
        raise "Unsupported target file type!"

    for lib in Utils.to_list(self.libs):
        flags += ["-lib", lib]

    task = self.create_task("haxe", inputs, outputs)
    task.classpath = classpath
    task.env.flags = flags
    self.haxe_task = task
开发者ID:pekuja,项目名称:flambe,代码行数:36,代码来源:haxe.py

示例8: apply_java

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_java(self):
	Utils.def_attrs(self, jarname='', jaropts='', classpath='',
		sourcepath='.', srcdir='.', source_re='**/*.java',
		jar_mf_attributes={}, jar_mf_classpath=[])

	nodes_lst = []

	if not self.classpath:
		if not self.env['CLASSPATH']:
			self.env['CLASSPATH'] = '..' + os.pathsep + '.'
	else:
		self.env['CLASSPATH'] = self.classpath

	srcdir_node = self.path.find_dir(self.srcdir)
	if not srcdir_node:
		raise Errors.WafError('could not find srcdir %r' % self.srcdir)

	src_nodes = srcdir_node.ant_glob(self.source_re)
	bld_nodes = [x.change_ext('.class') for x in src_nodes]
	for x in src_nodes:
		x.sig = Utils.h_file(x.abspath())

	self.env['OUTDIR'] = [srcdir_node.get_bld().abspath()]

	tsk = self.create_task('javac')
	tsk.set_inputs(src_nodes)
	tsk.set_outputs(bld_nodes)

	if getattr(self, 'compat', None):
		tsk.env.append_value('JAVACFLAGS', ['-source', self.compat])

	if hasattr(self, 'sourcepath'):
		fold = [self.path.find_dir(x) for x in self.to_list(self.sourcepath)]
		names = os.pathsep.join([x.srcpath() for x in fold])
	else:
		names = srcdir_node.srcpath()

	if names:
		tsk.env.append_value('JAVACFLAGS', ['-sourcepath', names])

	if self.jarname:
		tsk = self.create_task('jar_create')
		tsk.set_outputs(self.path.find_or_declare(self.jarname))

		if not self.env['JAROPTS']:
			if self.jaropts:
				self.env['JAROPTS'] = self.jaropts
			else:
				dirs = '.'
				self.env['JAROPTS'] = ['-C', ''.join(self.env['OUTDIR']), dirs]
开发者ID:zsx,项目名称:waf,代码行数:52,代码来源:javaw.py

示例9: apply_java

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_java(self):
    """
	Create a javac task for compiling *.java files*. There can be
	only one javac task by task generator.
	"""
    Utils.def_attrs(
        self, jarname="", classpath="", sourcepath=".", srcdir=".", jar_mf_attributes={}, jar_mf_classpath=[]
    )

    nodes_lst = []

    outdir = getattr(self, "outdir", None)
    if outdir:
        if not isinstance(outdir, Node.Node):
            outdir = self.path.get_bld().make_node(self.outdir)
    else:
        outdir = self.path.get_bld()
    outdir.mkdir()
    self.outdir = outdir
    self.env["OUTDIR"] = outdir.abspath()

    self.javac_task = tsk = self.create_task("javac")
    tmp = []

    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

    if getattr(self, "compat", None):
        tsk.env.append_value("JAVACFLAGS", ["-source", self.compat])

    if hasattr(self, "sourcepath"):
        fold = [isinstance(x, Node.Node) and x or self.path.find_dir(x) for x in self.to_list(self.sourcepath)]
        names = os.pathsep.join([x.srcpath() for x in fold])
    else:
        names = [x.srcpath() for x in tsk.srcdir]

    if names:
        tsk.env.append_value("JAVACFLAGS", ["-sourcepath", names])
开发者ID:mrotaru,项目名称:waf,代码行数:50,代码来源:javaw.py

示例10: init_ml

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
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,
		native_env = None,
		compiled_tasks = [],
		includes = '',
		uselib = '',
		are_deps_set = 0)
开发者ID:JodyGoldberg,项目名称:waf,代码行数:19,代码来源:ocaml.py

示例11: apply_subst

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_subst(self):
    Utils.def_attrs(self, fun=subst_func)
    lst = self.to_list(self.source)
    self.meths.remove("process_source")

    self.dict = getattr(self, "dict", {})

    for filename in lst:
        node = self.path.find_resource(filename)
        if not node:
            raise Errors.WafError("cannot find input file %s for processing" % filename)

        if self.target:
            newnode = self.path.find_or_declare(self.target)
        else:
            newnode = node.change_ext("")

        try:
            self.dict = self.dict.get_merged_dict()
        except AttributeError:
            pass

        if self.dict and not self.env["DICT_HASH"]:
            self.env = self.env.derive()
            keys = list(self.dict.keys())
            keys.sort()
            lst = [self.dict[x] for x in keys]
            self.env["DICT_HASH"] = str(Utils.h_list(lst))

        tsk = self.create_task("copy", node, newnode)
        tsk.fun = self.fun
        tsk.dict = self.dict
        tsk.dep_vars = ["DICT_HASH"]
        tsk.chmod = getattr(self, "chmod", Utils.O644)

        if not tsk.env:
            tsk.debug()
            raise Errors.WafError("task without an environment")
开发者ID:RunarFreyr,项目名称:waz,代码行数:40,代码来源:misc.py

示例12: apply_java

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def apply_java(self):
	Utils.def_attrs(self, jarname='', classpath='',
		sourcepath='.', srcdir='.',
		jar_mf_attributes={}, jar_mf_classpath=[])

	nodes_lst = []

	if not self.classpath:
		if not self.env['CLASSPATH']:
			self.env['CLASSPATH'] = '..' + os.pathsep + '.'
	else:
		self.env['CLASSPATH'] = self.classpath

	if isinstance(self.srcdir, self.path.__class__):
		srcdir_node = self.srcdir
	else:
		srcdir_node = self.path.find_dir(self.srcdir)
	if not srcdir_node:
		raise Errors.WafError('could not find srcdir %r' % self.srcdir)

	self.env['OUTDIR'] = [srcdir_node.get_src().srcpath()]

	self.javac_task = tsk = self.create_task('javac')
	tsk.srcdir = srcdir_node

	if getattr(self, 'compat', None):
		tsk.env.append_value('JAVACFLAGS', ['-source', self.compat])

	if hasattr(self, 'sourcepath'):
		fold = [isinstance(x, self.path.__class__) and x or self.path.find_dir(x) for x in self.to_list(self.sourcepath)]
		names = os.pathsep.join([x.srcpath() for x in fold])
	else:
		names = srcdir_node.srcpath()

	if names:
		tsk.env.append_value('JAVACFLAGS', ['-sourcepath', names])

	"""
开发者ID:RunarFreyr,项目名称:waz,代码行数:40,代码来源:javaw.py

示例13: ping

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def ping(self):
	Utils.def_attrs(self,srcglob='**')
	srcdir=getattr(self,'srcdir',None)	
	if srcdir:
		if isinstance(srcdir,Node.Node):
			srcnode=srcdir
		else:
			srcnode=self.path.find_node(srcdir)
	else:
		self.bld.fatal("You must specifiy a source dir")
	if not srcnode:
		self.bld.fatal("Invalid source directory: %s" % srcdir)
	
	outdir=getattr(self,'outdir',None)	
	if outdir:
		if not isinstance(outdir,Node.Node):
			outdir=self.path.get_bld().make_node(self.outdir)
	else:
		outdir=self.path.get_bld()
	for input in srcnode.ant_glob(self.srcglob):
		tsk = self.create_task('Copy')
		output=outdir.find_or_declare(input.path_from(srcnode))
		tsk.set_inputs(input)
		tsk.set_outputs(output)
开发者ID:kk-electronic,项目名称:KKPortal,代码行数:26,代码来源:helper.py

示例14: init_command

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def init_command(self):
	Utils.def_attrs(self,
					# other variables that can be used in the command: ${VARIABLE}
					variables = None,
					rule='')
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:7,代码来源:command.py

示例15: halide

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import def_attrs [as 别名]
def halide(self):
	Utils.def_attrs(self,
	 args=[],
	 halide_env={},
	)

	bld = self.bld

	env = self.halide_env
	try:
		if isinstance(env, str):
			env = dict(x.split('=') for x in env.split())
		elif isinstance(env, list):
			env = dict(x.split('=') for x in env)
		assert isinstance(env, dict)
	except Exception as e:
		if not isinstance(e, ValueError) \
		 and not isinstance(e, AssertionError):
			raise
		raise Errors.WafError(
		 "halide_env must be under the form" \
		 " {'HL_x':'a', 'HL_y':'b'}" \
		 " or ['HL_x=y', 'HL_y=b']" \
		 " or 'HL_x=y HL_y=b'")

	src = self.to_nodes(self.source)
	assert len(src) == 1, "Only one source expected"
	src = src[0]

	args = Utils.to_list(self.args)

	def change_ext(src, ext):
		# Return a node with a new extension, in an appropriate folder
		name = src.name
		xpos = src.name.rfind('.')
		if xpos == -1:
			xpos = len(src.name)
		newname = name[:xpos] + ext
		if src.is_child_of(bld.bldnode):
			node = src.get_src().parent.find_or_declare(newname)
		else:
			node = bld.bldnode.find_or_declare(newname)
		return node

	def to_nodes(self, lst, path=None):
		tmp = []
		path = path or self.path
		find = path.find_or_declare

		if isinstance(lst, self.path.__class__):
			lst = [lst]

		for x in Utils.to_list(lst):
			if isinstance(x, str):
				node = find(x)
			else:
				node = x
			tmp.append(node)
		return tmp

	tgt = to_nodes(self, self.target)
	if not tgt:
		tgt = [change_ext(src, '.o'), change_ext(src, '.h')]
	cwd = tgt[0].parent.abspath()
	task = self.create_task('run_halide_gen', src, tgt, cwd=cwd)
	task.env.append_unique('HALIDE_ARGS', args)
	if task.env.env == []:
		task.env.env = {}
	task.env.env.update(env)
	task.env.HALIDE_ENV = " ".join(("%s=%s" % (k,v)) for (k,v) in sorted(env.items()))
	task.env.HALIDE_ARGS = args

	try:
		self.compiled_tasks.append(task)
	except AttributeError:
		self.compiled_tasks = [task]
	self.source = []
开发者ID:JodyGoldberg,项目名称:waf,代码行数:79,代码来源:halide.py


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