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


Python apt_pkg.upstream_version方法代码示例

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


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

示例1: get_upstream_version

# 需要导入模块: import apt_pkg [as 别名]
# 或者: from 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

# 需要导入模块: import apt_pkg [as 别名]
# 或者: from 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_upstream_version

# 需要导入模块: import apt_pkg [as 别名]
# 或者: from 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 = fetch.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)


# TODO(AJK): Once this is in charms.reactive, drop it here and just reference
# the charms.reactive version.
# NOTE(AJK): that we are breaking the camalcase rule as this is acting as a
# context manager, which doesn't look like a 'class' 
开发者ID:openstack,项目名称:charms.openstack,代码行数:26,代码来源:utils.py

示例4: get_version

# 需要导入模块: import apt_pkg [as 别名]
# 或者: from apt_pkg import upstream_version [as 别名]
def get_version():
    """Derive Ceph release from an installed package."""
    import apt_pkg as apt

    cache = apt_cache()
    package = "ceph"
    try:
        pkg = cache[package]
    except:
        # the package is unknown to the current apt cache.
        e = 'Could not determine version of package with no installation ' \
            'candidate: %s' % package
        error_out(e)

    if not pkg.current_ver:
        # package is known, but no version is currently installed.
        e = 'Could not determine version of uninstalled package: %s' % package
        error_out(e)

    vers = apt.upstream_version(pkg.current_ver.ver_str)

    # x.y match only for 20XX.X
    # and ignore patch level for other packages
    match = re.match('^(\d+)\.(\d+)', vers)

    if match:
        vers = match.group(0)
    return float(vers) 
开发者ID:openstack,项目名称:charm-ceph-osd,代码行数:30,代码来源:utils.py


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