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


Python packaging.get_installer方法代碼示例

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


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

示例1: output_legacy

# 需要導入模塊: from pip._internal.utils import packaging [as 別名]
# 或者: from pip._internal.utils.packaging import get_installer [as 別名]
def output_legacy(self, dist, options):
        if options.verbose >= 1:
            return '%s (%s, %s, %s)' % (
                dist.project_name,
                dist.version,
                dist.location,
                get_installer(dist),
            )
        elif dist_is_editable(dist):
            return '%s (%s, %s)' % (
                dist.project_name,
                dist.version,
                dist.location,
            )
        else:
            return '%s (%s)' % (dist.project_name, dist.version) 
開發者ID:HaoZhang95,項目名稱:Python24,代碼行數:18,代碼來源:list.py

示例2: format_for_columns

# 需要導入模塊: from pip._internal.utils import packaging [as 別名]
# 或者: from pip._internal.utils.packaging import get_installer [as 別名]
def format_for_columns(pkgs, options):
    """
    Convert the package data into something usable
    by output_package_listing_columns.
    """
    running_outdated = options.outdated
    # Adjust the header for the `pip list --outdated` case.
    if running_outdated:
        header = ["Package", "Version", "Latest", "Type"]
    else:
        header = ["Package", "Version"]

    data = []
    if options.verbose >= 1 or any(dist_is_editable(x) for x in pkgs):
        header.append("Location")
    if options.verbose >= 1:
        header.append("Installer")

    for proj in pkgs:
        # if we're working on the 'outdated' list, separate out the
        # latest_version and type
        row = [proj.project_name, proj.version]

        if running_outdated:
            row.append(proj.latest_version)
            row.append(proj.latest_filetype)

        if options.verbose >= 1 or dist_is_editable(proj):
            row.append(proj.location)
        if options.verbose >= 1:
            row.append(get_installer(proj))

        data.append(row)

    return data, header 
開發者ID:HaoZhang95,項目名稱:Python24,代碼行數:37,代碼來源:list.py

示例3: format_for_json

# 需要導入模塊: from pip._internal.utils import packaging [as 別名]
# 或者: from pip._internal.utils.packaging import get_installer [as 別名]
def format_for_json(packages, options):
    data = []
    for dist in packages:
        info = {
            'name': dist.project_name,
            'version': six.text_type(dist.version),
        }
        if options.verbose >= 1:
            info['location'] = dist.location
            info['installer'] = get_installer(dist)
        if options.outdated:
            info['latest_version'] = six.text_type(dist.latest_version)
            info['latest_filetype'] = dist.latest_filetype
        data.append(info)
    return json.dumps(data) 
開發者ID:HaoZhang95,項目名稱:Python24,代碼行數:17,代碼來源:list.py

示例4: was_installed_by_pip

# 需要導入模塊: from pip._internal.utils import packaging [as 別名]
# 或者: from pip._internal.utils.packaging import get_installer [as 別名]
def was_installed_by_pip(pkg):
    # type: (str) -> bool
    """Checks whether pkg was installed by pip

    This is used not to display the upgrade message when pip is in fact
    installed by system package manager, such as dnf on Fedora.
    """
    try:
        dist = pkg_resources.get_distribution(pkg)
        return "pip" == get_installer(dist)
    except pkg_resources.DistributionNotFound:
        return False 
開發者ID:pantsbuild,項目名稱:pex,代碼行數:14,代碼來源:self_outdated_check.py


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