fix: restore Python 3.7 support
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -24,8 +24,8 @@ from packaging.version import Version
|
||||
from rich.logging import RichHandler
|
||||
from rich.syntax import Syntax
|
||||
|
||||
from cibuildwheel._compat.typing import Final, Literal, TypedDict
|
||||
from cibuildwheel.extra import dump_python_configurations
|
||||
from cibuildwheel.typing import Final, Literal, TypedDict
|
||||
|
||||
log = logging.getLogger("cibw")
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ from packaging.version import InvalidVersion, Version
|
||||
from rich.logging import RichHandler
|
||||
from rich.syntax import Syntax
|
||||
|
||||
from cibuildwheel.typing import Final
|
||||
from cibuildwheel._compat.typing import Final
|
||||
|
||||
log = logging.getLogger("cibw")
|
||||
|
||||
|
||||
@@ -16,15 +16,16 @@ import cibuildwheel.linux
|
||||
import cibuildwheel.macos
|
||||
import cibuildwheel.util
|
||||
import cibuildwheel.windows
|
||||
from cibuildwheel.architecture import Architecture, allowed_architectures_check
|
||||
from cibuildwheel.logger import log
|
||||
from cibuildwheel.options import CommandLineArguments, Options, compute_options
|
||||
from cibuildwheel.typing import (
|
||||
from cibuildwheel._compat.typing import (
|
||||
PLATFORMS,
|
||||
GenericPythonConfiguration,
|
||||
PlatformName,
|
||||
Protocol,
|
||||
assert_never,
|
||||
)
|
||||
from cibuildwheel.architecture import Architecture, allowed_architectures_check
|
||||
from cibuildwheel.logger import log
|
||||
from cibuildwheel.options import CommandLineArguments, Options, compute_options
|
||||
from cibuildwheel.util import (
|
||||
CIBW_CACHE_PATH,
|
||||
BuildSelector,
|
||||
@@ -244,7 +245,7 @@ def _compute_platform(args: CommandLineArguments) -> PlatformName:
|
||||
return _compute_platform_ci()
|
||||
|
||||
|
||||
class PlatformModule(typing.Protocol):
|
||||
class PlatformModule(Protocol):
|
||||
# note that as per PEP544, the self argument is ignored when the protocol
|
||||
# is applied to a module
|
||||
def get_python_configurations(
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
from __future__ import annotations
|
||||
@@ -0,0 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from functools import cached_property
|
||||
else:
|
||||
from ._functools_cached_property_38 import cached_property
|
||||
|
||||
__all__ = ("cached_property",)
|
||||
@@ -8,12 +8,12 @@ from typing import TYPE_CHECKING, Union
|
||||
if sys.version_info < (3, 8):
|
||||
from typing_extensions import Final, Literal, OrderedDict, Protocol, TypedDict
|
||||
else:
|
||||
from typing import Final, Literal, OrderedDict, Protocol, TypedDict
|
||||
from typing import Final, Literal, OrderedDict, Protocol, TypedDict # noqa: TID251
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
from typing_extensions import NotRequired, assert_never
|
||||
else:
|
||||
from typing import NotRequired, assert_never
|
||||
from typing import NotRequired, assert_never # noqa: TID251
|
||||
|
||||
__all__ = (
|
||||
"Final",
|
||||
@@ -7,7 +7,7 @@ import sys
|
||||
from collections.abc import Set
|
||||
from enum import Enum
|
||||
|
||||
from .typing import Final, Literal, PlatformName, assert_never
|
||||
from ._compat.typing import Final, Literal, PlatformName, assert_never
|
||||
|
||||
PRETTY_NAMES: Final = {"linux": "Linux", "macos": "macOS", "windows": "Windows"}
|
||||
|
||||
|
||||
@@ -7,9 +7,8 @@ from typing import Any
|
||||
import bashlex
|
||||
import bashlex.errors
|
||||
|
||||
from cibuildwheel.typing import Protocol
|
||||
|
||||
from . import bashlex_eval
|
||||
from ._compat.typing import Protocol
|
||||
|
||||
|
||||
class EnvironmentParseError(Exception):
|
||||
|
||||
@@ -7,7 +7,7 @@ from __future__ import annotations
|
||||
from collections.abc import Mapping, Sequence
|
||||
from io import StringIO
|
||||
|
||||
from .typing import Protocol
|
||||
from ._compat.typing import Protocol
|
||||
|
||||
__all__ = ("Printable", "dump_python_configurations")
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@ from dataclasses import dataclass
|
||||
from pathlib import Path, PurePath, PurePosixPath
|
||||
from typing import Tuple
|
||||
|
||||
from ._compat.typing import OrderedDict, PathOrStr, assert_never
|
||||
from .architecture import Architecture
|
||||
from .logger import log
|
||||
from .oci_container import OCIContainer
|
||||
from .options import Options
|
||||
from .typing import OrderedDict, PathOrStr, assert_never
|
||||
from .util import (
|
||||
AlreadyBuiltWheelError,
|
||||
BuildSelector,
|
||||
|
||||
@@ -7,8 +7,8 @@ import sys
|
||||
import time
|
||||
from typing import IO, AnyStr
|
||||
|
||||
from cibuildwheel.typing import Final
|
||||
from cibuildwheel.util import CIProvider, detect_ci_provider
|
||||
from ._compat.typing import Final
|
||||
from .util import CIProvider, detect_ci_provider
|
||||
|
||||
DEFAULT_FOLD_PATTERN: Final = ("{name}", "")
|
||||
FOLD_PATTERNS: Final = {
|
||||
|
||||
@@ -16,11 +16,11 @@ from typing import Tuple
|
||||
|
||||
from filelock import FileLock
|
||||
|
||||
from ._compat.typing import Literal, PathOrStr, assert_never
|
||||
from .architecture import Architecture
|
||||
from .environment import ParsedEnvironment
|
||||
from .logger import log
|
||||
from .options import Options
|
||||
from .typing import Literal, PathOrStr, assert_never
|
||||
from .util import (
|
||||
CIBW_CACHE_PATH,
|
||||
AlreadyBuiltWheelError,
|
||||
|
||||
@@ -17,7 +17,7 @@ from typing import IO, Dict
|
||||
|
||||
from cibuildwheel.util import CIProvider, detect_ci_provider
|
||||
|
||||
from .typing import Literal, PathOrStr, PopenBytes
|
||||
from ._compat.typing import Literal, PathOrStr, PopenBytes
|
||||
|
||||
ContainerEngine = Literal["docker", "podman"]
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ else:
|
||||
|
||||
from packaging.specifiers import SpecifierSet
|
||||
|
||||
from ._compat.typing import PLATFORMS, Literal, NotRequired, PlatformName, TypedDict
|
||||
from .architecture import Architecture
|
||||
from .environment import EnvironmentParseError, ParsedEnvironment, parse_environment
|
||||
from .logger import log
|
||||
from .oci_container import ContainerEngine
|
||||
from .projectfiles import get_requires_python_str
|
||||
from .typing import PLATFORMS, Literal, NotRequired, PlatformName, TypedDict
|
||||
from .util import (
|
||||
MANYLINUX_ARCHS,
|
||||
MUSLLINUX_ARCHS,
|
||||
|
||||
@@ -36,7 +36,8 @@ from packaging.utils import parse_wheel_filename
|
||||
from packaging.version import Version
|
||||
from platformdirs import user_cache_path
|
||||
|
||||
from cibuildwheel.typing import Final, Literal, PathOrStr, PlatformName
|
||||
from ._compat.functools import cached_property
|
||||
from ._compat.typing import Final, Literal, PathOrStr, PlatformName
|
||||
|
||||
__all__ = [
|
||||
"resources_dir",
|
||||
@@ -661,12 +662,6 @@ def find_compatible_wheel(wheels: Sequence[T], identifier: str) -> T | None:
|
||||
return None
|
||||
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from functools import cached_property
|
||||
else:
|
||||
from .functools_cached_property_38 import cached_property
|
||||
|
||||
|
||||
# Can be replaced by contextlib.chdir in Python 3.11
|
||||
@contextlib.contextmanager
|
||||
def chdir(new_path: Path | str) -> Generator[None, None, None]:
|
||||
|
||||
@@ -16,11 +16,11 @@ from zipfile import ZipFile
|
||||
from filelock import FileLock
|
||||
from packaging.version import Version
|
||||
|
||||
from ._compat.typing import PathOrStr, assert_never
|
||||
from .architecture import Architecture
|
||||
from .environment import ParsedEnvironment
|
||||
from .logger import log
|
||||
from .options import Options
|
||||
from .typing import PathOrStr, assert_never
|
||||
from .util import (
|
||||
CIBW_CACHE_PATH,
|
||||
AlreadyBuiltWheelError,
|
||||
|
||||
+8
-1
@@ -149,7 +149,7 @@ extend-ignore = [
|
||||
"PT007", # False positive (fixed upstream)
|
||||
]
|
||||
target-version = "py37"
|
||||
typing-modules = ["cibuildwheel.typing"]
|
||||
typing-modules = ["cibuildwheel._compat.typing"]
|
||||
flake8-unused-arguments.ignore-variadic-names = true
|
||||
|
||||
[tool.ruff.flake8-tidy-imports.banned-api]
|
||||
@@ -158,6 +158,13 @@ flake8-unused-arguments.ignore-variadic-names = true
|
||||
"typing.Iterator".msg = "Use collections.abc.Iterator instead."
|
||||
"typing.Sequence".msg = "Use collections.abc.Sequence instead."
|
||||
"typing.Set".msg = "Use collections.abc.Set instead."
|
||||
"typing.Protocol".msg = "Use cibuildwheel._compat.typing.Protocol instead."
|
||||
"typing.Final".msg = "Use cibuildwheel._compat.typing.Final instead."
|
||||
"typing.Literal".msg = "Use cibuildwheel._compat.typing.Literal instead."
|
||||
"typing.OrderedDict".msg = "Use cibuildwheel._compat.typing.OrderedDict instead."
|
||||
"typing.TypedDict".msg = "Use cibuildwheel._compat.typing.TypedDict instead."
|
||||
"typing.NotRequired".msg = "Use cibuildwheel._compat.typing.NotRequired instead."
|
||||
"typing.assert_never".msg = "Use cibuildwhee._compat.typing.assert_never instead."
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
"unit_test/*" = ["PLC1901"]
|
||||
|
||||
Reference in New Issue
Block a user