Skip to content

Commit ac54856

Browse files
committed
Remove py38 compat modules
1 parent a9f832b commit ac54856

13 files changed

+37
-111
lines changed

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _save_cwd():
4848

4949
@pytest.fixture
5050
def distutils_managed_tempdir(request):
51-
from distutils.tests.compat import py38 as os_helper
51+
from distutils.tests.compat import py39 as os_helper
5252

5353
self = request.instance
5454
self.tempdirs = []

distutils/compat/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
from .py38 import removeprefix
4-
53

64
def consolidate_linker_args(args: list[str]) -> list[str] | str:
75
"""
@@ -12,4 +10,4 @@ def consolidate_linker_args(args: list[str]) -> list[str] | str:
1210

1311
if not all(arg.startswith('-Wl,') for arg in args):
1412
return args
15-
return '-Wl,' + ','.join(removeprefix(arg, '-Wl,') for arg in args)
13+
return '-Wl,' + ','.join(arg.removeprefix('-Wl,') for arg in args)

distutils/compat/py38.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

distutils/tests/compat/py38.py

Lines changed: 0 additions & 50 deletions
This file was deleted.

distutils/tests/compat/py39.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
3+
if sys.version_info >= (3, 10):
4+
from test.support.import_helper import (
5+
CleanImport as CleanImport,
6+
DirsOnSysPath as DirsOnSysPath,
7+
)
8+
from test.support.os_helper import (
9+
EnvironmentVarGuard as EnvironmentVarGuard,
10+
rmtree as rmtree,
11+
skip_unless_symlink as skip_unless_symlink,
12+
unlink as unlink,
13+
)
14+
else:
15+
from test.support import (
16+
CleanImport as CleanImport,
17+
DirsOnSysPath as DirsOnSysPath,
18+
EnvironmentVarGuard as EnvironmentVarGuard,
19+
rmtree as rmtree,
20+
skip_unless_symlink as skip_unless_symlink,
21+
unlink as unlink,
22+
)

distutils/tests/test_bdist_rpm.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
from distutils.tests import support
99

1010
import pytest
11-
12-
from .compat.py38 import requires_zlib
11+
from test.support import requires_zlib
1312

1413
SETUP_PY = """\
1514
from distutils.core import setup

distutils/tests/test_build_ext.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,15 @@
1919
)
2020
from distutils.extension import Extension
2121
from distutils.tests import missing_compiler_executable
22-
from distutils.tests.support import (
23-
TempdirManager,
24-
copy_xxmodule_c,
25-
fixup_build_ext,
26-
)
22+
from distutils.tests.support import TempdirManager, copy_xxmodule_c, fixup_build_ext
2723
from io import StringIO
2824

2925
import jaraco.path
3026
import path
3127
import pytest
3228
from test import support
3329

34-
from .compat import py38 as import_helper
30+
from .compat import py39 as import_helper
3531

3632

3733
@pytest.fixture()

distutils/tests/test_extension.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
from distutils.extension import Extension, read_setup_file
77

88
import pytest
9-
10-
from .compat.py38 import check_warnings
9+
from test.support.warnings_helper import check_warnings
1110

1211

1312
class TestExtension:

distutils/tests/test_filelist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import jaraco.path
1111
import pytest
1212

13-
from .compat import py38 as os_helper
13+
from .compat import py39 as os_helper
1414

1515
MANIFEST_IN = """\
1616
include ok

distutils/tests/test_spawn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import pytest
1313
from test.support import unix_shell
1414

15-
from .compat import py38 as os_helper
15+
from .compat import py39 as os_helper
1616

1717

1818
class TestSpawn(support.TempdirManager):

distutils/tests/test_unixccompiler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import pytest
1313

1414
from . import support
15-
from .compat.py38 import EnvironmentVarGuard
15+
from .compat.py39 import EnvironmentVarGuard
1616

1717

1818
@pytest.fixture(autouse=True)

distutils/util.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from .spawn import spawn
2626

2727

28-
def get_host_platform():
28+
def get_host_platform() -> str:
2929
"""
3030
Return a string that identifies the current platform. Use this
3131
function to distinguish platform-specific build directories and
@@ -34,15 +34,7 @@ def get_host_platform():
3434

3535
# This function initially exposed platforms as defined in Python 3.9
3636
# even with older Python versions when distutils was split out.
37-
# Now it delegates to stdlib sysconfig, but maintains compatibility.
38-
39-
if sys.version_info < (3, 9):
40-
if os.name == "posix" and hasattr(os, 'uname'):
41-
osname, host, release, version, machine = os.uname()
42-
if osname[:3] == "aix":
43-
from .compat.py38 import aix_platform
44-
45-
return aix_platform(osname, version, release)
37+
# Now it delegates to stdlib sysconfig.
4638

4739
return sysconfig.get_platform()
4840

ruff.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ ignore = [
4747
"TRY400",
4848
]
4949

50+
[lint.isort]
51+
combine-as-imports = true
52+
split-on-trailing-comma = false
53+
5054
[format]
5155
# Enable preview to get hugged parenthesis unwrapping and other nice surprises
5256
# See https://github.com/jaraco/skeleton/pull/133#issuecomment-2239538373

0 commit comments

Comments
 (0)