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


Python Utils.h_list方法代码示例

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


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

示例1: get_bld_sig

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	def get_bld_sig(self):
		"""
		Returns a signature (see :py:meth:`waflib.Node.Node.h_file`) for the purpose
		of build dependency calculation. This method uses a per-context cache.

		:return: a hash representing the object contents
		:rtype: string or bytes
		"""
		# previous behaviour can be set by returning self.ctx.node_sigs[self] when a build node
		try:
			cache = self.ctx.cache_sig
		except AttributeError:
			cache = self.ctx.cache_sig = {}
		try:
			ret = cache[self]
		except KeyError:
			p = self.abspath()
			try:
				ret = cache[self] = self.h_file()
			except EnvironmentError:
				if self.isdir():
					# allow folders as build nodes, do not use the creation time
					st = os.stat(p)
					ret = cache[self] = Utils.h_list([p, st.st_ino, st.st_mode])
					return ret
				raise
		return ret
开发者ID:Tiksagol,项目名称:waf,代码行数:29,代码来源:Node.py

示例2: hash_env_vars

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	def hash_env_vars(self, env, vars_lst):
		"""
		Hashes configuration set variables::

			def build(bld):
				bld.hash_env_vars(bld.env, ['CXX', 'CC'])

		This method uses an internal cache.

		:param env: Configuration Set
		:type env: :py:class:`waflib.ConfigSet.ConfigSet`
		:param vars_lst: list of variables
		:type vars_list: list of string
		"""

		if not env.table:
			env = env.parent
			if not env:
				return Utils.SIG_NIL

		idx = str(id(env)) + str(vars_lst)
		try:
			cache = self.cache_env
		except AttributeError:
			cache = self.cache_env = {}
		else:
			try:
				return self.cache_env[idx]
			except KeyError:
				pass

		lst = [env[a] for a in vars_lst]
		cache[idx] = ret = Utils.h_list(lst)
		Logs.debug('envhash: %s %r', Utils.to_hex(ret), lst)
		return ret
开发者ID:blablack,项目名称:ams-lv2,代码行数:37,代码来源:Build.py

示例3: execute

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	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)
开发者ID:XNerv,项目名称:waf,代码行数:30,代码来源:Scripting.py

示例4: execute

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	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:
			cmd=env['config_cmd']or'configure'
			if Configure.autoconfig=='clobber':
				tmp=Options.options.__dict__
				Options.options.__dict__=env.options
				try:
					run_command(cmd)
				finally:
					Options.options.__dict__=tmp
			else:
				run_command(cmd)
			run_command(self.cmd)
		else:
			return execute_method(self)
开发者ID:hgneng,项目名称:ekho,代码行数:34,代码来源:Scripting.py

示例5: sig_deep_inputs

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	def sig_deep_inputs(self):
		"""
		Enable rebuilds on input files task signatures. Not used by default.

		Example: hashes of output programs can be unchanged after being re-linked,
		despite the libraries being different. This method can thus prevent stale unit test
		results (waf_unit_test.py).

		Hashing input file timestamps is another possibility for the implementation.
		This may cause unnecessary rebuilds when input tasks are frequently executed.
		Here is an implementation example::

			lst = []
			for node in self.inputs + self.dep_nodes:
				st = os.stat(node.abspath())
				lst.append(st.st_mtime)
				lst.append(st.st_size)
			self.m.update(Utils.h_list(lst))

		The downside of the implementation is that it absolutely requires all build directory
		files to be declared within the current build.
		"""
		bld = self.generator.bld
		lst = [bld.task_sigs[bld.node_sigs[node]] for node in (self.inputs + self.dep_nodes) if node.is_bld()]
		self.m.update(Utils.h_list(lst))
开发者ID:bugengine,项目名称:BugEngine,代码行数:27,代码来源:Task.py

示例6: rsync_and_ssh

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
def rsync_and_ssh(task):

	# remove a warning
	task.uid_ = id(task)

	bld = task.generator.bld

	task.env.user, _, _ = task.env.login.partition('@')
	task.env.hdir = Utils.to_hex(Utils.h_list((task.generator.path.abspath(), task.env.variant)))
	task.env.remote_dir = '~%s/wafremote/%s' % (task.env.user, task.env.hdir)
	task.env.local_dir = bld.srcnode.abspath() + '/'

	task.env.remote_dir_variant = '%s/%s/%s' % (task.env.remote_dir, Context.g_module.out, task.env.variant)
	task.env.build_dir = bld.bldnode.abspath()

	ret = task.exec_command(bld.make_mkdir_command(task))
	if ret:
		return ret
	ret = task.exec_command(bld.make_send_command(task))
	if ret:
		return ret
	ret = task.exec_command(bld.make_exec_command(task))
	if ret:
		return ret
	ret = task.exec_command(bld.make_save_command(task))
	if ret:
		return ret
开发者ID:JodyGoldberg,项目名称:waf,代码行数:29,代码来源:remote.py

