當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。