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


Python ConfigSet.ConfigSet方法代码示例

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


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

示例1: restore

# 需要导入模块: from waflib import ConfigSet [as 别名]
# 或者: from waflib.ConfigSet import ConfigSet [as 别名]
def restore(self):
		try:
			env=ConfigSet.ConfigSet(os.path.join(self.cache_dir,'build.config.py'))
		except EnvironmentError:
			pass
		else:
			if env['version']<Context.HEXVERSION:
				raise Errors.WafError('Version mismatch! reconfigure the project')
			for t in env['tools']:
				self.setup(**t)
		dbfn=os.path.join(self.variant_dir,Context.DBFILE)
		try:
			data=Utils.readf(dbfn,'rb')
		except(IOError,EOFError):
			Logs.debug('build: Could not load the build cache %s (missing)'%dbfn)
		else:
			try:
				waflib.Node.pickle_lock.acquire()
				waflib.Node.Nod3=self.node_class
				try:
					data=cPickle.loads(data)
				except Exception ,e:
					Logs.debug('build: Could not pickle the build cache %s: %r'%(dbfn,e))
				else: 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:26,代码来源:Build.py

示例2: __init__

# 需要导入模块: from waflib import ConfigSet [as 别名]
# 或者: from waflib.ConfigSet import ConfigSet [as 别名]
def __init__(self,*k,**kw):
		self.source=''
		self.target=''
		self.meths=[]
		self.prec=Utils.defaultdict(list)
		self.mappings={}
		self.features=[]
		self.tasks=[]
		if not'bld'in kw:
			self.env=ConfigSet.ConfigSet()
			self.idx=0
			self.path=None
		else:
			self.bld=kw['bld']
			self.env=self.bld.env.derive()
			self.path=self.bld.path
			try:
				self.idx=self.bld.idx[id(self.path)]=self.bld.idx.get(id(self.path),0)+1
			except AttributeError:
				self.bld.idx={}
				self.idx=self.bld.idx[id(self.path)]=1
		for key,val in kw.items():
			setattr(self,key,val) 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:25,代码来源:TaskGen.py

示例3: store

# 需要导入模块: from waflib import ConfigSet [as 别名]
# 或者: from waflib.ConfigSet import ConfigSet [as 别名]
def store(self):
	old1(self)
	db = os.path.join(self.variant_dir, EXTRA_LOCK)
	env = ConfigSet.ConfigSet()
	env.SRCDIR = self.srcnode.abspath()
	env.store(db) 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:8,代码来源:relocation.py

示例4: init_dirs

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

	if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)):
		raise Errors.WafError('The project was not configured: run "waf configure" first!')

	srcdir = None
	db = os.path.join(self.variant_dir, EXTRA_LOCK)
	env = ConfigSet.ConfigSet()
	try:
		env.load(db)
		srcdir = env.SRCDIR
	except:
		pass

	if srcdir:
		d = self.root.find_node(srcdir)
		if d and srcdir != self.top_dir and getattr(d, 'children', ''):
			srcnode = self.root.make_node(self.top_dir)
			print("relocating the source directory %r -> %r" % (srcdir, self.top_dir))
			srcnode.children = {}

			for (k, v) in d.children.items():
				srcnode.children[k] = v
				v.parent = srcnode
			d.children = {}

	old2(self) 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:29,代码来源:relocation.py

示例5: init_dirs

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

	if not (os.path.isabs(self.top_dir) and os.path.isabs(self.out_dir)):
		raise Errors.WafError('The project was not configured: run "waf configure" first!')

	srcdir = None
	db = os.path.join(self.variant_dir, EXTRA_LOCK)
	env = ConfigSet.ConfigSet()
	try:
		env.load(db)
		srcdir = env.SRCDIR
	except:
		pass

	if srcdir:
		d = self.root.find_node(srcdir)
		if d and srcdir != self.top_dir and getattr(d, 'children', ''):
			srcnode = self.root.make_node(self.top_dir)
			print(("relocating the source directory %r -> %r" % (srcdir, self.top_dir)))
			srcnode.children = {}

			for (k, v) in list(d.children.items()):
				srcnode.children[k] = v
				v.parent = srcnode
			d.children = {}

	old2(self) 
开发者ID:imec-idlab,项目名称:IEEE-802.11ah-ns-3,代码行数:29,代码来源:relocation.py

示例6: setenv

# 需要导入模块: from waflib import ConfigSet [as 别名]
# 或者: from waflib.ConfigSet import ConfigSet [as 别名]
def setenv(self,name,env=None):
		if name not in self.all_envs or env:
			if not env:
				env=ConfigSet.ConfigSet()
				self.prepare_env(env)
			else:
				env=env.derive()
			self.all_envs[name]=env
		self.variant=name 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:11,代码来源:Configure.py

示例7: distclean

