~robert-ancell/update-manager/ua

« back to all changes in this revision

Viewing changes to UpdateManager/Core/UpdateList.py

  • Committer: Robert Ancell
  • Date: 2022-06-29 10:30:29 UTC
  • Revision ID: robert.ancell@canonical.com-20220629103029-o1fbqmdgx5hind55
Make special pkg classes for pro packages

Show diffs side-by-side

added added

removed removed

Lines of Context:
480
480
        ubuntu_pro_group = UpdateGroup(None, "Ubuntu Pro (enable in Settings…)", None, False, False)
481
481
        ubuntu_pro_pkg_names = ['wireshark', 'google-chrome-stable', 'gnome-software']
482
482
 
 
483
        class FakeUbuntuProPackageCandidate:
 
484
            def __init__ (self, source_name, version, size):
 
485
                self.source_name = source_name
 
486
                self.summary = source_name
 
487
                self.description = source_name
 
488
                self.version = version
 
489
                self.size = size
 
490
                self.downloadable = False
 
491
                self.record = {}
 
492
        class FakeUbuntuProPackage:
 
493
            def __init__ (self, name, version, size):
 
494
                self.name = name
 
495
                self.candidate = FakeUbuntuProPackageCandidate(name, version, size)
 
496
                self.marked_install = False
 
497
                self.marked_upgrade = False
 
498
 
 
499
            def mark_install(self):
 
500
                pass
 
501
 
 
502
            def mark_delete(self):
 
503
                pass
 
504
        for name in ubuntu_pro_pkg_names:
 
505
            ubuntu_pro_group.add(FakeUbuntuProPackage(name, '1.0', 1024))
 
506
 
483
507
        # Find all upgradable packages
484
508
        for pkg in cache:
485
 
            if pkg.name in ubuntu_pro_pkg_names:
486
 
                ubuntu_pro_group.add(pkg)
487
 
 
488
509
            if pkg.is_upgradable or pkg.marked_install:
489
510
                if getattr(pkg.candidate, "origins", None) is None:
490
511
                    # can happen for e.g. locked packages