示例7: hash_env_vars

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	def hash_env_vars(self, env, vars_lst):
		"""hash environment variables
		['CXX', ..] -> [env['CXX'], ..] -> md5()

		cached by build context
		"""

		if not env.table:
			env = env.parent
			if not env:
				return Utils.SIG_NIL

		idx = str(id(env)) + str(vars_lst)
		try:
			cache = self.cache_env
		except AttributeError:
			cache = self.cache_env = {}
		else:
			try:
				return self.cache_env[idx]
			except KeyError:
				pass

		lst = [str(env[a]) for a in vars_lst]
		ret = Utils.h_list(lst)
		Logs.debug('envhash: %r %r', ret, lst)

		cache[idx] = ret

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

示例8: hash_aux_nodes

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	def hash_aux_nodes(self):
		try:
			self.aux_nodes
		except AttributeError:
			try:
				self.aux_nodes = self.scan_aux(self.inputs[0].change_ext('.aux'))
			except IOError:
				return None
		return Utils.h_list([Utils.h_file(x.abspath()) for x in self.aux_nodes])
开发者ID:DigitalDan05,项目名称:waf,代码行数:11,代码来源:tex.py

示例9: run_c_code

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

示例10: post_recurse

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	def post_recurse(self, node):
		"""
		Records the path and a hash of the scripts visited, see :py:meth:`waflib.Context.Context.post_recurse`

		:param node: script
		:type node: :py:class:`waflib.Node.Node`
		"""
		super(ConfigurationContext, self).post_recurse(node)
		self.hash = Utils.h_list((self.hash, node.read('rb')))
		self.files.append(node.abspath())
开发者ID:BigPigg,项目名称:waf,代码行数:12,代码来源:Configure.py

示例11: sig_vars

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	def sig_vars(self):
		bld=self.generator.bld
		env=self.env
		upd=self.m.update
		vars=self.generator.bld.raw_deps.get(self.uid(),[])
		act_sig=bld.hash_env_vars(env,vars)
		upd(act_sig)
		lst=[getattr(self.generator,x,'')for x in vars]
		upd(Utils.h_list(lst))
		return self.m.digest()
开发者ID:AKASeon,项目名称:Whatever,代码行数:12,代码来源:TaskGen.py

示例12: run_c_code

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

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

示例14: sig_vars

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	def sig_vars(self):
		bld=self.generator.bld
		env=self.env
		upd=self.m.update
		if getattr(self.generator,'subst_fun',None):
			upd(Utils.h_fun(self.generator.subst_fun).encode())
		vars=self.generator.bld.raw_deps.get(self.uid(),[])
		act_sig=bld.hash_env_vars(env,vars)
		upd(act_sig)
		lst=[getattr(self.generator,x,'')for x in vars]
		upd(Utils.h_list(lst))
		return self.m.digest()
开发者ID:RONNCC,项目名称:pysoy,代码行数:14,代码来源:TaskGen.py

示例15: run

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_list [as 别名]
	def run(self):
		env=self.env
		if not env['PROMPT_LATEX']:
			env.append_value('LATEXFLAGS','-interaction=batchmode')
			env.append_value('PDFLATEXFLAGS','-interaction=batchmode')
			env.append_value('XELATEXFLAGS','-interaction=batchmode')
		fun=self.texfun
		node=self.inputs[0]
		srcfile=node.abspath()
		texinputs=self.env.TEXINPUTS or''
		self.TEXINPUTS=node.parent.get_bld().abspath()+os.pathsep\
		  +node.parent.get_src().abspath()+os.pathsep\
		  +self.generator.path.get_src().abspath()+os.pathsep\
		  +self.generator.path.get_bld().abspath()+os.pathsep\
		  +texinputs+os.pathsep
		self.cwd=self.inputs[0].parent.get_bld().abspath()
		Logs.warn('first pass on %s'%self.__class__.__name__)
		self.env.env={}
		self.env.env.update(os.environ)
		self.env.env.update({'TEXINPUTS':self.TEXINPUTS,'TEXPICTS':self.TEXINPUTS})
		self.env.SRCFILE=srcfile
		self.env.LOF_FILES=node.change_ext(".lof").abspath()
		print "LOF_FILES:",self.env.LOF_FILES
		#print fun
		#print self.env
		fun_clean=self.texfun_clean
		fun_clean()
		self.check_status('error when calling latex',fun())
		fun_clean()
		self.aux_nodes=self.scan_aux(node.change_ext('.aux'))
		self.idx_node=node.change_ext('.idx')
		self.bibtopic()
		self.bibfile()
		self.bibunits()
		self.makeindex()
		hash=''
		for i in range(10):
			prev_hash=hash
			try:
				hashes=[Utils.h_file(x.abspath())for x in self.aux_nodes]
				hash=Utils.h_list(hashes)
			except(OSError,IOError):
				Logs.error('could not read aux.h')
				pass
			if hash and hash==prev_hash:
				break
			Logs.warn('calling %s'%self.__class__.__name__)
			self.env.env={}
			self.env.env.update(os.environ)
			self.env.env.update({'TEXINPUTS':self.TEXINPUTS})
			self.env.SRCFILE=srcfile
			#fun_clean()
			self.check_status('error when calling %s'%self.__class__.__name__,fun())
开发者ID:tjhunter,项目名称:phd-thesis-tjhunter,代码行数:55,代码来源:tex2.py


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