Skip to content

Commit d996af5

Browse files
committed
fix: restore Python 3.7 support
Signed-off-by: Henry Schreiner <[email protected]>
1 parent e42f243 commit d996af5

18 files changed

+41
-28
lines changed

bin/update_pythons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
from rich.logging import RichHandler
2525
from rich.syntax import Syntax
2626

27+
from cibuildwheel._compat.typing import Final, Literal, TypedDict
2728
from cibuildwheel.extra import dump_python_configurations
28-
from cibuildwheel.typing import Final, Literal, TypedDict
2929

3030
log = logging.getLogger("cibw")
3131

bin/update_virtualenv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from rich.logging import RichHandler
2222
from rich.syntax import Syntax
2323

24-
from cibuildwheel.typing import Final
24+
from cibuildwheel._compat.typing import Final
2525

2626
log = logging.getLogger("cibw")
2727

cibuildwheel/__main__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@
1616
import cibuildwheel.macos
1717
import cibuildwheel.util
1818
import cibuildwheel.windows
19-
from cibuildwheel.architecture import Architecture, allowed_architectures_check
20-
from cibuildwheel.logger import log
21-
from cibuildwheel.options import CommandLineArguments, Options, compute_options
22-
from cibuildwheel.typing import (
19+
from cibuildwheel._compat.typing import (
2320
PLATFORMS,
2421
GenericPythonConfiguration,
2522
PlatformName,
23+
Protocol,
2624
assert_never,
2725
)
26+
from cibuildwheel.architecture import Architecture, allowed_architectures_check
27+
from cibuildwheel.logger import log
28+
from cibuildwheel.options import CommandLineArguments, Options, compute_options
2829
from cibuildwheel.util import (
2930
CIBW_CACHE_PATH,
3031
BuildSelector,
@@ -244,7 +245,7 @@ def _compute_platform(args: CommandLineArguments) -> PlatformName:
244245
return _compute_platform_ci()
245246

246247

247-
class PlatformModule(typing.Protocol):
248+
class PlatformModule(Protocol):
248249
# note that as per PEP544, the self argument is ignored when the protocol
249250
# is applied to a module
250251
def get_python_configurations(

cibuildwheel/_compat/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from __future__ import annotations
File renamed without changes.

cibuildwheel/_compat/functools.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from __future__ import annotations
2+
3+
import sys
4+
5+
if sys.version_info >= (3, 8):
6+
from functools import cached_property
7+
else:
8+
from ._functools_cached_property_38 import cached_property
9+
10+
__all__ = ("cached_property",)

cibuildwheel/typing.py renamed to cibuildwheel/_compat/typing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
if sys.version_info < (3, 8):
99
from typing_extensions import Final, Literal, OrderedDict, Protocol, TypedDict
1010
else:
11-
from typing import Final, Literal, OrderedDict, Protocol, TypedDict
11+
from typing import Final, Literal, OrderedDict, Protocol, TypedDict # noqa: TID251
1212

1313
if sys.version_info < (3, 11):
1414
from typing_extensions import NotRequired, assert_never
1515
else:
16-
from typing import NotRequired, assert_never
16+
from typing import NotRequired, assert_never # noqa: TID251
1717

1818
__all__ = (
1919
"Final",

cibuildwheel/architecture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from collections.abc import Set
88
from enum import Enum
99

10-
from .typing import Final, Literal, PlatformName, assert_never
10+
from ._compat.typing import Final, Literal, PlatformName, assert_never
1111

1212
PRETTY_NAMES: Final = {"linux": "Linux", "macos": "macOS", "windows": "Windows"}
1313

cibuildwheel/environment.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77
import bashlex
88
import bashlex.errors
99

10-
from cibuildwheel.typing import Protocol
11-
1210
from . import bashlex_eval
11+
from ._compat.typing import Protocol
1312

1413

1514
class EnvironmentParseError(Exception):

cibuildwheel/extra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from collections.abc import Mapping, Sequence
88
from io import StringIO
99

10-
from .typing import Protocol
10+
from ._compat.typing import Protocol
1111

1212
__all__ = ("Printable", "dump_python_configurations")
1313

0 commit comments

Comments
 (0)