Ejemplo n.º 1
0
 def _add_category(self, pkg: SoftwarePackage, category: str):
     if isinstance(pkg.categories, tuple):
         pkg.categories = tuple((*pkg.categories, category))
     elif isinstance(pkg.categories, list):
         pkg.categories.append(category)
     elif isinstance(pkg.categories, set):
         pkg.categories.add(category)
Ejemplo n.º 2
0
    def ignore_update(self, pkg: SoftwarePackage):
        manager = self._get_manager_for(pkg)

        if manager:
            manager.ignore_update(pkg)

            if pkg.is_update_ignored():
                if pkg.categories is None:
                    pkg.categories = ['updates_ignored']
                elif 'updates_ignored' not in pkg.categories:
                    pkg.categories.append('updates_ignored')
Ejemplo n.º 3
0
    def revert_ignored_update(self, pkg: SoftwarePackage):
        manager = self._get_manager_for(pkg)

        if manager:
            manager.revert_ignored_update(pkg)

            if not pkg.is_update_ignored(
            ) and pkg.categories and 'updates_ignored' in pkg.categories:
                if isinstance(pkg.categories, tuple):
                    pkg.categories = tuple(c for c in pkg.categories
                                           if c != 'updates_ignored')
                else:
                    pkg.categories.remove('updates_ignored')