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


Python Errors.WafError方法代码示例

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


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

示例1: get_run_program

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def get_run_program(program_string, command_template=None):
    """
    Return the program name and argv of the process that would be executed by
    run_program(program_string, command_template).
    """
    #print "get_run_program_argv(program_string=%r, command_template=%r)" % (program_string, command_template)
    env = bld.env

    if command_template in (None, '%s'):
        argv = shlex.split(program_string)
        #print "%r ==shlex.split==> %r" % (program_string, argv)
        program_name = argv[0]

        try:
            program_obj = find_program(program_name, env)
        except ValueError, ex:
            raise WafError(str(ex))

        program_node = program_obj.path.find_or_declare(program_obj.target)
        #try:
        #    program_node = program_obj.path.find_build(ccroot.get_target_name(program_obj))
        #except AttributeError:
        #    raise Utils.WafError("%s does not appear to be a program" % (program_name,))

        execvec = [program_node.abspath()] + argv[1:] 
开发者ID:ntu-dsi-dcn,项目名称:ntu-dsi-dcn,代码行数:27,代码来源:wutils.py

示例2: apply_copy

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [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:imec-idlab,项目名称:IEEE-802.11ah-ns-3,代码行数:26,代码来源:misc.py

示例3: sig_explicit_deps

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def sig_explicit_deps(self):
		bld=self.generator.bld
		upd=self.m.update
		for x in self.inputs+self.dep_nodes:
			try:
				upd(x.get_bld_sig())
			except(AttributeError,TypeError):
				raise Errors.WafError('Missing node signature for %r (required by %r)'%(x,self))
		if bld.deps_man:
			additional_deps=bld.deps_man
			for x in self.inputs+self.outputs:
				try:
					d=additional_deps[id(x)]
				except KeyError:
					continue
				for v in d:
					if isinstance(v,bld.root.__class__):
						try:
							v=v.get_bld_sig()
						except AttributeError:
							raise Errors.WafError('Missing node signature for %r (required by %r)'%(v,self))
					elif hasattr(v,'__call__'):
						v=v()
					upd(v)
		return self.m.digest() 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:27,代码来源:Task.py

示例4: configure

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def configure(conf):
	v=conf.env
	v['PYTHON']=Options.options.python or os.environ.get('PYTHON',sys.executable)
	if Options.options.pythondir:
		v['PYTHONDIR']=Options.options.pythondir
	if Options.options.pythonarchdir:
		v['PYTHONARCHDIR']=Options.options.pythonarchdir
	conf.find_program('python',var='PYTHON')
	v['PYFLAGS']=''
	v['PYFLAGS_OPT']='-O'
	v['PYC']=getattr(Options.options,'pyc',1)
	v['PYO']=getattr(Options.options,'pyo',1)
	try:
		v.PYTAG=conf.cmd_and_log(conf.env.PYTHON+['-c',"import imp;print(imp.get_tag())"]).strip()
	except Errors.WafError:
		pass 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:18,代码来源:python.py

示例5: check_cfg

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def check_cfg(self,*k,**kw):
	if k:
		lst=k[0].split()
		kw['package']=lst[0]
		kw['args']=' '.join(lst[1:])
	self.validate_cfg(kw)
	if'msg'in kw:
		self.start_msg(kw['msg'],**kw)
	ret=None
	try:
		ret=self.exec_cfg(kw)
	except self.errors.WafError:
		if'errmsg'in kw:
			self.end_msg(kw['errmsg'],'YELLOW',**kw)
		if Logs.verbose>1:
			raise
		else:
			self.fatal('The configuration failed')
	else:
		if not ret:
			ret=True
		kw['success']=ret
		if'okmsg'in kw:
			self.end_msg(self.ret_msg(kw['okmsg'],kw),**kw)
	return ret 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:27,代码来源:c_config.py

示例6: process_lib

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def process_lib(self):
	node=None
	names=[x%self.name for x in lib_patterns[self.lib_type]]
	for x in self.lib_paths+[self.path]+SYSTEM_LIB_PATHS:
		if not isinstance(x,Node.Node):
			x=self.bld.root.find_node(x)or self.path.find_node(x)
			if not x:
				continue
		for y in names:
			node=x.find_node(y)
			if node:
				node.sig=Utils.h_file(node.abspath())
				break
		else:
			continue
		break
	else:
		raise Errors.WafError('could not find library %r'%self.name)
	self.link_task=self.create_task('fake_%s'%self.lib_type,[],[node])
	self.target=self.name 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:22,代码来源:ccroot.py

示例7: makeglossaries

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def makeglossaries(self):
		src_file=self.inputs[0].abspath()
		base_file=os.path.basename(src_file)
		base,_=os.path.splitext(base_file)
		for aux_node in self.aux_nodes:
			try:
				ct=aux_node.read()
			except EnvironmentError:
				Logs.error('Error reading %s: %r'%aux_node.abspath())
				continue
			if g_glossaries_re.findall(ct):
				if not self.env.MAKEGLOSSARIES:
					raise Errors.WafError("The program 'makeglossaries' is missing!")
				Logs.warn('calling makeglossaries')
				self.env.SRCFILE=base
				self.check_status('error when calling makeglossaries %s'%base,self.makeglossaries_fun())
				return 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:19,代码来源:tex.py

示例8: check

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def check(self):
		import tempfile,tarfile
		t=None
		try:
			t=tarfile.open(self.get_arch_name())
			for x in t:
				t.extract(x)
		finally:
			if t:
				t.close()
		cfg=[]
		if Options.options.distcheck_args:
			cfg=shlex.split(Options.options.distcheck_args)
		else:
			cfg=[x for x in sys.argv if x.startswith('-')]
		instdir=tempfile.mkdtemp('.inst',self.get_base_name())
		ret=Utils.subprocess.Popen([sys.executable,sys.argv[0],'configure','install','uninstall','--destdir='+instdir]+cfg,cwd=self.get_base_name()).wait()
		if ret:
			raise Errors.WafError('distcheck failed with code %i'%ret)
		if os.path.exists(instdir):
			raise Errors.WafError('distcheck succeeded, but files were left in %s'%instdir)
		shutil.rmtree(self.get_base_name()) 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:24,代码来源:Scripting.py

示例9: mkdir

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def mkdir(self):
		if getattr(self,'cache_isdir',None):
			return
		try:
			self.parent.mkdir()
		except OSError:
			pass
		if self.name:
			try:
				os.makedirs(self.abspath())
			except OSError:
				pass
			if not os.path.isdir(self.abspath()):
				raise Errors.WafError('Could not create the directory %s'%self.abspath())
			try:
				self.children
			except AttributeError:
				self.children=self.dict_class()
		self.cache_isdir=True 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:21,代码来源:Node.py

示例10: exec_command

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def exec_command(self,cmd,**kw):
		subprocess=Utils.subprocess
		kw['shell']=isinstance(cmd,str)
		Logs.debug('runner: %r'%(cmd,))
		Logs.debug('runner_env: kw=%s'%kw)
		if self.logger:
			self.logger.info(cmd)
		if'stdout'not in kw:
			kw['stdout']=subprocess.PIPE
		if'stderr'not in kw:
			kw['stderr']=subprocess.PIPE
		if Logs.verbose and not kw['shell']and not Utils.check_exe(cmd[0]):
			raise Errors.WafError("Program %s not found!"%cmd[0])
		try:
			if kw['stdout']or kw['stderr']:
				p=subprocess.Popen(cmd,**kw)
				(out,err)=p.communicate()
				ret=p.returncode
			else:
				out,err=(None,None)
				ret=subprocess.Popen(cmd,**kw).wait()
		except Exception ,e:
			raise Errors.WafError('Execution failure: %s'%str(e),ex=e) 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:25,代码来源:Context.py

示例11: load_module

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def load_module(path,encoding=None):
	try:
		return cache_modules[path]
	except KeyError:
		pass
	module=imp.new_module(WSCRIPT_FILE)
	try:
		code=Utils.readf(path,m='rU',encoding=encoding)
	except EnvironmentError:
		raise Errors.WafError('Could not read the file %r'%path)
	module_dir=os.path.dirname(path)
	sys.path.insert(0,module_dir)
	exec(compile(code,path,'exec'),module.__dict__)
	sys.path.remove(module_dir)
	cache_modules[path]=module
	return module 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:18,代码来源:Context.py

示例12: load_envs

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def load_envs(self):
		node=self.root.find_node(self.cache_dir)
		if not node:
			raise Errors.WafError('The project was not configured: run "waf configure" first!')
		lst=node.ant_glob('**/*%s'%CACHE_SUFFIX,quiet=True)
		if not lst:
			raise Errors.WafError('The cache directory is empty: reconfigure the project')
		for x in lst:
			name=x.path_from(node).replace(CACHE_SUFFIX,'').replace('\\','/')
			env=ConfigSet.ConfigSet(x.abspath())
			self.all_envs[name]=env
			for f in env[CFG_FILES]:
				newnode=self.root.find_resource(f)
				try:
					h=Utils.h_file(newnode.abspath())
				except(IOError,AttributeError):
					Logs.error('cannot find %r'%f)
					h=Utils.SIG_NIL
				newnode.sig=h 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:21,代码来源:Build.py

示例13: restore

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

示例14: post

# 需要导入模块: from waflib import Errors [as 别名]
# 或者: from waflib.Errors import WafError [as 别名]
def post(self):
		buf=[]
		for x in self.source:
			if isinstance(x,waflib.Node.Node):
				y=x
			else:
				y=self.path.find_resource(x)
				if not y:
					if Logs.verbose:
						Logs.warn('Could not find %s immediately (may cause broken builds)'%x)
					idx=self.generator.bld.get_group_idx(self)
					for tg in self.generator.bld.groups[idx]:
						if not isinstance(tg,inst)and id(tg)!=id(self):
							tg.post()
						y=self.path.find_resource(x)
						if y:
							break
					else:
						raise Errors.WafError('Could not find %r in %r'%(x,self.path))
			buf.append(y)
		self.inputs=buf 
开发者ID:MOSAIC-UA,项目名称:802.11ah-ns3,代码行数:23,代码来源:Build.py

示例15: init_dirs

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


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