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


Python Utils.to_list方法代码示例

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


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

示例1: download_tool

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def download_tool(tool, force=False):
	"""downloads a tool from the waf repository"""
	for x in Utils.to_list(Context.remote_repo):
		for sub in Utils.to_list(Context.remote_locs):
			url = '/'.join((x, sub, tool + '.py'))
			try:
				web = urlopen(url)
				if web.getcode() != 200:
					continue
			except Exception as e:
				# on python3 urlopen throws an exception
				continue
			else:
				tmp = self.root.make_node(os.sep.join((Context.waf_dir, 'waflib', 'extras', tool + '.py')))
				tmp.write(web.read())
				Logs.warn('downloaded %s from %s' % (tool, url))
				download_check(tmp)
				try:
					module = Context.load_tool(tool)
				except:
					Logs.warn('module %s from %s is unusable' % (tool, url))
					try:
						tmp.delete()
					except:
						pass
					continue
				return module
		else:
				break
		raise Errors.WafError('Could not load the Waf tool')
开发者ID:RunarFreyr,项目名称:waz,代码行数:32,代码来源:Configure.py

示例2: set_qt5_libs_to_check

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def set_qt5_libs_to_check(self):
    if not hasattr(self, "qt5_vars"):
        self.qt5_vars = QT5_LIBS
    self.qt5_vars = Utils.to_list(self.qt5_vars)
    if not hasattr(self, "qt5_vars_debug"):
        self.qt5_vars_debug = [a + "_debug" for a in self.qt5_vars]
    self.qt5_vars_debug = Utils.to_list(self.qt5_vars_debug)
开发者ID:markreyn,项目名称:ndnSIMx,代码行数:9,代码来源:qt5.py

示例3: download_tool

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def download_tool(tool, force=False, ctx=None):
	"""
	Download a Waf tool from the remote repository defined in :py:const:`waflib.Context.remote_repo`::

		$ waf configure --download
	"""
	for x in Utils.to_list(Context.remote_repo):
		for sub in Utils.to_list(Context.remote_locs):
			url = '/'.join((x, sub, tool + '.py'))
			try:
				web = urlopen(url)
				if web.getcode() != 200:
					continue
			except Exception as e:
				# on python3 urlopen throws an exception
				continue
			else:
				tmp = ctx.root.make_node(os.sep.join((Context.waf_dir, 'waflib', 'extras', tool + '.py')))
				tmp.write(web.read())
				Logs.warn('Downloaded %s from %s' % (tool, url))
				download_check(tmp)
				try:
					module = Context.load_tool(tool)
				except:
					Logs.warn('The tool %s from %s is unusable' % (tool, url))
					try:
						tmp.delete()
					except:
						pass
					continue
				return module
	raise Errors.WafError('Could not load the Waf tool')
开发者ID:ita1024,项目名称:node,代码行数:34,代码来源:Configure.py

示例4: xcheck_host_envar

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def xcheck_host_envar(conf, name, wafname=None):
	wafname = wafname or name

	chost, chost_envar = get_chost_stuff(conf)

	specific = None
	if chost:
		specific = os.environ.get('%s_%s' % (chost_envar, name), None)

	if specific:
		value = Utils.to_list(specific)
		conf.env[wafname] += value
		conf.msg('Will use cross-compilation %s from %s_%s' \
		 % (name, chost_envar, name),
		 " ".join(quote(x) for x in value))
		return


	envar = os.environ.get('HOST_%s' % name, None)
	if envar is None:
		return

	value = Utils.to_list(envar) if envar != '' else [envar]

	conf.env[wafname] = value
	conf.msg('Will use cross-compilation %s from HOST_%s' \
	 % (name, name),
	 " ".join(quote(x) for x in value))
开发者ID:kenmasumitsu,项目名称:waf,代码行数:30,代码来源:cfg_cross_gnu.py

示例5: find_file

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def find_file(self,filename,path_list=[]):
	for n in Utils.to_list(filename):
		for d in Utils.to_list(path_list):
			p=os.path.join(d,n)
			if os.path.exists(p):
				return p
	self.fatal('Could not find %r'%filename)
