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


Python AptWorker.get_cache方法代码示例

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


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

示例1: get_cruft

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import get_cache [as 别名]
    def get_cruft(self):
        cache = AptWorker.get_cache()
        count = 0
        size = 0
        if cache:
            for pkg in cache:
                if pkg.isAutoRemovable:
                    count += 1
                    size += pkg.installedSize
                    self.emit('find_object',
                              PackageObject(pkg.summary, pkg.name, pkg.installedSize))

        self.emit('scan_finished', True, count, size)
开发者ID:nayanapriyankara,项目名称:ubuntu-tweak,代码行数:15,代码来源:autoremoval_plugin.py

示例2: get_cruft

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import get_cache [as 别名]
    def get_cruft(self):
        cache = AptWorker.get_cache()
        count = 0
        size = 0
        if cache:
            for pkg in cache:
                if pkg.is_auto_removable and not pkg.name.startswith('linux'):
                    count += 1
                    size += pkg.installed.size
                    self.emit('find_object',
                              PackageObject(pkg.installed.summary, pkg.name, pkg.installed.size),
                              count)

        self.emit('scan_finished', True, count, size)
开发者ID:0xBADCA7,项目名称:ubuntu-tweak,代码行数:16,代码来源:autoremoval_plugin.py

示例3: get_cruft

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import get_cache [as 别名]
    def get_cruft(self):
        cache = AptWorker.get_cache()
        count = 0
        size = 0

        if cache:
            for pkg in cache:
                if pkg.isInstalled and self.is_old_kernel_package(pkg.name):
                    log.debug("Find old kernerl: %s" % pkg.name)
                    count += 1
                    size += pkg.installedSize
                    self.emit('find_object',
                              PackageObject(pkg.name, pkg.name, pkg.installedSize))

        self.emit('scan_finished', True, count, size)
开发者ID:nayanapriyankara,项目名称:ubuntu-tweak,代码行数:17,代码来源:oldkernel_plugin.py

示例4: get_cruft

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import get_cache [as 别名]
    def get_cruft(self):
        try:
            cache = AptWorker.get_cache()
            count = 0
            size = 0

            if cache:
                for pkg in cache:
                    if pkg.isInstalled and self.is_old_kernel_package(pkg.name):
                        log.debug("Find old kernerl: %s" % pkg.name)
                        count += 1
                        size += pkg.installedSize
                        self.emit('find_object',
                                  PackageObject(pkg.name, pkg.name, pkg.installedSize),
                                  count)

            self.emit('scan_finished', True, count, size)
        except Exception, e:
            error = get_traceback()
            log.error(error)
            self.emit('scan_error', error)
开发者ID:itachi46,项目名称:ubuntu-tweak,代码行数:23,代码来源:oldkernel_plugin.py

示例5: get_downgradeable_pkgs

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import get_cache [as 别名]
    def get_downgradeable_pkgs(self, ppa_dict):
        def is_system_origin(version, urls):
            origins = [ppa.get_ppa_origin_name(url) for url in urls]
            system_version = 0
            match = False

            for origin in version.origins:
                if origin.origin:
                    if origin.origin not in origins:
                        log.debug("The origin %s is not in %s, so end the loop" % (origin.origin, str(origins)))
                        match = True
                        break

            if match:
                system_version = version.version
                log.debug("Found match url, the system_version is %s, now iter to system version" % system_version)

            return system_version

        def is_full_match_ppa_origin(pkg, version, urls):
            origins = [ppa.get_ppa_origin_name(url) for url in urls]
            ppa_version = 0
            match = True

            if version == pkg.installed:
                for origin in version.origins:
                    if origin.origin:
                        if origin.origin not in origins:
                            log.debug("The origin %s is not in %s, so end the loop" % (origin.origin, str(origins)))
                            match = False
                            break

                if match:
                    ppa_version = version.version
                    log.debug("Found match url, the ppa_version is %s, now iter to system version" % ppa_version)

            return ppa_version

        log.debug("Check downgrade information")
        downgrade_dict = {}
        for pkg, urls in ppa_dict.items():
            log.debug("The package is: %s, PPA URL is: %s" % (pkg, str(urls)))

            if pkg not in AptWorker.get_cache():
                log.debug("    package isn't available, continue next...\n")
                continue

            pkg = AptWorker.get_cache()[pkg]
            if not pkg.isInstalled:
                log.debug("    package isn't installed, continue next...\n")
                continue
            versions = pkg.versions

            ppa_version = 0
            system_version = 0
            FLAG = 'PPA'
            try:
                for version in versions:
                    try:
                        #FIXME option to remove the package
                        log.debug("Version uri is %s" % version.uri)

                        # Switch FLAG
                        if FLAG == 'PPA':
                            ppa_version = is_full_match_ppa_origin(pkg, version, urls)
                            FLAG = 'SYSTEM'
                            if ppa_version == 0:
                                raise NoNeedDowngradeException
                        else:
                            system_version = is_system_origin(version, urls)

                        if ppa_version and system_version:
                            downgrade_dict[pkg.name] = (ppa_version, system_version)
                            break
                    except StopIteration:
                        pass
            except NoNeedDowngradeException:
                log.debug("Catch NoNeedDowngradeException, so pass this package: %s" % pkg)
                continue
            log.debug("\n")
        return downgrade_dict
开发者ID:0xBADCA7,项目名称:ubuntu-tweak,代码行数:83,代码来源:sourcecenter.py

示例6: __init__

# 需要导入模块: from ubuntutweak.utils.package import AptWorker [as 别名]
# 或者: from ubuntutweak.utils.package.AptWorker import get_cache [as 别名]
 def __init__(self, name):
     self.name = name
     self.pkg = AptWorker.get_cache()[name]
     self.desktopentry = DesktopEntry(self.DESKTOP_DIR + name + '.desktop')
开发者ID:c326277320,项目名称:ubuntu-tweak,代码行数:6,代码来源:appcenter.py


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