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


Python Utils.ex_stack方法代码示例

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


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

示例1: process

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
	def process(self):
		m=self.generator.bld.producer
		try:
			del self.generator.bld.task_sigs[self.uid()]
		except KeyError:
			pass
		try:
			ret=self.run()
		except Exception:
			self.err_msg=Utils.ex_stack()
			self.hasrun=EXCEPTION
			m.error_handler(self)
			return
		if ret:
			self.err_code=ret
			self.hasrun=CRASHED
		else:
			try:
				self.post_run()
			except Errors.WafError:
				pass
			except Exception:
				self.err_msg=Utils.ex_stack()
				self.hasrun=EXCEPTION
			else:
				self.hasrun=SUCCESS
		if self.hasrun!=SUCCESS:
			m.error_handler(self)
开发者ID:allencubie,项目名称:lib,代码行数:30,代码来源:Task.py

示例2: process

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
 def process(self):
     m = self.master
     if m.stop:
         m.out.put(self)
         return
     try:
         del self.generator.bld.task_sigs[self.uid()]
     except:
         pass
     try:
         self.generator.bld.returned_tasks.append(self)
         self.log_display(self.generator.bld)
         ret = self.run()
     except Exception:
         self.err_msg = Utils.ex_stack()
         self.hasrun = EXCEPTION
         m.error_handler(self)
         m.out.put(self)
         return
     if ret:
         self.err_code = ret
         self.hasrun = CRASHED
     else:
         try:
             self.post_run()
         except Errors.WafError:
             pass
         except Exception:
             self.err_msg = Utils.ex_stack()
             self.hasrun = EXCEPTION
         else:
             self.hasrun = SUCCESS
     if self.hasrun != SUCCESS:
         m.error_handler(self)
     m.out.put(self)
开发者ID:jgoppert,项目名称:mavsim,代码行数:37,代码来源:Task.py

示例3: process

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
	def process(self):
		"""
		Assume that the task has had a new attribute ``master`` which is an instance of :py:class:`waflib.Runner.Parallel`.
		Execute the task and then put it back in the queue :py:attr:`waflib.Runner.Parallel.out` (may be replaced by subclassing).
		"""
		m = self.master
		if m.stop:
			m.out.put(self)
			return

		# TODO remove the task signature immediately before it is executed
		# in case of failure the task will be executed again
		#try:
		#	del self.generator.bld.task_sigs[self.uid()]
		#except:
		#	pass

		self.generator.bld.returned_tasks.append(self)
		self.log_display(self.generator.bld)

		try:
			ret = self.run()
		except Exception as e:
			self.err_msg = Utils.ex_stack()
			self.hasrun = EXCEPTION

			# TODO cleanup
			m.error_handler(self)
			m.out.put(self)
			return

		if ret:
			self.err_code = ret
			self.hasrun = CRASHED
		else:
			try:
				self.post_run()
			except Errors.WafError:
				pass
			except Exception:
				self.err_msg = Utils.ex_stack()
				self.hasrun = EXCEPTION
			else:
				self.hasrun = SUCCESS
		if self.hasrun != SUCCESS:
			m.error_handler(self)

		m.out.put(self)
开发者ID:SjB,项目名称:waf,代码行数:50,代码来源:Task.py