开发者ID:AkiraShirase,项目名称:audacity,代码行数:9,代码来源:Configure.py

示例6: set_qt5_libs_to_check

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def set_qt5_libs_to_check(self):
	self.qt5_vars = Utils.to_list(getattr(self, 'qt5_vars', []))
	if not self.qt5_vars:
		dirlst = Utils.listdir(self.env.QTLIBS)

		pat = self.env.cxxshlib_PATTERN
		if Utils.is_win32:
			pat = pat.replace('.dll', '.lib')
		if self.environ.get('QT5_FORCE_STATIC'):
			pat = self.env.cxxstlib_PATTERN
		if Utils.unversioned_sys_platform() == 'darwin':
			pat = "%s\.framework"
		re_qt = re.compile(pat%'Qt5?(?P<name>.*)'+'$')
		for x in dirlst:
			m = re_qt.match(x)
			if m:
				self.qt5_vars.append("Qt5%s" % m.group('name'))
		if not self.qt5_vars:
			self.fatal('cannot find any Qt5 library (%r)' % self.env.QTLIBS)

	qtextralibs = getattr(Options.options, 'qtextralibs', None)
	if qtextralibs:
		self.qt5_vars.extend(qtextralibs.split(','))

	if not hasattr(self, 'qt5_vars_debug'):
		self.qt5_vars_debug = [a + '_DEBUG' for a in self.qt5_vars]
	self.qt5_vars_debug = Utils.to_list(self.qt5_vars_debug)
开发者ID:JodyGoldberg,项目名称:waf,代码行数:29,代码来源:qt5.py

示例7: load

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
	def load(self,input,tooldir=None,funs=None,download=True):
		tools=Utils.to_list(input)
		if tooldir:tooldir=Utils.to_list(tooldir)
		for tool in tools:
			mag=(tool,id(self.env),funs)
			if mag in self.tool_cache:
				self.to_log('(tool %s is already loaded, skipping)'%tool)
				continue
			self.tool_cache.append(mag)
			module=None
			try:
				module=Context.load_tool(tool,tooldir)
			except ImportError as e:
				if Options.options.download:
					module=download_tool(tool,ctx=self)
					if not module:
						self.fatal('Could not load the Waf tool %r or download a suitable replacement from the repository (sys.path %r)\n%s'%(tool,sys.path,e))
				else:
					self.fatal('Could not load the Waf tool %r from %r (try the --download option?):\n%s'%(tool,sys.path,e))
			except Exception as e:
				self.to_log('imp %r (%r & %r)'%(tool,tooldir,funs))
				self.to_log(Utils.ex_stack())
				raise
			if funs is not None:
				self.eval_rules(funs)
			else:
				func=getattr(module,'configure',None)
				if func:
					if type(func)is type(Utils.readf):func(self)
					else:self.eval_rules(func)
			self.tools.append({'tool':tool,'tooldir':tooldir,'funs':funs})
开发者ID:adrwtr,项目名称:BDJogosChip8,代码行数:33,代码来源:Configure.py

