refactor: restore typing for non-backports
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
@@ -16,16 +16,11 @@ import cibuildwheel.linux
|
|||||||
import cibuildwheel.macos
|
import cibuildwheel.macos
|
||||||
import cibuildwheel.util
|
import cibuildwheel.util
|
||||||
import cibuildwheel.windows
|
import cibuildwheel.windows
|
||||||
from cibuildwheel._compat.typing import (
|
from cibuildwheel._compat.typing import Protocol, assert_never
|
||||||
PLATFORMS,
|
|
||||||
GenericPythonConfiguration,
|
|
||||||
PlatformName,
|
|
||||||
Protocol,
|
|
||||||
assert_never,
|
|
||||||
)
|
|
||||||
from cibuildwheel.architecture import Architecture, allowed_architectures_check
|
from cibuildwheel.architecture import Architecture, allowed_architectures_check
|
||||||
from cibuildwheel.logger import log
|
from cibuildwheel.logger import log
|
||||||
from cibuildwheel.options import CommandLineArguments, Options, compute_options
|
from cibuildwheel.options import CommandLineArguments, Options, compute_options
|
||||||
|
from cibuildwheel.typing import PLATFORMS, GenericPythonConfiguration, PlatformName
|
||||||
from cibuildwheel.util import (
|
from cibuildwheel.util import (
|
||||||
CIBW_CACHE_PATH,
|
CIBW_CACHE_PATH,
|
||||||
BuildSelector,
|
BuildSelector,
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
import sys
|
||||||
from typing import TYPE_CHECKING, Union
|
|
||||||
|
|
||||||
if sys.version_info < (3, 8):
|
if sys.version_info < (3, 8):
|
||||||
from typing_extensions import Final, Literal, OrderedDict, Protocol, TypedDict
|
from typing_extensions import Final, Literal, OrderedDict, Protocol, TypedDict
|
||||||
@@ -18,33 +15,10 @@ else:
|
|||||||
__all__ = (
|
__all__ = (
|
||||||
"Final",
|
"Final",
|
||||||
"Literal",
|
"Literal",
|
||||||
"PLATFORMS",
|
|
||||||
"PathOrStr",
|
|
||||||
"PlatformName",
|
|
||||||
"Protocol",
|
"Protocol",
|
||||||
"PLATFORMS",
|
|
||||||
"PopenBytes",
|
|
||||||
"Protocol",
|
"Protocol",
|
||||||
"TypedDict",
|
"TypedDict",
|
||||||
"OrderedDict",
|
"OrderedDict",
|
||||||
"assert_never",
|
"assert_never",
|
||||||
"NotRequired",
|
"NotRequired",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
PopenBytes = subprocess.Popen[bytes]
|
|
||||||
PathOrStr = Union[str, os.PathLike[str]]
|
|
||||||
else:
|
|
||||||
PopenBytes = subprocess.Popen
|
|
||||||
PathOrStr = Union[str, "os.PathLike[str]"]
|
|
||||||
|
|
||||||
|
|
||||||
PlatformName = Literal["linux", "macos", "windows"]
|
|
||||||
PLATFORMS: Final[set[PlatformName]] = {"linux", "macos", "windows"}
|
|
||||||
|
|
||||||
|
|
||||||
class GenericPythonConfiguration(Protocol):
|
|
||||||
@property
|
|
||||||
def identifier(self) -> str:
|
|
||||||
...
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import sys
|
|||||||
from collections.abc import Set
|
from collections.abc import Set
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
from ._compat.typing import Final, Literal, PlatformName, assert_never
|
from ._compat.typing import Final, Literal, assert_never
|
||||||
|
from .typing import PlatformName
|
||||||
|
|
||||||
PRETTY_NAMES: Final = {"linux": "Linux", "macos": "macOS", "windows": "Windows"}
|
PRETTY_NAMES: Final = {"linux": "Linux", "macos": "macOS", "windows": "Windows"}
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,12 @@ from dataclasses import dataclass
|
|||||||
from pathlib import Path, PurePath, PurePosixPath
|
from pathlib import Path, PurePath, PurePosixPath
|
||||||
from typing import Tuple
|
from typing import Tuple
|
||||||
|
|
||||||
from ._compat.typing import OrderedDict, PathOrStr, assert_never
|
from ._compat.typing import OrderedDict, assert_never
|
||||||
from .architecture import Architecture
|
from .architecture import Architecture
|
||||||
from .logger import log
|
from .logger import log
|
||||||
from .oci_container import OCIContainer
|
from .oci_container import OCIContainer
|
||||||
from .options import Options
|
from .options import Options
|
||||||
|
from .typing import PathOrStr
|
||||||
from .util import (
|
from .util import (
|
||||||
AlreadyBuiltWheelError,
|
AlreadyBuiltWheelError,
|
||||||
BuildSelector,
|
BuildSelector,
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ from typing import Tuple
|
|||||||
|
|
||||||
from filelock import FileLock
|
from filelock import FileLock
|
||||||
|
|
||||||
from ._compat.typing import Literal, PathOrStr, assert_never
|
from ._compat.typing import Literal, assert_never
|
||||||
from .architecture import Architecture
|
from .architecture import Architecture
|
||||||
from .environment import ParsedEnvironment
|
from .environment import ParsedEnvironment
|
||||||
from .logger import log
|
from .logger import log
|
||||||
from .options import Options
|
from .options import Options
|
||||||
|
from .typing import PathOrStr
|
||||||
from .util import (
|
from .util import (
|
||||||
CIBW_CACHE_PATH,
|
CIBW_CACHE_PATH,
|
||||||
AlreadyBuiltWheelError,
|
AlreadyBuiltWheelError,
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ from pathlib import Path, PurePath, PurePosixPath
|
|||||||
from types import TracebackType
|
from types import TracebackType
|
||||||
from typing import IO, Dict
|
from typing import IO, Dict
|
||||||
|
|
||||||
from cibuildwheel.util import CIProvider, detect_ci_provider
|
from ._compat.typing import Literal
|
||||||
|
from .typing import PathOrStr, PopenBytes
|
||||||
from ._compat.typing import Literal, PathOrStr, PopenBytes
|
from .util import CIProvider, detect_ci_provider
|
||||||
|
|
||||||
ContainerEngine = Literal["docker", "podman"]
|
ContainerEngine = Literal["docker", "podman"]
|
||||||
|
|
||||||
|
|||||||
@@ -22,12 +22,13 @@ else:
|
|||||||
|
|
||||||
from packaging.specifiers import SpecifierSet
|
from packaging.specifiers import SpecifierSet
|
||||||
|
|
||||||
from ._compat.typing import PLATFORMS, Literal, NotRequired, PlatformName, TypedDict
|
from ._compat.typing import Literal, NotRequired, TypedDict
|
||||||
from .architecture import Architecture
|
from .architecture import Architecture
|
||||||
from .environment import EnvironmentParseError, ParsedEnvironment, parse_environment
|
from .environment import EnvironmentParseError, ParsedEnvironment, parse_environment
|
||||||
from .logger import log
|
from .logger import log
|
||||||
from .oci_container import ContainerEngine
|
from .oci_container import ContainerEngine
|
||||||
from .projectfiles import get_requires_python_str
|
from .projectfiles import get_requires_python_str
|
||||||
|
from .typing import PLATFORMS, PlatformName
|
||||||
from .util import (
|
from .util import (
|
||||||
MANYLINUX_ARCHS,
|
MANYLINUX_ARCHS,
|
||||||
MUSLLINUX_ARCHS,
|
MUSLLINUX_ARCHS,
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import typing
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
|
from ._compat.typing import Final, Literal, Protocol
|
||||||
|
|
||||||
|
__all__ = (
|
||||||
|
"PLATFORMS",
|
||||||
|
"PathOrStr",
|
||||||
|
"PlatformName",
|
||||||
|
"PLATFORMS",
|
||||||
|
"PopenBytes",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if typing.TYPE_CHECKING:
|
||||||
|
PopenBytes = subprocess.Popen[bytes]
|
||||||
|
PathOrStr = Union[str, os.PathLike[str]]
|
||||||
|
else:
|
||||||
|
PopenBytes = subprocess.Popen
|
||||||
|
PathOrStr = Union[str, "os.PathLike[str]"]
|
||||||
|
|
||||||
|
|
||||||
|
PlatformName = Literal["linux", "macos", "windows"]
|
||||||
|
PLATFORMS: Final[set[PlatformName]] = {"linux", "macos", "windows"}
|
||||||
|
|
||||||
|
|
||||||
|
class GenericPythonConfiguration(Protocol):
|
||||||
|
@property
|
||||||
|
def identifier(self) -> str:
|
||||||
|
...
|
||||||
@@ -37,7 +37,8 @@ from packaging.version import Version
|
|||||||
from platformdirs import user_cache_path
|
from platformdirs import user_cache_path
|
||||||
|
|
||||||
from ._compat.functools import cached_property
|
from ._compat.functools import cached_property
|
||||||
from ._compat.typing import Final, Literal, PathOrStr, PlatformName
|
from ._compat.typing import Final, Literal
|
||||||
|
from .typing import PathOrStr, PlatformName
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"resources_dir",
|
"resources_dir",
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ from zipfile import ZipFile
|
|||||||
from filelock import FileLock
|
from filelock import FileLock
|
||||||
from packaging.version import Version
|
from packaging.version import Version
|
||||||
|
|
||||||
from ._compat.typing import PathOrStr, assert_never
|
from ._compat.typing import assert_never
|
||||||
from .architecture import Architecture
|
from .architecture import Architecture
|
||||||
from .environment import ParsedEnvironment
|
from .environment import ParsedEnvironment
|
||||||
from .logger import log
|
from .logger import log
|
||||||
from .options import Options
|
from .options import Options
|
||||||
|
from .typing import PathOrStr
|
||||||
from .util import (
|
from .util import (
|
||||||
CIBW_CACHE_PATH,
|
CIBW_CACHE_PATH,
|
||||||
AlreadyBuiltWheelError,
|
AlreadyBuiltWheelError,
|
||||||
|
|||||||
Reference in New Issue
Block a user