archive.py: support python 3.6

this is needed for the backports to bionic

Signed-off-by: Mattia Rizzolo <mattia@debian.org>
This commit is contained in:
Mattia Rizzolo 2021-12-09 17:56:50 +01:00
parent c7058559c5
commit 3a903ca628
No known key found for this signature in database
GPG Key ID: 0816B9E18C762BAD
2 changed files with 15 additions and 5 deletions

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
ubuntu-dev-tools (0.188) UNRELEASED; urgency=medium
[ Mattia Rizzolo ]
* archive.py:
+ Support Python 3.6 by calling functools.lru_cache() as a function, and
avoid using @functools.cached_property (both new in Python 3.8).
-- Mattia Rizzolo <mattia@debian.org> Thu, 09 Dec 2021 17:54:27 +0100
ubuntu-dev-tools (0.187) unstable; urgency=medium
[ Paride Legovini ]

View File

@ -649,14 +649,15 @@ class PersonalPackageArchiveSourcePackage(UbuntuSourcePackage):
self._ppaname = ppa[1]
self.masters = []
@functools.cached_property
@property
@functools.lru_cache(maxsize=None)
def team(self):
try:
return PersonTeam.fetch(self._teamname)
except KeyError:
raise ValueError(f"No user/team '{self._teamname}' found on Launchpad")
@functools.lru_cache
@functools.lru_cache()
def getArchive(self):
ppa = self.team.getPPAByName(self._ppaname)
Logger.debug(f"Using PPA '{ppa.web_link}'")
@ -727,7 +728,7 @@ class UbuntuCloudArchiveSourcePackage(PersonalPackageArchiveSourcePackage):
return super(UbuntuCloudArchiveSourcePackage, self).pull_binaries(arch, name, ext)
@classmethod
@functools.lru_cache
@functools.lru_cache()
def getUbuntuCloudArchiveProject(cls):
return Project(cls.PROJECT)
@ -754,12 +755,12 @@ class UbuntuCloudArchiveSourcePackage(PersonalPackageArchiveSourcePackage):
return cls.getUbuntuCloudArchiveReleaseNames()[0]
@classmethod
@functools.lru_cache
@functools.lru_cache()
def getUbuntuCloudArchiveTeam(cls):
return PersonTeam.fetch(cls.TEAM)
@classmethod
@functools.lru_cache
@functools.lru_cache()
def getUbuntuCloudArchivePPAs(cls, release=None, pocket=None):
""" Get sorted list of UCA ppa Archive objects