示例8: exec_cfg

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

	# pkg-config version
	if 'atleast_pkgconfig_version' in kw:
		cmd = [kw['path'], '--atleast-pkgconfig-version=%s' % kw['atleast_pkgconfig_version']]
		self.cmd_and_log(cmd)
		if not 'okmsg' in kw:
			kw['okmsg'] = 'yes'
		return

	# checking for the version of a module
	for x in cfg_ver:
		y = x.replace('-', '_')
		if y in kw:
			self.cmd_and_log([kw['path'], '--%s=%s' % (x, kw[y]), kw['package']])
			if not 'okmsg' in kw:
				kw['okmsg'] = 'yes'
			self.define(self.have_define(kw.get('uselib_store', kw['package'])), 1, 0)
			break

	# retrieving the version of a module
	if 'modversion' in kw:
		version = self.cmd_and_log([kw['path'], '--modversion', kw['modversion']]).strip()
		self.define('%s_VERSION' % Utils.quote_define_name(kw.get('uselib_store', kw['modversion'])), version)
		return version

	lst = [kw['path']]

	defi = kw.get('define_variable', None)
	if not defi:
		defi = self.env.PKG_CONFIG_DEFINES or {}
	for key, val in defi.items():
		lst.append('--define-variable=%s=%s' % (key, val))

	if kw['package']:
		lst.extend(Utils.to_list(kw['package']))

	# retrieving variables of a module
	if 'variables' in kw:
		env = kw.get('env', self.env)
		uselib = kw.get('uselib_store', kw['package'].upper())
		vars = Utils.to_list(kw['variables'])
		for v in vars:
			val = self.cmd_and_log(lst + ['--variable=' + v]).strip()
			var = '%s_%s' % (uselib, v)
			env[var] = val
		if not 'okmsg' in kw:
			kw['okmsg'] = 'yes'
		return

	if 'args' in kw:
		lst += Utils.to_list(kw['args'])
	# so we assume the command-line will output flags to be parsed afterwards
	ret = self.cmd_and_log(lst)
	if not 'okmsg' in kw:
		kw['okmsg'] = 'yes'

	self.define(self.have_define(kw.get('uselib_store', kw['package'])), 1, 0)
	self.parse_flags(ret, kw.get('uselib_store', kw['package'].upper()), kw.get('env', self.env))
	return ret
开发者ID:RunarFreyr,项目名称:waz,代码行数:62,代码来源:c_config.py

示例9: exec_mf

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def exec_mf(self):
	env = self.env
	outfile = self.inputs[0].bldpath()
	manifest = outfile + '.manifest'
	if os.path.exists(manifest):
		debug('msvc: manifesttool')
		mtool = env['MT']
		if not mtool:
			return 0

		mode = ''
		# embedding mode. Different for EXE's and DLL's.
		# see: http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx
		if 'cprogram' in self.generator.features:
			mode = '1'
		elif 'cshlib' in self.generator.features or 'cxxshlib' in self.generator.features:
			mode = '2'

		debug('msvc: embedding manifest')
		#flags = ' '.join(env['MTFLAGS'] or [])

		lst = []
		lst.extend(Utils.to_list(env['MT']))
		lst.extend(Utils.to_list(env['MTFLAGS']))
		lst.extend(Utils.to_list("-manifest"))
		lst.extend(Utils.to_list(manifest))
		lst.extend(Utils.to_list("-outputresource:%s;%s" % (outfile, mode)))

		#cmd='%s %s -manifest "%s" -outputresource:"%s";#%s' % (mtool, flags,
		#	manifest, outfile, mode)
		lst = [lst]
		ret = self.exec_command(*lst)

		return ret
开发者ID:zsx,项目名称:waf,代码行数:36,代码来源:msvc.py

示例10: exec_mf

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def exec_mf(self):
	env=self.env
	mtool=env['MT']
	if not mtool:
		return 0
	self.do_manifest=False
	outfile=self.outputs[0].abspath()
	manifest=None
	for out_node in self.outputs:
		if out_node.name.endswith('.manifest'):
			manifest=out_node.abspath()
			break
	if manifest is None:
		return 0
	mode=''
	if'cprogram'in self.generator.features or'cxxprogram'in self.generator.features:
		mode='1'
	elif'cshlib'in self.generator.features or'cxxshlib'in self.generator.features:
		mode='2'
	debug('msvc: embedding manifest in mode %r'%mode)
	lst=[]
	lst.extend([env['MT']])
	lst.extend(Utils.to_list(env['MTFLAGS']))
	lst.extend(Utils.to_list("-manifest"))
	lst.extend(Utils.to_list(manifest))
	lst.extend(Utils.to_list("-outputresource:%s;%s"%(outfile,mode)))
	lst=[lst]
	return self.exec_command(*lst)
开发者ID:RunarFreyr,项目名称:waz,代码行数:30,代码来源:msvc.py

