Skip to content

Commit c375e92

Browse files
authored
Merge pull request #315 from Avasam/Remove-py38-compat-modules
Remove py38 compat modules
2 parents e6d3191 + fc15d45 commit c375e92

13 files changed

+51
-112
lines changed

conftest.py

+1-1
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

+1-3
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

-34
This file was deleted.

distutils/tests/compat/py38.py

-50
This file was deleted.

distutils/tests/compat/py39.py

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import sys
2+
3+
if sys.version_info >= (3, 10):
4+
from test.support.import_helper import (
5+
CleanImport as CleanImport,
6+
)
7+
from test.support.import_helper import (
8+
DirsOnSysPath as DirsOnSysPath,
9+
)
10+
from test.support.os_helper import (
11+
EnvironmentVarGuard as EnvironmentVarGuard,
12+
)
13+
from test.support.os_helper import (
14+
rmtree as rmtree,
15+
)
16+
from test.support.os_helper import (
17+
skip_unless_symlink as skip_unless_symlink,
18+
)
19+
from test.support.os_helper import (
20+
unlink as unlink,
21+
)
22+
else:
23+
from test.support import (
24+
CleanImport as CleanImport,
25+
)
26+
from test.support import (
27+
DirsOnSysPath as DirsOnSysPath,
28+
)
29+
from test.support import (
30+
EnvironmentVarGuard as EnvironmentVarGuard,
31+
)
32+
from test.support import (
33+
rmtree as rmtree,
34+
)
35+
from test.support import (
36+
skip_unless_symlink as skip_unless_symlink,
37+
)
38+
from test.support import (
39+
unlink as unlink,
40+
)

distutils/tests/test_bdist_rpm.py

+1-2
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

+2-6
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

+1-2
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

+1-1
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

+1-1
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

+1-1
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

+2-10
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

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ extend-select = [
2121
ignore = [
2222
# TODO: Fix these new violations in Ruff 0.8.0
2323
"UP031",
24-
"UP036",
2524

2625
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
2726
"W191",

0 commit comments

Comments
 (0)