# 需要导入模块: from waflib import ConfigSet [as 别名]
# 或者: from waflib.ConfigSet import ConfigSet [as 别名]
def distclean(ctx):
	'''removes the build directory'''
	lst=os.listdir('.')
	for f in lst:
		if f==Options.lockfile:
			try:
				proj=ConfigSet.ConfigSet(f)
			except IOError:
				Logs.warn('Could not read %r'%f)
				continue
			if proj['out_dir']!=proj['top_dir']:
				try:
					shutil.rmtree(proj['out_dir'])
				except IOError:
					pass
				except OSError ,e:
					if e.errno!=errno.ENOENT:
						Logs.warn('Could not remove %r'%proj['out_dir'])
			else:
				distclean_dir(proj['out_dir'])
			for k in(proj['out_dir'],proj['top_dir'],proj['run_dir']):
				p=os.path.join(k,Options.lockfile)
				try:
					os.remove(p)
				except OSError ,e:
					if e.errno!=errno.ENOENT:
						Logs.warn('Could not remove %r'%p) 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:29,代码来源:Scripting.py

示例8: autoconfigure

# 需要导入模块: from waflib import ConfigSet [as 别名]
# 或者: from waflib.ConfigSet import ConfigSet [as 别名]
def autoconfigure(execute_method):
	def execute(self):
		if not Configure.autoconfig:
			return execute_method(self)
		env=ConfigSet.ConfigSet()
		do_config=False
		try:
			env.load(os.path.join(Context.top_dir,Options.lockfile))
		except Exception:
			Logs.warn('Configuring the project')
			do_config=True
		else:
			if env.run_dir!=Context.run_dir:
				do_config=True
			else:
				h=0
				for f in env['files']:
					h=Utils.h_list((h,Utils.readf(f,'rb')))
				do_config=h!=env.hash
		if do_config:
			Options.commands.insert(0,self.cmd)
			Options.commands.insert(0,'configure')
			if Configure.autoconfig=='clobber':
				Options.options.__dict__=env.options
			return
		return execute_method(self)
	return execute 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:29,代码来源:Scripting.py

示例9: retrieve

# 需要导入模块: from waflib import ConfigSet [as 别名]
# 或者: from waflib.ConfigSet import ConfigSet [as 别名]
def retrieve(self,name,fromenv=None):
	try:
		env=self.all_envs[name]
	except KeyError:
		env=ConfigSet.ConfigSet()
		self.prepare_env(env)
		self.all_envs[name]=env
	else:
		if fromenv:
			Logs.warn("The environment %s may have been configured already"%name)
	return env 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:13,代码来源:compat15.py

示例10: execute

# 需要导入模块: from waflib import ConfigSet [as 别名]
# 或者: from waflib.ConfigSet import ConfigSet [as 别名]
def execute(self):
		self.init_dirs()
		self.cachedir=self.bldnode.make_node(Build.CACHE_DIR)
		self.cachedir.mkdir()
		path=os.path.join(self.bldnode.abspath(),WAF_CONFIG_LOG)
		self.logger=Logs.make_logger(path,'cfg')
		app=getattr(Context.g_module,'APPNAME','')
		if app:
			ver=getattr(Context.g_module,'VERSION','')
			if ver:
				app="%s (%s)"%(app,ver)
		params={'now':time.ctime(),'pyver':sys.hexversion,'systype':sys.platform,'args':" ".join(sys.argv),'wafver':Context.WAFVERSION,'abi':Context.ABI,'app':app}
		self.to_log(conf_template%params)
		self.msg('Setting top to',self.srcnode.abspath())
		self.msg('Setting out to',self.bldnode.abspath())
		if id(self.srcnode)==id(self.bldnode):
			Logs.warn('Setting top == out (remember to use "update_outputs")')
		elif id(self.path)!=id(self.srcnode):
			if self.srcnode.is_child_of(self.path):
				Logs.warn('Are you certain that you do not want to set top="." ?')
		super(ConfigurationContext,self).execute()
		self.store()
		Context.top_dir=self.srcnode.abspath()
		Context.out_dir=self.bldnode.abspath()
		env=ConfigSet.ConfigSet()
		env['argv']=sys.argv
		env['options']=Options.options.__dict__
		env.run_dir=Context.run_dir
		env.top_dir=Context.top_dir
		env.out_dir=Context.out_dir
		env['hash']=self.hash
		env['files']=self.files
		env['environ']=dict(self.environ)
		if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options,'no_lock_in_run'):
			env.store(os.path.join(Context.run_dir,Options.lockfile))
		if not self.env.NO_LOCK_IN_TOP and not getattr(Options.options,'no_lock_in_top'):
			env.store(os.path.join(Context.top_dir,Options.lockfile))
		if not self.env.NO_LOCK_IN_OUT and not getattr(Options.options,'no_lock_in_out'):
			env.store(os.path.join(Context.out_dir,Options.lockfile)) 
开发者ID:KTH,项目名称:royal-chaos,代码行数:41,代码来源:Configure.py


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