当前位置: 首页>>代码示例>>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: apply_copy

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [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:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:26,代码来源:misc.py

示例2: load

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def load(self,input,tooldir=None,funs=None):
		tools=Utils.to_list(input)
		if tooldir:tooldir=Utils.to_list(tooldir)
		for tool in tools:
			mag=(tool,id(self.env),tooldir,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,ctx=self)
			except ImportError ,e:
				self.fatal('Could not load the Waf tool %r from %r\n%s'%(tool,sys.path,e))
			except Exception ,e:
				self.to_log('imp %r (%r & %r)'%(tool,tooldir,funs))
				self.to_log(Utils.ex_stack())
				raise 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:20,代码来源:Configure.py

示例3: use_javac_files

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def use_javac_files(self):
	lst=[]
	self.uselib=self.to_list(getattr(self,'uselib',[]))
	names=self.to_list(getattr(self,'use',[]))
	get=self.bld.get_tgen_by_name
	for x in names:
		try:
			y=get(x)
		except Exception:
			self.uselib.append(x)
		else:
			y.post()
			lst.append(y.jar_task.outputs[0].abspath())
			self.javac_task.set_run_after(y.jar_task)
	if lst:
		self.env.append_value('CLASSPATH',lst) 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:18,代码来源:javaw.py

示例4: run

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def run(self):
		env=self.env
		bld=self.generator.bld
		wd=bld.bldnode.abspath()
		srcpath=self.generator.path.abspath()+os.sep+self.generator.srcdir
		srcpath+=os.pathsep
		srcpath+=self.generator.path.get_bld().abspath()+os.sep+self.generator.srcdir
		classpath=env.CLASSPATH
		classpath+=os.pathsep
		classpath+=os.pathsep.join(self.classpath)
		classpath="".join(classpath)
		self.last_cmd=lst=[]
		lst.extend(Utils.to_list(env['JAVADOC']))
		lst.extend(['-d',self.generator.javadoc_output.abspath()])
		lst.extend(['-sourcepath',srcpath])
		lst.extend(['-classpath',classpath])
		lst.extend(['-subpackages'])
		lst.extend(self.generator.javadoc_package)
		lst=[x for x in lst if x]
		self.generator.bld.cmd_and_log(lst,cwd=wd,env=env.env or None,quiet=0) 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:22,代码来源:javaw.py

示例5: check_invalid_constraints

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def check_invalid_constraints(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_method/@after_method'%list(invalid))
	for cls in list(Task.classes.values()):
		for x in('before','after'):
			for y in Utils.to_list(getattr(cls,x,[])):
				if not Task.classes.get(y,None):
					Logs.error('Erroneous order constraint %r=%r on task class %r'%(x,y,cls.__name__))
		if getattr(cls,'rule',None):
			Logs.error('Erroneous attribute "rule" on task class %r (rename to "run_str")'%cls.__name__) 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:22,代码来源:errcheck.py

示例6: setup_msvc

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def setup_msvc(conf,versions,arch=False):
	platforms=getattr(Options.options,'msvc_targets','').split(',')
	if platforms==['']:
		platforms=Utils.to_list(conf.env['MSVC_TARGETS'])or[i for i,j in all_msvc_platforms+all_icl_platforms+all_wince_platforms]
	desired_versions=getattr(Options.options,'msvc_version','').split(',')
	if desired_versions==['']:
		desired_versions=conf.env['MSVC_VERSIONS']or[v for v,_ in versions][::-1]
	versiondict=dict(versions)
	for version in desired_versions:
		try:
			targets=dict(versiondict[version])
			for target in platforms:
				try:
					arch,(p1,p2,p3)=targets[target]
					compiler,revision=version.rsplit(' ',1)
					if arch:
						return compiler,revision,p1,p2,p3,arch
					else:
						return compiler,revision,p1,p2,p3
				except KeyError:continue
		except KeyError:continue
	conf.fatal('msvc: Impossible to find a valid architecture for building (in setup_msvc)') 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:24,代码来源:msvc.py

示例7: 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=[]+mtool
	lst.extend(Utils.to_list(env['MTFLAGS']))
	lst.extend(['-manifest',manifest])
	lst.append('-outputresource:%s;%s'%(outfile,mode))
	return self.exec_command(lst) 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:27,代码来源:msvc.py

示例8: install_files

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def install_files(self,dest,files,env=None,chmod=Utils.O644,relative_trick=False,cwd=None,add=True,postpone=True,task=None):
		tsk=inst(env=env or self.env)
		tsk.bld=self
		tsk.path=cwd or self.path
		tsk.chmod=chmod
		tsk.task=task
		if isinstance(files,waflib.Node.Node):
			tsk.source=[files]
		else:
			tsk.source=Utils.to_list(files)
		tsk.dest=dest
		tsk.exec_task=tsk.exec_install_files
		tsk.relative_trick=relative_trick
		if add:self.add_to_group(tsk)
		self.run_task_now(tsk,postpone)
		return tsk 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:18,代码来源:Build.py

示例9: check_invalid_constraints

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def check_invalid_constraints(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_method/@after_method'%list(invalid))
	for cls in list(Task.classes.values()):
		if sys.hexversion>0x3000000 and issubclass(cls,Task.Task)and isinstance(cls.hcode,str):
			raise Errors.WafError('Class %r has hcode value %r of type <str>, expecting <bytes> (use Utils.h_cmd() ?)'%(cls,cls.hcode))
		for x in('before','after'):
			for y in Utils.to_list(getattr(cls,x,[])):
				if not Task.classes.get(y,None):
					Logs.error('Erroneous order constraint %r=%r on task class %r'%(x,y,cls.__name__))
		if getattr(cls,'rule',None):
			Logs.error('Erroneous attribute "rule" on task class %r (rename to "run_str")'%cls.__name__) 
开发者ID:KTH,项目名称:royal-chaos,代码行数:24,代码来源:errcheck.py

示例10: copy_attrs

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def copy_attrs(orig, dest, names, only_if_set=False):
	"""
	copy class attributes from an object to another
	"""
	for a in Utils.to_list(names):
		u = getattr(orig, a, ())
		if u or not only_if_set:
			setattr(dest, a, u) 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:10,代码来源:misc.py

示例11: apply_subst

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

####################
## command-output ####
#################### 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:43,代码来源:misc.py

示例12: __boost_get_libs_path

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def __boost_get_libs_path(self, *k, **kw):
	''' return the lib path and all the files in it '''
	if 'files' in kw:
		return self.root.find_dir('.'), Utils.to_list(kw['files'])
	libs = k and k[0] or kw.get('libs', None)
	if libs:
		path = self.root.find_dir(libs)
		files = path.ant_glob('*boost_*')
	if not libs or not files:
		for dir in BOOST_LIBS:
			try:
				path = self.root.find_dir(dir)
				files = path.ant_glob('*boost_*')
				if files:
					break
				path = self.root.find_dir(dir + '64')
				files = path.ant_glob('*boost_*')
				if files:
					break
			except:
				path = None
	if not path:
		if libs:
			self.fatal('libs not found in %s' % libs)
		else:
			self.fatal('libs not found, \
					   use --boost-includes=/path/to/boost/lib')
	return path, files 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:30,代码来源:boost.py

示例13: __boost_get_libs_path

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def __boost_get_libs_path(self, *k, **kw):
	''' return the lib path and all the files in it '''
	if 'files' in kw:
		return self.root.find_dir('.'), Utils.to_list(kw['files'])
	libs = k and k[0] or kw.get('libs', None)
	if libs:
		path = self.root.find_dir(libs)
		files = path.ant_glob('*boost_*')
	if not libs or not files:
		for d in self.environ.get('LIB', '').split(';') + BOOST_LIBS:
			if not d:
				continue
			path = self.root.find_dir(d)
			if path:
				files = path.ant_glob('*boost_*')
				if files:
					break
			path = self.root.find_dir(d + '64')
			if path:
				files = path.ant_glob('*boost_*')
				if files:
					break
	if not path:
		if libs:
			self.end_msg('libs not found in %s' % libs)
			self.fatal('The configuration failed')
		else:
			self.end_msg('libs not found, please provide a --boost-libs argument (see help)')
			self.fatal('The configuration failed')

	self.to_log('Found the boost path in %r with the libraries:' % path)
	for x in files:
		self.to_log('    %r' % x)
	return path, files 
开发者ID:imec-idlab,项目名称:IEEE-802.11ah-ns-3,代码行数:36,代码来源:boost.py

示例14: is_before

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def is_before(t1,t2):
	to_list=Utils.to_list
	for k in to_list(t2.ext_in):
		if k in to_list(t1.ext_out):
			return 1
	if t1.__class__.__name__ in to_list(t2.after):
		return 1
	if t2.__class__.__name__ in to_list(t1.before):
		return 1
	return 0 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:12,代码来源:Task.py

示例15: task_factory

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import to_list [as 别名]
def task_factory(name,func=None,vars=None,color='GREEN',ext_in=[],ext_out=[],before=[],after=[],shell=False,scan=None):
	params={'vars':vars or[],'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:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:12,代码来源:Task.py


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