本文整理汇总了Python中pip._vendor.pkg_resources.PathMetadata方法的典型用法代码示例。如果您正苦于以下问题:Python pkg_resources.PathMetadata方法的具体用法?Python pkg_resources.PathMetadata怎么用?Python pkg_resources.PathMetadata使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pip._vendor.pkg_resources
的用法示例。
在下文中一共展示了pkg_resources.PathMetadata方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_dist
# 需要导入模块: from pip._vendor import pkg_resources [as 别名]
# 或者: from pip._vendor.pkg_resources import PathMetadata [as 别名]
def get_dist(self):
# type: () -> Distribution
"""Return a pkg_resources.Distribution for this requirement"""
if self.metadata_directory:
base_dir, distinfo = os.path.split(self.metadata_directory)
metadata = pkg_resources.PathMetadata(
base_dir, self.metadata_directory
)
dist_name = os.path.splitext(distinfo)[0]
typ = pkg_resources.DistInfoDistribution
else:
egg_info = self.egg_info_path.rstrip(os.path.sep)
base_dir = os.path.dirname(egg_info)
metadata = pkg_resources.PathMetadata(base_dir, egg_info)
dist_name = os.path.splitext(os.path.basename(egg_info))[0]
# https://github.com/python/mypy/issues/1174
typ = pkg_resources.Distribution # type: ignore
return typ(
base_dir,
project_name=dist_name,
metadata=metadata,
)
示例2: _get_dist
# 需要导入模块: from pip._vendor import pkg_resources [as 别名]
# 或者: from pip._vendor.pkg_resources import PathMetadata [as 别名]
def _get_dist(metadata_directory):
# type: (str) -> Distribution
"""Return a pkg_resources.Distribution for the provided
metadata directory.
"""
dist_dir = metadata_directory.rstrip(os.sep)
# Determine the correct Distribution object type.
if dist_dir.endswith(".egg-info"):
dist_cls = pkg_resources.Distribution
else:
assert dist_dir.endswith(".dist-info")
dist_cls = pkg_resources.DistInfoDistribution
# Build a PathMetadata object, from path to metadata. :wink:
base_dir, dist_dir_name = os.path.split(dist_dir)
dist_name = os.path.splitext(dist_dir_name)[0]
metadata = pkg_resources.PathMetadata(base_dir, dist_dir)
return dist_cls(
base_dir,
project_name=dist_name,
metadata=metadata,
)
示例3: _get_dist
# 需要导入模块: from pip._vendor import pkg_resources [as 别名]
# 或者: from pip._vendor.pkg_resources import PathMetadata [as 别名]
def _get_dist(metadata_directory):
# type: (str) -> Distribution
"""Return a pkg_resources.Distribution for the provided
metadata directory.
"""
dist_dir = metadata_directory.rstrip(os.sep)
# Build a PathMetadata object, from path to metadata. :wink:
base_dir, dist_dir_name = os.path.split(dist_dir)
metadata = pkg_resources.PathMetadata(base_dir, dist_dir)
# Determine the correct Distribution object type.
if dist_dir.endswith(".egg-info"):
dist_cls = pkg_resources.Distribution
dist_name = os.path.splitext(dist_dir_name)[0]
else:
assert dist_dir.endswith(".dist-info")
dist_cls = pkg_resources.DistInfoDistribution
dist_name = os.path.splitext(dist_dir_name)[0].split("-")[0]
return dist_cls(
base_dir,
project_name=dist_name,
metadata=metadata,
)
示例4: get_dist
# 需要导入模块: from pip._vendor import pkg_resources [as 别名]
# 或者: from pip._vendor.pkg_resources import PathMetadata [as 别名]
def get_dist(self):
# type: () -> Distribution
"""Return a pkg_resources.Distribution for this requirement"""
dist_dir = self.metadata_directory.rstrip(os.sep)
# Determine the correct Distribution object type.
if dist_dir.endswith(".egg-info"):
dist_cls = pkg_resources.Distribution
else:
assert dist_dir.endswith(".dist-info")
dist_cls = pkg_resources.DistInfoDistribution
# Build a PathMetadata object, from path to metadata. :wink:
base_dir, dist_dir_name = os.path.split(dist_dir)
dist_name = os.path.splitext(dist_dir_name)[0]
metadata = pkg_resources.PathMetadata(base_dir, dist_dir)
return dist_cls(
base_dir,
project_name=dist_name,
metadata=metadata,
)
示例5: get_dist
# 需要导入模块: from pip._vendor import pkg_resources [as 别名]
# 或者: from pip._vendor.pkg_resources import PathMetadata [as 别名]
def get_dist(self):
# type: () -> Distribution
"""Return a pkg_resources.Distribution for this requirement"""
if self.metadata_directory:
dist_dir = self.metadata_directory
dist_cls = pkg_resources.DistInfoDistribution
else:
dist_dir = self.egg_info_path.rstrip(os.path.sep)
# https://github.com/python/mypy/issues/1174
dist_cls = pkg_resources.Distribution # type: ignore
# dist_dir_name can be of the form "<project>.dist-info" or
# e.g. "<project>.egg-info".
base_dir, dist_dir_name = os.path.split(dist_dir)
dist_name = os.path.splitext(dist_dir_name)[0]
metadata = pkg_resources.PathMetadata(base_dir, dist_dir)
return dist_cls(
base_dir,
project_name=dist_name,
metadata=metadata,
)
示例6: get_dist
# 需要导入模块: from pip._vendor import pkg_resources [as 别名]
# 或者: from pip._vendor.pkg_resources import PathMetadata [as 别名]
def get_dist(self):
"""Return a pkg_resources.Distribution built from self.egg_info_path"""
egg_info = self.egg_info_path('').rstrip('/')
base_dir = os.path.dirname(egg_info)
metadata = pkg_resources.PathMetadata(base_dir, egg_info)
dist_name = os.path.splitext(os.path.basename(egg_info))[0]
return pkg_resources.Distribution(
os.path.dirname(egg_info),
project_name=dist_name,
metadata=metadata)
示例7: get_dist
# 需要导入模块: from pip._vendor import pkg_resources [as 别名]
# 或者: from pip._vendor.pkg_resources import PathMetadata [as 别名]
def get_dist(self):
"""Return a pkg_resources.Distribution built from self.egg_info_path"""
egg_info = self.egg_info_path('').rstrip(os.path.sep)
base_dir = os.path.dirname(egg_info)
metadata = pkg_resources.PathMetadata(base_dir, egg_info)
dist_name = os.path.splitext(os.path.basename(egg_info))[0]
return pkg_resources.Distribution(
os.path.dirname(egg_info),
project_name=dist_name,
metadata=metadata,
)