From 3a903ca6283408318e4bb2242c0372d0ea41cc20 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Thu, 9 Dec 2021 17:56:50 +0100 Subject: [PATCH] archive.py: support python 3.6 this is needed for the backports to bionic Signed-off-by: Mattia Rizzolo --- debian/changelog | 9 +++++++++ ubuntutools/archive.py | 11 ++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 61ef331..907c14a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 09 Dec 2021 17:54:27 +0100 + ubuntu-dev-tools (0.187) unstable; urgency=medium [ Paride Legovini ] diff --git a/ubuntutools/archive.py b/ubuntutools/archive.py index bd9cfcf..e04a4a8 100644 --- a/ubuntutools/archive.py +++ b/ubuntutools/archive.py @@ -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