示例4: load

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [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, 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, e:
             self.to_log("imp %r (%r & %r)" % (tool, tooldir, funs))
             self.to_log(Utils.ex_stack())
             raise
开发者ID:RONNCC,项目名称:pysoy,代码行数:31,代码来源:Configure.py

示例5: task_status

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
	def task_status(self, tsk):
		"""
		Obtains the task status to decide whether to run it immediately or not.

		:return: the exit status, for example :py:attr:`waflib.Task.ASK_LATER`
		:rtype: integer
		"""
		try:
			return tsk.runnable_status()
		except Exception:
			self.processed += 1
			tsk.err_msg = Utils.ex_stack()
			if not self.stop and self.bld.keep:
				self.skip(tsk)
				if self.bld.keep == 1:
					# if -k stop at the first exception, if -kk try to go as far as possible
					if Logs.verbose > 1 or not self.error:
						self.error.append(tsk)
					self.stop = True
				else:
					if Logs.verbose > 1:
						self.error.append(tsk)
				return Task.EXCEPTION
			tsk.hasrun = Task.EXCEPTION

			self.error_handler(tsk)
			return Task.EXCEPTION
开发者ID:JodyGoldberg,项目名称:waf,代码行数:29,代码来源:Runner.py

示例6: load

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

示例7: start

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
	def start(self, node, env):
		debug('preproc: scanning %s (in %s)', node.name, node.parent.name)

		self.env = env
		bld = node.ctx
		try:
			self.parse_cache = bld.parse_cache
		except AttributeError:
			bld.parse_cache = {}
			self.parse_cache = bld.parse_cache

		self.addlines(node)

		# macros may be defined on the command-line, so they must be parsed as if they were part of the file
		if env['DEFINES']:
			lst = ['%s %s' % (x[0], Utils.trimquotes('='.join(x[1:]))) for x in [y.split('=') for y in env['DEFINES']]]
			self.lines = [('define', x) for x in lst] + self.lines

		while self.lines:
			(kind, line) = self.lines.pop(0)
			if kind == POPFILE:
				self.currentnode_stack.pop()
				continue
			try:
				self.process_line(kind, line)
			except Exception as e:
				if Logs.verbose:
					debug('preproc: line parsing failed (%s): %s %s', e, line, Utils.ex_stack())
开发者ID:zsx,项目名称:waf,代码行数:30,代码来源:c_preproc.py

示例8: load

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
	def load(self,input,tooldir=None,funs=None,with_sys_path=True,cache=False):
		tools=Utils.to_list(input)
		if tooldir:tooldir=Utils.to_list(tooldir)
		for tool in tools:
			if cache:
				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,with_sys_path=with_sys_path)
			except ImportError as e:
				self.fatal('Could not load the Waf tool %r from %r\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:Gnurou,项目名称:glmark2,代码行数:29,代码来源:Configure.py

示例9: run

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
	def run(self):
		dest = self.inputs[0]
		f = open(dest.abspath(), 'rb')
		content = f.read()
		content = filter(lambda x: x.isalpha(), content)
		f.close()
		content = content.decode()
		bld = self.generator.bld
		if content.find('BIGenDianSyS') >= 0:
			bld.retval = 'big'
		if content.find('LiTTleEnDian') >= 0:
			if getattr(bld, 'retval', None):
				# finding both strings is unlikely to happen, but who knows?
				bld.fatal('Unable to determine the byte order\n%s'% Utils.ex_stack())
			else:
				bld.retval = 'little'
		if not hasattr(bld, 'retval') or bld.retval not in ('big', 'little'):
			bld.fatal('Unable to determine the byte order\n%s'% Utils.ex_stack())
开发者ID:zsx,项目名称:waflib,代码行数:20,代码来源:endian.py

示例10: run_c_code

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
def run_c_code(self,*k,**kw):
	lst=[str(v)for(p,v)in kw.items()if p!='env']
	h=Utils.h_list(lst)
	dir=self.bldnode.abspath()+os.sep+(not Utils.is_win32 and'.'or'')+'conf_check_'+Utils.to_hex(h)
	try:
		os.makedirs(dir)
	except OSError:
		pass
	try:
		os.stat(dir)
	except OSError:
		self.fatal('cannot use the configuration test folder %r'%dir)
	cachemode=getattr(Options.options,'confcache',None)
	if cachemode==CACHE_RESULTS:
		try:
			proj=ConfigSet.ConfigSet(os.path.join(dir,'cache_run_c_code'))
		except OSError:
			pass
		else:
			ret=proj['cache_run_c_code']
			if isinstance(ret,str)and ret.startswith('Test does not build'):
				self.fatal(ret)
			return ret
	bdir=os.path.join(dir,'testbuild')
	if not os.path.exists(bdir):
		os.makedirs(bdir)
	self.test_bld=bld=Build.BuildContext(top_dir=dir,out_dir=bdir)
	bld.init_dirs()
	bld.progress_bar=0
	bld.targets='*'
	if kw['compile_filename']:
		node=bld.srcnode.make_node(kw['compile_filename'])
		node.write(kw['code'])
	bld.logger=self.logger
	bld.all_envs.update(self.all_envs)
	bld.env=kw['env']
	o=bld(features=kw['features'],source=kw['compile_filename'],target='testprog')
	for k,v in kw.items():
		setattr(o,k,v)
	if not kw.get('quiet',None):
		self.to_log("==>\n%s\n<=="%kw['code'])
	bld.targets='*'
	ret=-1
	try:
		try:
			bld.compile()
		except Errors.WafError:
			ret='Test does not build: %s'%Utils.ex_stack()
			self.fatal(ret)
		else:
			ret=getattr(bld,'retval',0)
	finally:
		proj=ConfigSet.ConfigSet()
		proj['cache_run_c_code']=ret
		proj.store(os.path.join(dir,'cache_run_c_code'))
	return ret
开发者ID:WU-ARL,项目名称:ndn-ops,代码行数:58,代码来源:c_config.py

示例11: run_build

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
def run_build(self,*k,**kw):
	lst=[str(v)for(p,v)in kw.items()if p!='env']
	h=Utils.h_list(lst)
	dir=self.bldnode.abspath()+os.sep+(not Utils.is_win32 and'.'or'')+'conf_check_'+Utils.to_hex(h)
	try:
		os.makedirs(dir)
	except OSError:
		pass
	try:
		os.stat(dir)
	except OSError:
		self.fatal('cannot use the configuration test folder %r'%dir)
	cachemode=getattr(Options.options,'confcache',None)
	if cachemode==1:
		try:
			proj=ConfigSet.ConfigSet(os.path.join(dir,'cache_run_build'))
		except OSError:
			pass
		except IOError:
			pass
		else:
			ret=proj['cache_run_build']
			if isinstance(ret,str)and ret.startswith('Test does not build'):
				self.fatal(ret)
			return ret
	bdir=os.path.join(dir,'testbuild')
	if not os.path.exists(bdir):
		os.makedirs(bdir)
	self.test_bld=bld=Build.BuildContext(top_dir=dir,out_dir=bdir)
	bld.init_dirs()
	bld.progress_bar=0
	bld.targets='*'
	bld.logger=self.logger
	bld.all_envs.update(self.all_envs)
	bld.env=kw['env']
	bld.kw=kw
	bld.conf=self
	kw['build_fun'](bld)
	ret=-1
	try:
		try:
			bld.compile()
		except Errors.WafError:
			ret='Test does not build: %s'%Utils.ex_stack()
			self.fatal(ret)
		else:
			ret=getattr(bld,'retval',0)
	finally:
		if cachemode==1:
			proj=ConfigSet.ConfigSet()
			proj['cache_run_build']=ret
			proj.store(os.path.join(dir,'cache_run_build'))
		else:
			shutil.rmtree(dir)
	return ret
开发者ID:raystubbs,项目名称:NMSU-BigData-REU-NDN-Access-Control-Simulation,代码行数:57,代码来源:Configure.py

示例12: run_c_code

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
def run_c_code(self, *k, **kw):
    lst = [str(v) for (p, v) in kw.items() if p != "env"]
    h = Utils.h_list(lst)
    dir = self.bldnode.abspath() + os.sep + (sys.platform != "win32" and "." or "") + "conf_check_" + Utils.to_hex(h)
    try:
        os.makedirs(dir)
    except:
        pass
    try:
        os.stat(dir)
    except:
        self.fatal("cannot use the configuration test folder %r" % dir)
    cachemode = getattr(Options.options, "confcache", None)
    if cachemode == CACHE_RESULTS:
        try:
            proj = ConfigSet.ConfigSet(os.path.join(dir, "cache_run_c_code"))
            ret = proj["cache_run_c_code"]
        except:
            pass
        else:
            if isinstance(ret, str) and ret.startswith("Test does not build"):
                self.fatal(ret)
            return ret
    bdir = os.path.join(dir, "testbuild")
    if not os.path.exists(bdir):
        os.makedirs(bdir)
    self.test_bld = bld = Build.BuildContext(top_dir=dir, out_dir=bdir)
    bld.init_dirs()
    bld.progress_bar = 0
    bld.targets = "*"
    if kw["compile_filename"]:
        node = bld.srcnode.make_node(kw["compile_filename"])
        node.write(kw["code"])
    bld.logger = self.logger
    bld.all_envs.update(self.all_envs)
    bld.env = kw["env"]
    o = bld(features=kw["features"], source=kw["compile_filename"], target="testprog")
    for k, v in kw.items():
        setattr(o, k, v)
    self.to_log("==>\n%s\n<==" % kw["code"])
    bld.targets = "*"
    ret = -1
    try:
        try:
            bld.compile()
        except Errors.WafError:
            ret = "Test does not build: %s" % Utils.ex_stack()
            self.fatal(ret)
        else:
            ret = getattr(bld, "retval", 0)
    finally:
        proj = ConfigSet.ConfigSet()
        proj["cache_run_c_code"] = ret
        proj.store(os.path.join(dir, "cache_run_c_code"))
    return ret
开发者ID:RunarFreyr,项目名称:waz,代码行数:57,代码来源:c_config.py

示例13: process

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
	def process(self):
		"""
		Assume that the task has had a ``master`` which is an instance of :py:class:`waflib.Runner.Parallel`.
		Execute the task and then put it back in the queue :py:attr:`waflib.Runner.Parallel.out` (may be replaced by subclassing).

		:return: 0 or None if everything is fine
		:rtype: integer
		"""
		# remove the task signature immediately before it is executed
		# in case of failure the task will be executed again
		m = self.generator.bld.producer
		try:
			# TODO another place for this?
			del self.generator.bld.task_sigs[self.uid()]
		except KeyError:
			pass

		try:
			ret = self.run()
		except Exception:
			self.err_msg = Utils.ex_stack()
			self.hasrun = EXCEPTION

			# TODO cleanup
			m.error_handler(self)
			return

		if ret:
			self.err_code = ret
			self.hasrun = CRASHED
		else:
			try:
				self.post_run()
			except Errors.WafError:
				pass
			except Exception:
				self.err_msg = Utils.ex_stack()
				self.hasrun = EXCEPTION
			else:
				self.hasrun = SUCCESS
		if self.hasrun != SUCCESS:
			m.error_handler(self)
开发者ID:u3shit,项目名称:waf,代码行数:44,代码来源:Task.py

示例14: load

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
    def load(self, input, tooldir=None, funs=None, download=True):
        """
        Load Waf tools, which will be imported whenever a build is started.

        :param input: waf tools to import
        :type input: list of string
        :param tooldir: paths for the imports
        :type tooldir: list of string
        :param funs: functions to execute from the waf tools
        :type funs: list of string
        :param download: whether to download the tool from the waf repository
        :type download: bool
        """

        tools = Utils.to_list(input)
        if tooldir:
            tooldir = Utils.to_list(tooldir)
        for tool in tools:
            # avoid loading the same tool more than once with the same functions
            # used by composite projects

            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:pbx,项目名称:kupfer,代码行数:55,代码来源:Configure.py

示例15: get_ifort_version_win32

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import ex_stack [as 别名]
def get_ifort_version_win32(conf,compiler,version,target,vcvars):
	try:
		conf.msvc_cnt+=1
	except AttributeError:
		conf.msvc_cnt=1
	batfile=conf.bldnode.make_node('waf-print-msvc-%d.bat'%conf.msvc_cnt)
	batfile.write("""@echo off
set INCLUDE=
set LIB=
call "%s" %s
echo PATH=%%PATH%%
echo INCLUDE=%%INCLUDE%%
echo LIB=%%LIB%%;%%LIBPATH%%
"""%(vcvars,target))
	sout=conf.cmd_and_log(['cmd.exe','/E:on','/V:on','/C',batfile.abspath()])
	batfile.delete()
	lines=sout.splitlines()
	if not lines[0]:
		lines.pop(0)
	MSVC_PATH=MSVC_INCDIR=MSVC_LIBDIR=None
	for line in lines:
		if line.startswith('PATH='):
			path=line[5:]
			MSVC_PATH=path.split(';')
		elif line.startswith('INCLUDE='):
			MSVC_INCDIR=[i for i in line[8:].split(';')if i]
		elif line.startswith('LIB='):
			MSVC_LIBDIR=[i for i in line[4:].split(';')if i]
	if None in(MSVC_PATH,MSVC_INCDIR,MSVC_LIBDIR):
		conf.fatal('msvc: Could not find a valid architecture for building (get_ifort_version_win32)')
	env=dict(os.environ)
	env.update(PATH=path)
	compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler)
	fc=conf.find_program(compiler_name,path_list=MSVC_PATH)
	if'CL'in env:
		del(env['CL'])
	try:
		try:
			conf.cmd_and_log(fc+['/help'],env=env)
		except UnicodeError:
			st=Utils.ex_stack()
			if conf.logger:
				conf.logger.error(st)
			conf.fatal('msvc: Unicode error - check the code page?')
		except Exception as e:
			debug('msvc: get_ifort_version: %r %r %r -> failure %s'%(compiler,version,target,str(e)))
			conf.fatal('msvc: cannot run the compiler in get_ifort_version (run with -v to display errors)')
		else:
			debug('msvc: get_ifort_version: %r %r %r -> OK',compiler,version,target)
	finally:
		conf.env[compiler_name]=''
	return(MSVC_PATH,MSVC_INCDIR,MSVC_LIBDIR)
开发者ID:guysherman,项目名称:basic-cpp-template,代码行数:54,代码来源:ifort.py


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