當前位置: 首頁>>代碼示例>>Python>>正文


Python util.get_installed_distributions方法代碼示例

本文整理匯總了Python中pip.util.get_installed_distributions方法的典型用法代碼示例。如果您正苦於以下問題:Python util.get_installed_distributions方法的具體用法?Python util.get_installed_distributions怎麽用?Python util.get_installed_distributions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pip.util的用法示例。


在下文中一共展示了util.get_installed_distributions方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run_listing

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import get_installed_distributions [as 別名]
def run_listing(self, options):
        installed_packages = get_installed_distributions(local_only=options.local, skip=self.skip)
        self.output_package_listing(installed_packages) 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:5,代碼來源:list.py

示例2: run_editables

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import get_installed_distributions [as 別名]
def run_editables(self, options):
        installed_packages = get_installed_distributions(local_only=options.local, editables_only=True)
        self.output_package_listing(installed_packages) 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:5,代碼來源:list.py

示例3: find_packages_latests_versions

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import get_installed_distributions [as 別名]
def find_packages_latests_versions(self, options):
        index_urls = [options.index_url] + options.extra_index_urls
        if options.no_index:
            logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
            index_urls = []

        dependency_links = []
        for dist in get_installed_distributions(local_only=options.local):
            if dist.has_metadata('dependency_links.txt'):
                dependency_links.extend(
                    dist.get_metadata_lines('dependency_links.txt'),
                )

        finder = self._build_package_finder(options, index_urls)
        finder.add_dependency_links(dependency_links)

        installed_packages = get_installed_distributions(local_only=options.local, include_editables=False)
        for dist in installed_packages:
            req = InstallRequirement.from_line(dist.key, None)
            try:
                link = finder.find_requirement(req, True)

                # If link is None, means installed version is most up-to-date
                if link is None:
                    continue
            except DistributionNotFound:
                continue
            except BestVersionAlreadyInstalled:
                remote_version = req.installed_version
            else:
                # It might be a good idea that link or finder had a public method
                # that returned version
                remote_version = finder._link_package_versions(link, req.name)[0]
                remote_version_raw = remote_version[2]
                remote_version_parsed = remote_version[0]
            yield dist, remote_version_raw, remote_version_parsed 
開發者ID:jwvanderbeck,項目名稱:krpcScripts,代碼行數:38,代碼來源:list.py

示例4: run_listing

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import get_installed_distributions [as 別名]
def run_listing(self, options):
        installed_packages = get_installed_distributions(local_only=options.local)
        self.output_package_listing(installed_packages) 
開發者ID:jwvanderbeck,項目名稱:krpcScripts,代碼行數:5,代碼來源:list.py

示例5: find_packages_latests_versions

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import get_installed_distributions [as 別名]
def find_packages_latests_versions(self, options):
        index_urls = [options.index_url] + options.extra_index_urls
        if options.no_index:
            logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
            index_urls = []

        dependency_links = []
        for dist in get_installed_distributions(local_only=options.local, skip=self.skip):
            if dist.has_metadata('dependency_links.txt'):
                dependency_links.extend(
                    dist.get_metadata_lines('dependency_links.txt'),
                )

        finder = self._build_package_finder(options, index_urls)
        finder.add_dependency_links(dependency_links)

        installed_packages = get_installed_distributions(local_only=options.local, include_editables=False, skip=self.skip)
        for dist in installed_packages:
            req = InstallRequirement.from_line(dist.key, None)
            try:
                link = finder.find_requirement(req, True)

                # If link is None, means installed version is most up-to-date
                if link is None:
                    continue
            except DistributionNotFound:
                continue
            except BestVersionAlreadyInstalled:
                remote_version = req.installed_version
            else:
                # It might be a good idea that link or finder had a public method
                # that returned version
                remote_version = finder._link_package_versions(link, req.name)[0]
                remote_version_raw = remote_version[2]
                remote_version_parsed = remote_version[0]
            yield dist, remote_version_raw, remote_version_parsed 
開發者ID:pbrf,項目名稱:dymo-m10-python,代碼行數:38,代碼來源:list.py

示例6: find_packages_latests_versions

# 需要導入模塊: from pip import util [as 別名]
# 或者: from pip.util import get_installed_distributions [as 別名]
def find_packages_latests_versions(self, options):
        index_urls = [options.index_url] + options.extra_index_urls
        if options.no_index:
            logger.notify('Ignoring indexes: %s' % ','.join(index_urls))
            index_urls = []

        if options.use_mirrors:
            logger.deprecated("1.7",
                        "--use-mirrors has been deprecated and will be removed"
                        " in the future. Explicit uses of --index-url and/or "
                        "--extra-index-url is suggested.")

        if options.mirrors:
            logger.deprecated("1.7",
                        "--mirrors has been deprecated and will be removed in "
                        " the future. Explicit uses of --index-url and/or "
                        "--extra-index-url is suggested.")
            index_urls += options.mirrors

        dependency_links = []
        for dist in get_installed_distributions(local_only=options.local, skip=self.skip):
            if dist.has_metadata('dependency_links.txt'):
                dependency_links.extend(
                    dist.get_metadata_lines('dependency_links.txt'),
                )

        session = self._build_session(options)

        finder = self._build_package_finder(options, index_urls, session)
        finder.add_dependency_links(dependency_links)

        installed_packages = get_installed_distributions(local_only=options.local, include_editables=False, skip=self.skip)
        for dist in installed_packages:
            req = InstallRequirement.from_line(dist.key, None)
            try:
                link = finder.find_requirement(req, True)

                # If link is None, means installed version is most up-to-date
                if link is None:
                    continue
            except DistributionNotFound:
                continue
            except BestVersionAlreadyInstalled:
                remote_version = req.installed_version
            else:
                # It might be a good idea that link or finder had a public method
                # that returned version
                remote_version = finder._link_package_versions(link, req.name)[0]
                remote_version_raw = remote_version[2]
                remote_version_parsed = remote_version[0]
            yield dist, remote_version_raw, remote_version_parsed 
開發者ID:sugarguo,項目名稱:Flask_Blog,代碼行數:53,代碼來源:list.py


注:本文中的pip.util.get_installed_distributions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。