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


Python Utils.split_path方法代码示例

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


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

示例1: make_node

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def make_node(self, lst):
		"""
		Returns or creates a Node object corresponding to the input path without considering the filesystem.

		:param lst: relative path
		:type lst: string or list of string
		:rtype: :py:class:´waflib.Node.Node´
		"""
		if isinstance(lst, str):
			lst = [x for x in Utils.split_path(lst) if x and x != '.']

		cur = self
		for x in lst:
			if x == '..':
				cur = cur.parent or cur
				continue

			try:
				cur = cur.children[x]
			except AttributeError:
				cur.children = self.dict_class()
			except KeyError:
				pass
			else:
				continue
			cur = self.__class__(x, cur)
		return cur
开发者ID:Tiksagol,项目名称:waf,代码行数:29,代码来源:Node.py

示例2: find_node

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def find_node(self,lst):
		if isinstance(lst,str):
			lst=[x for x in Utils.split_path(lst)if x and x!='.']
		cur=self
		for x in lst:
			if x=='..':
				cur=cur.parent or cur
				continue
			try:
				ch=cur.children
			except AttributeError:
				cur.children=self.dict_class()
			else:
				try:
					cur=ch[x]
					continue
				except KeyError:
					pass
			cur=self.__class__(x,cur)
			if not cur.exists():
				cur.evict()
				return None
		if not cur.exists():
			cur.evict()
			return None
		return cur
开发者ID:Gnurou,项目名称:glmark2,代码行数:28,代码来源:Node.py

示例3: find_dir

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def find_dir(self,lst):
		if isinstance(lst,str):
			lst=[x for x in Utils.split_path(lst)if x and x!='.']
		node=self.find_node(lst)
		if node and not node.isdir():
			return None
		return node
开发者ID:Gnurou,项目名称:glmark2,代码行数:9,代码来源:Node.py

示例4: find_or_declare_win32

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def find_or_declare_win32(self, lst):
		# assuming that "find_or_declare" is called before the build starts, remove the calls to os.path.isfile
		if isinstance(lst, str):
			lst = [x for x in Utils.split_path(lst) if x and x != '.']

		node = self.get_bld().search_node(lst)
		if node:
			if not node.isfile_cached():
				try:
					node.parent.mkdir()
				except OSError:
					pass
			return node
		self = self.get_src()
		node = self.find_node(lst)
		if node:
			if not node.isfile_cached():
				try:
					node.parent.mkdir()
				except OSError:
					pass
			return node
		node = self.get_bld().make_node(lst)
		node.parent.mkdir()
		return node
开发者ID:ArduPilot,项目名称:waf,代码行数:27,代码来源:win32_opts.py

示例5: find_or_declare

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def find_or_declare(self, lst):
		"""
		Use this method in the build phase to declare output files.

		If 'self' is in build directory, it first tries to return an existing node object.
		If no Node is found, it tries to find one in the source directory.
		If no Node is found, a new Node object is created in the build directory, and the
		intermediate folders are added.

		:param lst: relative path
		:type lst: string or list of string
		"""
		if isinstance(lst, str):
			lst = [x for x in Utils.split_path(lst) if x and x != '.']

		node = self.get_bld().search_node(lst)
		if node:
			if not os.path.isfile(node.abspath()):
				node.parent.mkdir()
			return node
		self = self.get_src()
		node = self.find_node(lst)
		if node:
			return node
		node = self.get_bld().make_node(lst)
		node.parent.mkdir()
		return node
开发者ID:Tiksagol,项目名称:waf,代码行数:29,代码来源:Node.py

示例6: to_src_nodes

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def to_src_nodes(lst):
		"""Find file nodes only in src, TaskGen.to_nodes will not work for this since it gives
		preference to nodes in build.
		"""
		if isinstance(lst, Node.Node):
			if not lst.is_src():
				raise Errors.WafError('buildcopy: node %s is not in src'%lst)
			if not os.path.isfile(lst.abspath()):
				raise Errors.WafError('buildcopy: Cannot copy directory %s (unsupported action)'%lst)
			return lst

		if isinstance(lst, str):
			lst = [x for x in Utils.split_path(lst) if x and x != '.']

		node = self.bld.path.get_src().search_node(lst)
		if node:
			if not os.path.isfile(node.abspath()):
				raise Errors.WafError('buildcopy: Cannot copy directory %s (unsupported action)'%node)
			return node

		node = self.bld.path.get_src().find_node(lst)
		if node:
			if not os.path.isfile(node.abspath()):
				raise Errors.WafError('buildcopy: Cannot copy directory %s (unsupported action)'%node)
			return node
		raise Errors.WafError('buildcopy: File not found in src: %s'%os.path.join(*lst))
开发者ID:ventosus,项目名称:lv2,代码行数:28,代码来源:buildcopy.py

示例7: find_resource

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def find_resource(self,lst):
		if isinstance(lst,str):
			lst=[x for x in Utils.split_path(lst)if x and x!='.']
		node=self.get_bld().search_node(lst)
		if not node:
			node=self.get_src().find_node(lst)
		if node and node.isdir():
			return None
		return node
开发者ID:Gnurou,项目名称:glmark2,代码行数:11,代码来源:Node.py

示例8: search_node

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def search_node(self,lst):
		if isinstance(lst,str):
			lst=[x for x in Utils.split_path(lst)if x and x!='.']
		cur=self
		for x in lst:
			if x=='..':
				cur=cur.parent or cur
			else:
				try:
					cur=cur.children[x]
				except(AttributeError,KeyError):
					return None
		return cur
