Skip to content

Commit

Permalink
Remove py38 compat modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Dec 26, 2024
1 parent a9f832b commit 7ac8298
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 110 deletions.
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _save_cwd():

@pytest.fixture
def distutils_managed_tempdir(request):
from distutils.tests.compat import py38 as os_helper
from test.support import os_helper

self = request.instance
self.tempdirs = []
Expand Down
4 changes: 1 addition & 3 deletions distutils/compat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from __future__ import annotations

from .py38 import removeprefix


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

if not all(arg.startswith('-Wl,') for arg in args):
return args
return '-Wl,' + ','.join(removeprefix(arg, '-Wl,') for arg in args)
return '-Wl,' + ','.join(arg.removeprefix('-Wl,') for arg in args)
34 changes: 0 additions & 34 deletions distutils/compat/py38.py

This file was deleted.

Empty file removed distutils/tests/compat/__init__.py
Empty file.
50 changes: 0 additions & 50 deletions distutils/tests/compat/py38.py

This file was deleted.

3 changes: 1 addition & 2 deletions distutils/tests/test_bdist_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
from distutils.tests import support

import pytest

from .compat.py38 import requires_zlib
from test.support import requires_zlib

SETUP_PY = """\
from distutils.core import setup
Expand Down
3 changes: 1 addition & 2 deletions distutils/tests/test_build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
import path
import pytest
from test import support

from .compat import py38 as import_helper
from test.support import import_helper


@pytest.fixture()
Expand Down
3 changes: 1 addition & 2 deletions distutils/tests/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from distutils.extension import Extension, read_setup_file

import pytest

from .compat.py38 import check_warnings
from test.support.warnings_helper import check_warnings


class TestExtension:
Expand Down
3 changes: 1 addition & 2 deletions distutils/tests/test_filelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

import jaraco.path
import pytest

from .compat import py38 as os_helper
from test.support import os_helper

MANIFEST_IN = """\
include ok
Expand Down
4 changes: 1 addition & 3 deletions distutils/tests/test_spawn.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

import path
import pytest
from test.support import unix_shell

from .compat import py38 as os_helper
from test.support import os_helper, unix_shell


class TestSpawn(support.TempdirManager):
Expand Down
2 changes: 1 addition & 1 deletion distutils/tests/test_unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from distutils.util import _clear_cached_macosx_ver

import pytest
from test.support.os_helper import EnvironmentVarGuard

from . import support
from .compat.py38 import EnvironmentVarGuard


@pytest.fixture(autouse=True)
Expand Down
12 changes: 2 additions & 10 deletions distutils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .spawn import spawn


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

# This function initially exposed platforms as defined in Python 3.9
# even with older Python versions when distutils was split out.
# Now it delegates to stdlib sysconfig, but maintains compatibility.

if sys.version_info < (3, 9):
if os.name == "posix" and hasattr(os, 'uname'):
osname, host, release, version, machine = os.uname()
if osname[:3] == "aix":
from .compat.py38 import aix_platform

return aix_platform(osname, version, release)
# Now it delegates to stdlib sysconfig.

return sysconfig.get_platform()

Expand Down

0 comments on commit 7ac8298

Please sign in to comment.