本文整理匯總了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,
)