コード例 #1
0
ファイル: cleaner.py プロジェクト: jonolumb/ubuntu-tweak
    def update_model(self, ppas):
        model = self.get_model()
        model.clear()
        pkg_dict = {}
        for ppa in ppas:
            path = get_ppa_list_name(ppa)
            log.debug('Find the PPA path name: %s', path)
            if path:
                for line in open(path):
                    if line.startswith('Package:'):
                        pkg = line.split()[1].strip()
                        if pkg in pkg_dict:
                            # Join another ppa info to the pkg dict, so that
                            # later we can know if more than two ppa provide
                            # the pkg
                            pkg_dict[pkg].extend([ppa])
                        else:
                            pkg_dict[pkg] = [ppa]

        pkg_map = PACKAGE_WORKER.get_downgradeable_pkgs(pkg_dict)
        if pkg_map:
            log.debug("Start insert pkg_map to model: %s\n" % str(pkg_map))
            for pkg, (p_verion, s_verion) in pkg_map.items():
                model.append((pkg, p_verion, s_verion))
コード例 #2
0
ファイル: cleaner.py プロジェクト: daning/ubuntu-tweak
    def update_model(self, ppas):
        model = self.get_model()
        model.clear()
        pkg_dict = {}
        for ppa_url in ppas:
            path = ppa.get_list_name(ppa_url)
            log.debug('Find the PPA path name: %s', path)
            if path:
                for line in open(path):
                    if line.startswith('Package:'):
                        pkg = line.split()[1].strip()
                        if pkg in pkg_dict:
                            # Join another ppa info to the pkg dict, so that
                            # later we can know if more than two ppa provide
                            # the pkg
                            pkg_dict[pkg].extend([ppa_url])
                        else:
                            pkg_dict[pkg] = [ppa_url]

        pkg_map = PACKAGE_WORKER.get_downgradeable_pkgs(pkg_dict)
        if pkg_map:
            log.debug("Start insert pkg_map to model: %s\n" % str(pkg_map))
            for pkg, (p_verion, s_verion) in pkg_map.items():
                model.append((pkg, p_verion, s_verion))