Skip to content

Commit 43d9538

Browse files
authored
Merge pull request #144 from diazona/unexpected-keyword-argument-py37/1/dev
Work around keyword arguments missing in older versions of Python
2 parents ec441be + 4e896f2 commit 43d9538

4 files changed

Lines changed: 14 additions & 4 deletions

File tree

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Misc
3333
----
3434

3535
- #105
36+
- #143
3637

3738

3839
0.1.0

changelog.d/+py312.misc.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

test_support/test_support/distribution.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,10 @@ def project(self) -> Project:
351351
self._project_path.mkdir(exist_ok=True)
352352
_logger.debug("Extracting to %s", self._project_path)
353353
with tarfile.open(sdist) as tf:
354-
tf.extractall(path=self._project_path, filter="data")
354+
try:
355+
tf.extractall(path=self._project_path, filter="data")
356+
except TypeError:
357+
tf.extractall(path=self._project_path) # for Python <3.8
355358
abs_project_root: pathlib.Path = self._project_path / self._distribution.project_root
356359
_logger.debug("Project root: %s", abs_project_root)
357360
if not (abs_project_root / "setup.py").exists() and not (abs_project_root / "setup.cfg").exists():

test_support/test_support/metadata.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Code for manipulating core metadata
33
"""
44

5-
import functools
65
import packaging.specifiers
76
import packaging.version
87
import re
@@ -11,6 +10,14 @@
1110
from test_support import importlib_metadata
1211
from typing import Callable, Dict, List, Optional, Tuple, Union
1312

13+
try:
14+
from functools import cache
15+
except ImportError:
16+
import functools
17+
18+
cache = functools.lru_cache(maxsize=128)
19+
20+
1421
try:
1522
from pyproject_metadata import License, Readme, RFC822Message, StandardMetadata
1623
except ImportError:
@@ -117,7 +124,7 @@ def get(name: str, default: Optional[List[str]] = None) -> List[str]:
117124

118125
metadata_version = packaging.version.Version(_metadata_version_raw[0])
119126

120-
@functools.cache
127+
@cache
121128
def is_at_least(required: str, *, v=metadata_version):
122129
return v >= packaging.version.Version(required)
123130

0 commit comments

Comments
 (0)