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


Python apt_pkg.upstream_version方法代码示例

本文整理汇总了Python中apt.apt_pkg.upstream_version方法的典型用法代码示例。如果您正苦于以下问题:Python apt_pkg.upstream_version方法的具体用法?Python apt_pkg.upstream_version怎么用?Python apt_pkg.upstream_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apt.apt_pkg的用法示例。


在下文中一共展示了apt_pkg.upstream_version方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_upstream_version

# 需要导入模块: from apt import apt_pkg [as 别名]
# 或者: from apt.apt_pkg import upstream_version [as 别名]
def get_upstream_version(package):
    """Determine upstream version based on installed package

    @returns None (if not installed) or the upstream version
    """
    import apt_pkg
    cache = apt_cache()
    try:
        pkg = cache[package]
    except Exception:
        # the package is unknown to the current apt cache.
        return None

    if not pkg.current_ver:
        # package is known, but no version is currently installed.
        return None

    return apt_pkg.upstream_version(pkg.current_ver.ver_str) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:20,代码来源:ubuntu.py

示例2: get_upstream_version

# 需要导入模块: from apt import apt_pkg [as 别名]
# 或者: from apt.apt_pkg import upstream_version [as 别名]
def get_upstream_version(package):
    """Determine upstream version based on installed package

    @returns None (if not installed) or the upstream version
    """
    import apt_pkg
    cache = apt_cache()
    try:
        pkg = cache[package]
    except:
        # the package is unknown to the current apt cache.
        return None

    if not pkg.current_ver:
        # package is known, but no version is currently installed.
        return None

    return apt_pkg.upstream_version(pkg.current_ver.ver_str) 
开发者ID:konono,项目名称:equlipse,代码行数:20,代码来源:ubuntu.py

示例3: get_pkg_version

# 需要导入模块: from apt import apt_pkg [as 别名]
# 或者: from apt.apt_pkg import upstream_version [as 别名]
def get_pkg_version(name):
    from apt import apt_pkg
    pkg = apt_cache()[name]
    version = apt_pkg.upstream_version(pkg.current_ver.ver_str)
    return version 
开发者ID:openstack,项目名称:charm-ceph-radosgw,代码行数:7,代码来源:utils.py


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