Skip to content

Commit ad2cef1

Browse files
committed
Use tarfile filter in Python 3.12+
Closes #48.
1 parent 5bb7297 commit ad2cef1

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ v2.3.0 (in development)
33
- Raise a `ConfigError` if the selected `tool.versioningit.format` field is not
44
a string
55
- Update tests for pydantic 2.0
6+
- Update tests for Python 3.12
7+
- Support Python 3.12
68

79
v2.2.0 (2023-02-11)
810
-------------------

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ v2.3.0 (in development)
88
- Raise a `ConfigError` if the selected ``tool.versioningit.format`` field is
99
not a string
1010
- Update tests for pydantic 2.0
11+
- Update tests for Python 3.12
12+
- Support Python 3.12
1113

1214

1315
v2.2.0 (2023-02-11)

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ classifiers =
2727
Programming Language :: Python :: 3.9
2828
Programming Language :: Python :: 3.10
2929
Programming Language :: Python :: 3.11
30+
Programming Language :: Python :: 3.12
3031
Programming Language :: Python :: Implementation :: CPython
3132
Programming Language :: Python :: Implementation :: PyPy
3233
License :: OSI Approved :: MIT License

test/test_end2end.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,16 @@ def test_build_from_sdist(tmp_path: Path) -> None:
277277
# This test is used to check that building from an sdist succeeds even when
278278
# a VCS is not installed, though it passes when one is installed as well.
279279
srcdir = tmp_path / "src"
280-
shutil.unpack_archive(
281-
str(DATA_DIR / "mypackage-0.1.0.post4+g56ed573.tar.gz"), str(srcdir)
282-
)
280+
if sys.version_info >= (3, 12):
281+
shutil.unpack_archive(
282+
str(DATA_DIR / "mypackage-0.1.0.post4+g56ed573.tar.gz"),
283+
str(srcdir),
284+
filter="data",
285+
)
286+
else:
287+
shutil.unpack_archive(
288+
str(DATA_DIR / "mypackage-0.1.0.post4+g56ed573.tar.gz"), str(srcdir)
289+
)
283290
(srcsubdir,) = srcdir.iterdir()
284291
init_path = Path("src", "mypackage", "__init__.py")
285292
init_src = (srcsubdir / init_path).read_text()
@@ -406,7 +413,10 @@ def get_repo_status(repodir: Path) -> str:
406413

407414
def unpack_sdist(dist_dir: Path, tmp_path: Path) -> Path:
408415
(sdist,) = dist_dir.glob("*.tar.gz")
409-
shutil.unpack_archive(str(sdist), str(tmp_path / "sdist"))
416+
if sys.version_info >= (3, 12):
417+
shutil.unpack_archive(str(sdist), str(tmp_path / "sdist"), filter="data")
418+
else:
419+
shutil.unpack_archive(str(sdist), str(tmp_path / "sdist"))
410420
(sdist_src,) = (tmp_path / "sdist").iterdir()
411421
return sdist_src
412422

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = lint,typing,py37,py38,py39,py310,py311,pypy3,py-oldsetup
2+
envlist = lint,typing,py37,py38,py39,py310,py311,py312,pypy3,py-oldsetup
33
skip_missing_interpreters = True
44
isolated_build = True
55
minversion = 3.3.0

0 commit comments

Comments
 (0)