开发者ID:Gnurou,项目名称:glmark2,代码行数:15,代码来源:Node.py

示例9: find_or_declare

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def find_or_declare(self,lst):
		if isinstance(lst,str):
			lst=[x for x in Utils.split_path(lst)if x and x!='.']
		node=self.get_bld().search_node(lst)
		if node:
			if not os.path.isfile(node.abspath()):
				node.parent.mkdir()
			return node
		self=self.get_src()
		node=self.find_node(lst)
		if node:
			return node
		node=self.get_bld().make_node(lst)
		node.parent.mkdir()
		return node
开发者ID:Gnurou,项目名称:glmark2,代码行数:17,代码来源:Node.py

示例10: find_dir

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def find_dir(self, lst):
		"""
		Searches for a folder on the filesystem (see :py:meth:`waflib.Node.Node.find_node`)

		:param lst: relative path
		:type lst: string or list of string
		:returns: The corresponding Node object or None if there is no such folder
		:rtype: :py:class:`waflib.Node.Node`
		"""
		if isinstance(lst, str):
			lst = [x for x in Utils.split_path(lst) if x and x != '.']

		node = self.find_node(lst)
		if node and not node.isdir():
			return None
		return node
开发者ID:Tiksagol,项目名称:waf,代码行数:18,代码来源:Node.py

示例11: find_node

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def find_node(self, lst):
		"""
		Finds a node on the file system (files or folders), and creates the corresponding Node objects if it exists

		:param lst: relative path
		:type lst: string or list of string
		:returns: The corresponding Node object or None if no entry was found on the filesystem
		:rtype: :py:class:´waflib.Node.Node´
		"""

		if isinstance(lst, str):
			lst = [x for x in Utils.split_path(lst) if x and x != '.']

		if lst and lst[0].startswith('\\\\') and not self.parent:
			node = self.ctx.root.make_node(lst[0])
			node.cache_isdir = True
			return node.find_node(lst[1:])

		cur = self
		for x in lst:
			if x == '..':
				cur = cur.parent or cur
				continue

			try:
				ch = cur.children
			except AttributeError:
				cur.children = self.dict_class()
			else:
				try:
					cur = ch[x]
					continue
				except KeyError:
					pass

			# optimistic: create the node first then look if it was correct to do so
			cur = self.__class__(x, cur)
			if not cur.exists():
				cur.evict()
				return None

		if not cur.exists():
			cur.evict()
			return None

		return cur
开发者ID:blablack,项目名称:ams-lv2,代码行数:48,代码来源:Node.py

示例12: make_node

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def make_node(self,lst):
		if isinstance(lst,str):
			lst=[x for x in Utils.split_path(lst)if x and x!='.']
		cur=self
		for x in lst:
			if x=='..':
				cur=cur.parent or cur
				continue
			try:
				cur=cur.children[x]
			except AttributeError:
				cur.children=self.dict_class()
			except KeyError:
				pass
			else:
				continue
			cur=self.__class__(x,cur)
		return cur
开发者ID:Gnurou,项目名称:glmark2,代码行数:20,代码来源:Node.py

示例13: find_or_declare

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
def find_or_declare(self, lst):
	if isinstance(lst, str):
		lst = [x for x in Utils.split_path(lst) if x and x != '.']

	if lst[0].startswith('\\\\'):
		if len(lst) < 3:
			return None
		node = self.ctx.root.make_node(lst[0]).make_node(lst[1])
		node.cache_isdir = True
		node.parent.cache_isdir = True
		ret = node.find_node(lst[2:])
		if not ret:
			ret = node.make_node(lst[2:])
		if not os.path.isfile(ret.abspath()):
			ret.parent.mkdir()
		return ret

	return self.find_or_declare_orig(lst)
开发者ID:ArduPilot,项目名称:waf,代码行数:20,代码来源:unc.py

示例14: search_node

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def search_node(self, lst):
		"""
		Returns a Node previously defined in the data structure. The filesystem is not considered.

		:param lst: relative path
		:type lst: string or list of string
		:rtype: :py:class:´waflib.Node.Node´ or None if there is no entry in the Node datastructure
		"""
		if isinstance(lst, str):
			lst = [x for x in Utils.split_path(lst) if x and x != '.']

		cur = self
		for x in lst:
			if x == '..':
				cur = cur.parent or cur
			else:
				try:
					cur = cur.children[x]
				except (AttributeError, KeyError):
					return None
		return cur
开发者ID:Tiksagol,项目名称:waf,代码行数:23,代码来源:Node.py

示例15: find_resource

# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import split_path [as 别名]
	def find_resource(self, lst):
		"""
		Use this method in the build phase to find source files corresponding to the relative path given.

		First it looks up the Node data structure to find any declared Node object in the build directory.
		If None is found, it then considers the filesystem in the source directory.

		:param lst: relative path
		:type lst: string or list of string
		:returns: the corresponding Node object or None
		:rtype: :py:class:`waflib.Node.Node`
		"""
		if isinstance(lst, str):
			lst = [x for x in Utils.split_path(lst) if x and x != '.']

		node = self.get_bld().search_node(lst)
		if not node:
			node = self.get_src().find_node(lst)
		if node and node.isdir():
			return None
		return node
开发者ID:Tiksagol,项目名称:waf,代码行数:23,代码来源:Node.py


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