当前位置: 首页>>代码示例>>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;未经允许,请勿转载。