示例11: task_factory

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def task_factory(name, func=None, vars=[], color='GREEN', ext_in=[], ext_out=[], before=[], after=[], shell=False, scan=None):
	"""
	return a new Task subclass with the function run compiled from the line given
	provided for compatibility with waf 1.5
	"""

	params = {
		'vars': vars,
		'color': color,
		'name': name,
		'ext_in': Utils.to_list(ext_in),
		'ext_out': Utils.to_list(ext_out),
		'before': Utils.to_list(before),
		'after': Utils.to_list(after),
		'shell': shell,
		'scan': scan,
	}

	if isinstance(func, str):
		params['run_str'] = func
	else:
		params['run'] = func

	cls = type(Task)(name, (Task,), params)
	global classes
	classes[name] = cls
	return cls
开发者ID:RunarFreyr,项目名称:waz,代码行数:29,代码来源:Task.py

示例12: apply_haxe

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [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

示例13: make_dot_file

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def make_dot_file(ctx):
    # Lazy load module
    from bld.project_paths import project_paths_join as ppj

    # Select task groups, drop first which are project paths
    groups = [group for group in ctx.groups if len(group) != 0]
    groups = groups[1:]
    # Create
    dag = digraph()
    for group in groups:
        for taskgen in group:
            name = taskgen.get_name()

            add_nodes(dag, [name])
            # Add dependencies
            deps = Utils.to_list(getattr(taskgen, "deps", []))
            for dep in deps:
                dep = Path(dep).name
                add_nodes(dag, [dep])
                add_edges(dag, [(dep, name)])

            # Write targets
            targets = Utils.to_list(getattr(taskgen, "target", []))
            for target in targets:
                target = Path(target).name
                add_nodes(dag, [target])
                add_edges(dag, [(name, target)])

    dag = apply_styles(dag, styles)

    # Save DAG
    dag.render(ppj("OUT_FIGURES", "dag"))
开发者ID:hmgaudecker,项目名称:econ-project-templates,代码行数:34,代码来源:project_dependency_graph.py

示例14: group_dependent_assembly

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
    def group_dependent_assembly(self):
        '''
        cycle over all dependencies and sort them into types
        '''
        get = self.bld.get_tgen_by_name
        env = self.env
        for x in Utils.to_list(getattr(self.tg, 'use', [])):
            uselib = x.upper()
            csflags = getattr(env, 'CSFLAGS_' + uselib, None)
            if csflags:
                pkg = getattr(env, 'PKG_' + uselib, None)

                for ref in Utils.to_list(csflags):
                    self.external_refs.append({"reference": ref[3:], "package": pkg})

                continue

            try:
                y = get(x)
            except Errors.WafError:
                self.dotnet_refs.append(x)
                continue

            y.post()
            tsk = getattr(y, 'cs_task', None) or getattr(y, 'link_task', None)
            if tsk:
                self.projects.append(y)
开发者ID:SjB,项目名称:waftools,代码行数:29,代码来源:csproj.py

示例15: declare_chain

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def declare_chain(name='',rule=None,reentrant=None,color='BLUE',ext_in=[],ext_out=[],before=[],after=[],decider=None,scan=None,install_path=None,shell=False):
	ext_in=Utils.to_list(ext_in)
	ext_out=Utils.to_list(ext_out)
	if not name:
		name=rule
	cls=Task.task_factory(name,rule,color=color,ext_in=ext_in,ext_out=ext_out,before=before,after=after,scan=scan,shell=shell)
	def x_file(self,node):
		ext=decider and decider(self,node)or cls.ext_out
		if ext_in:
			_ext_in=ext_in[0]
		tsk=self.create_task(name,node)
		cnt=0
		keys=set(self.mappings.keys())|set(self.__class__.mappings.keys())
		for x in ext:
			k=node.change_ext(x,ext_in=_ext_in)
			tsk.outputs.append(k)
			if reentrant!=None:
				if cnt<int(reentrant):
					self.source.append(k)
			else:
				for y in keys:
					if k.name.endswith(y):
						self.source.append(k)
						break
			cnt+=1
		if install_path:
			self.bld.install_files(install_path,tsk.outputs)
		return tsk
	for x in cls.ext_in:
		task_gen.mappings[x]=x_file
	return x_file
开发者ID:PseudoSky,项目名称:voodoo,代码行数:33,代码来源:TaskGen.py


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