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


Python Utils.h_file方法代码示例

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


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

示例1: process_lib

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
def process_lib(self):
	"""
	Find the location of a foreign library. Used by :py:class:`waflib.Tools.ccroot.read_shlib` and :py:class:`waflib.Tools.ccroot.read_stlib`.
	"""
	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:
				try:
					Utils.h_file(node.abspath())
				except EnvironmentError:
					raise ValueError('Could not read %r' % y)
				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:ventosus,项目名称:lv2,代码行数:30,代码来源:ccroot.py

示例2: dynamic_post

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
def dynamic_post(self):
    if not getattr(self, 'dynamic_source', None):
        return
    self.source = Utils.to_list(self.source)

    src = self.bld.path.get_bld().ant_glob (Utils.to_list(self.dynamic_source))

    for cc in src:
        # Signature for the source
        cc.sig = Utils.h_file (cc.abspath())
        # Signature for the header
        h = cc.change_ext (".h")
        h.sig = Utils.h_file (h.abspath())

    self.source.extend (src)
开发者ID:zhenkai,项目名称:sync,代码行数:17,代码来源:protobuf.py

示例3: load_envs

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
	def load_envs(self):
		"""load the data from the project directory into self.allenvs"""
		try:
			lst = Utils.listdir(self.cache_dir)
		except OSError as e:
			if e.errno == errno.ENOENT:
				raise Errors.WafError('The project was not configured: run "waf configure" first!')
			else:
				raise

		if not lst:
			raise Errors.WafError('The cache directory is empty: reconfigure the project')

		for fname in lst:
			if fname.endswith(CACHE_SUFFIX):
				env = ConfigSet.ConfigSet(os.path.join(self.cache_dir, fname))
				name = fname[:-len(CACHE_SUFFIX)]
				self.all_envs[name] = env

				for f in env[CFG_FILES]:
					newnode = self.path.find_or_declare(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:zsx,项目名称:waf,代码行数:29,代码来源:Build.py

示例4: runnable_status

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
	def runnable_status(self):
		for t in self.run_after:
			if not t.hasrun:
				return Task.ASK_LATER
		for x in self.outputs:
			x.sig=Utils.h_file(x.abspath())
		return Task.SKIP_ME
开发者ID:PseudoSky,项目名称:voodoo,代码行数:9,代码来源:ccroot.py

示例5: runnable_status

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
	def runnable_status(self):
		status = old_runnable_status(self)
		if status != RUN_ME:
			return status

		try:
			# by default, we check that the output nodes have the signature of the task
			# perform a second check, returning 'SKIP_ME' as we are expecting that
			# the signatures do not match
			bld = self.generator.bld
			prev_sig = bld.task_sigs[self.uid()]
			if prev_sig == self.signature():
				for x in self.outputs:
					if not x.is_child_of(bld.bldnode):
						# special case of files created in the source directory
						# hash them here for convenience -_-
						x.sig = Utils.h_file(x.abspath())
					if not x.sig or bld.task_sigs[x.abspath()] != self.uid():
						return RUN_ME
				return SKIP_ME
		except OSError:
			pass
		except IOError:
			pass
		except KeyError:
			pass
		except IndexError:
			pass
		except AttributeError:
			pass
		return RUN_ME
开发者ID:edudev,项目名称:waf,代码行数:33,代码来源:Task.py

示例6: load_envs

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
	def load_envs(self):
		"""
		The configuration command creates files of the form ``build/c4che/NAMEcache.py``. This method
		creates a :py:class:`waflib.ConfigSet.ConfigSet` instance for each ``NAME`` by reading those
		files. The config sets are then stored in the dict :py:attr:`waflib.Build.BuildContext.allenvs`.
		"""
		try:
			lst = Utils.listdir(self.cache_dir)
		except OSError as e:
			if e.errno == errno.ENOENT:
				raise Errors.WafError('The project was not configured: run "waf configure" first!')
			else:
				raise

		if not lst:
			raise Errors.WafError('The cache directory is empty: reconfigure the project')

		for fname in lst:
			if fname.endswith(CACHE_SUFFIX):
				env = ConfigSet.ConfigSet(os.path.join(self.cache_dir, fname))
				name = fname[:-len(CACHE_SUFFIX)]
				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:SjB,项目名称:waf,代码行数:33,代码来源:Build.py

示例7: runnable_status

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
	def runnable_status(self):
		status=old_runnable_status(self)
		if status!=RUN_ME:
			return status
		try:
			bld=self.generator.bld
			prev_sig=bld.task_sigs[self.uid()]
			if prev_sig==self.signature():
				for x in self.outputs:
					if not x.is_child_of(bld.bldnode):
						x.sig=Utils.h_file(x.abspath())
					if not x.sig or bld.task_sigs[x.abspath()]!=self.uid():
						return RUN_ME
				return SKIP_ME
		except OSError:
			pass
		except IOError:
			pass
		except KeyError:
			pass
		except IndexError:
			pass
		except AttributeError:
			pass
		return RUN_ME
开发者ID:OpenDAWN,项目名称:Minaton,代码行数:27,代码来源:Task.py

示例8: process_lib

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
def process_lib(self):
	"""
	Find the location of a foreign library. Used by :py:class:`waflib.Tools.ccroot.read_shlib` and :py:class:`waflib.Tools.ccroot.read_stlib`.
	"""
	node = None

	names = [x % self.name for x in lib_patterns[self.lib_type]]
	for x in self.lib_paths + [self.path, '/usr/lib64', '/usr/lib', '/usr/local/lib64', '/usr/local/lib']:
		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:Dzshiftt,项目名称:Gnomescroll,代码行数:27,代码来源:ccroot.py

示例9: load_envs

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
	def load_envs(self):
		"""
		The configuration command creates files of the form ``build/c4che/NAMEcache.py``. This method
		creates a :py:class:`waflib.ConfigSet.ConfigSet` instance for each ``NAME`` by reading those
		files. The config sets are then stored in the dict :py:attr:`waflib.Build.BuildContext.allenvs`.
		"""
		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:Anastasia1302,项目名称:code-pile,代码行数:28,代码来源:Build.py

示例10: h_file

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
def h_file(self):
	try:
		ret = getxattr(self)
	except OSError:
		if HASH_CACHE:
			st = os.stat(self.abspath())
			mtime = st.st_mtime
			size = st.st_size
	else:
		if len(ret) == 16:
			# for build directory files
			return ret

		if HASH_CACHE:
			# check if timestamp and mtime match to avoid re-hashing
			st = os.stat(self.abspath())
			mtime, size = ret[16:].split(SEP)
			if int(1000 * st.st_mtime) == int(mtime) and st.st_size == int(size):
				return ret[:16]

	ret = Utils.h_file(self.abspath())
	if HASH_CACHE:
		val = TEMPLATE % (ret, int(1000 * st.st_mtime), int(st.st_size))
		try:
			setxattr(self, val)
		except PermissionError:
			os.chmod(self.abspath(), st.st_mode | 128)
			setxattr(self, val)
	return ret
开发者ID:blablack,项目名称:ams-lv2,代码行数:31,代码来源:waf_xattr.py

示例11: h_file

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
	def h_file(self):
		"""
		See :py:func:`waflib.Utils.h_file`

		:return: a hash representing the file contents
		:rtype: string or bytes
		"""
		return Utils.h_file(self.abspath())
开发者ID:Tiksagol,项目名称:waf,代码行数:10,代码来源:Node.py

示例12: scan

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
 def scan(self):
     py = self.generator.bld.py
     xfiles, xany = list(), list()
     for pat in Utils.to_list(self.xtra):
         xfiles.extend(py.ant_glob(pat, remove=False))
     for x in xfiles:
         x.sig = Utils.h_file(x.abspath())
     return xfiles, xany
开发者ID:anthonyrisinger,项目名称:zippy,代码行数:10,代码来源:task.py

示例13: get_bld_sig

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
def get_bld_sig(self):
	if not self.is_bld() or self.ctx.bldnode is self.ctx.srcnode:
		return Utils.h_file(self.abspath())

	try:
		# add the creation time to the signature
		return self.sig + str(os.stat(self.abspath()).st_mtime)
	except AttributeError:
		return None
开发者ID:afeldman,项目名称:waf,代码行数:11,代码来源:build_file_tracker.py

示例14: post_run

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
	def post_run(self):
		nodes=self.output_dir.ant_glob('**/*',quiet=True)
		for x in nodes:
			x.sig=Utils.h_file(x.abspath())
		self.outputs+=nodes
		if getattr(self.generator,'install_path',None):
			if not getattr(self.generator,'doxy_tar',None):
				self.generator.bld.install_files(self.generator.install_path,self.outputs,postpone=False)
		return Task.Task.post_run(self)
开发者ID:OpenDAWN,项目名称:Minaton,代码行数:11,代码来源:doxygen.py

示例15: post_run

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import h_file [as 别名]
	def post_run(self):
		html = self.generator
		nodes = html.output_dir.ant_glob('**/*', quiet=True)
		print nodes[0:10]
		for x in nodes:
			x.sig = Utils.h_file(x.abspath())
		self.outputs += nodes
		html.bld.install_files(html.env.MDOC_OUTPUT, nodes, cwd=html.output_dir, relative_trick=True, postpone=False)
		return Task.Task.post_run(self)
开发者ID:loverszhaokai,项目名称:peach-bupt-paper,代码行数:11,代码来源:mdoc.py


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