Skip to content

Commit

Permalink
Accommodate functools without a cache decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
knoepfel committed May 17, 2024
1 parent 42f6b32 commit 8c3cb0e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/fnal-github-package/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import bisect
import functools

# Python versions older than 3.9 do not support functools.cache
cache_property = getattr(functools, "cache", functools.lru_cache)

RE_VERSION = re.compile(r"^v")
RE_UPS_STYLE = re.compile(r"^v(\d+)(_\d+)*.*")
RE_DOT_STYLE = re.compile(r"(\d+)(\.\d+)*.*")
Expand Down Expand Up @@ -119,7 +122,7 @@ def _url_for_tag(self, version_str):
return f"{self.git}/archive/refs/tags/{version_str}.tar.gz"

@property
@functools.cache
@cache_property
def _version_patterns(self):
self.version_patterns.sort(key=dotted_version_str)
result = []
Expand Down

0 comments on commit 8c3cb0e

Please sign in to comment.