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


Python pkg_resources.PathMetadata方法代码示例

本文整理汇总了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,
        ) 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:25,代码来源:req_install.py

示例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,
    ) 
开发者ID:pantsbuild,项目名称:pex,代码行数:26,代码来源:req_install.py

示例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,
    ) 
开发者ID:ali5h,项目名称:rules_pip,代码行数:27,代码来源:req_install.py

示例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,
        ) 
开发者ID:boris-kz,项目名称:CogAlg,代码行数:24,代码来源:req_install.py

示例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,
        ) 
开发者ID:V1EngineeringInc,项目名称:V1EngineeringInc-Docs,代码行数:24,代码来源:req_install.py

示例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) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:12,代码来源:req_install.py

示例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,
        ) 
开发者ID:HaoZhang95,项目名称:Python24,代码行数:13,代码来源:req_install.py


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