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.util
|
||||
import cibuildwheel.windows
|
||||
from cibuildwheel._compat.typing import (
|
||||
PLATFORMS,
|
||||
GenericPythonConfiguration,
|
||||
PlatformName,
|
||||
Protocol,
|
||||
assert_never,
|
||||
)
|
||||
from cibuildwheel._compat.typing import 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.typing import PLATFORMS, GenericPythonConfiguration, PlatformName
|
||||
from cibuildwheel.util import (
|
||||
CIBW_CACHE_PATH,
|
||||
BuildSelector,
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from typing import TYPE_CHECKING, Union
|
||||
|
||||
if sys.version_info < (3, 8):
|
||||
from typing_extensions import Final, Literal, OrderedDict, Protocol, TypedDict
|
||||
@@ -18,33 +15,10 @@ else:
|
||||
__all__ = (
|
||||
"Final",
|
||||
"Literal",
|
||||
"PLATFORMS",
|
||||
"PathOrStr",
|
||||
"PlatformName",
|
||||
"Protocol",
|
||||
"PLATFORMS",
|
||||
"PopenBytes",
|
||||
"Protocol",
|
||||
"TypedDict",
|
||||
"OrderedDict",
|
||||
"assert_never",
|
||||
"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 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"}
|
||||
|
||||
|
||||
@@ -8,11 +8,12 @@ from dataclasses import dataclass
|
||||
from pathlib import Path, PurePath, PurePosixPath
|
||||
from typing import Tuple
|
||||
|
||||
from ._compat.typing import OrderedDict, PathOrStr, assert_never
|
||||
from ._compat.typing import OrderedDict, assert_never
|
||||
from .architecture import Architecture
|
||||
from .logger import log
|
||||
from .oci_container import OCIContainer
|
||||
from .options import Options
|
||||
from .typing import PathOrStr
|
||||
from .util import (
|
||||
AlreadyBuiltWheelError,
|
||||
BuildSelector,
|
||||
|
||||
@@ -16,11 +16,12 @@ from typing import Tuple
|
||||
|
||||
from filelock import FileLock
|
||||
|
||||
from ._compat.typing import Literal, PathOrStr, assert_never
|
||||
from ._compat.typing import Literal, assert_never
|
||||
from .architecture import Architecture
|
||||
from .environment import ParsedEnvironment
|
||||
from .logger import log
|
||||
from .options import Options
|
||||
from .typing import PathOrStr
|
||||
from .util import (
|
||||
CIBW_CACHE_PATH,
|
||||
AlreadyBuiltWheelError,
|
||||
|
||||
@@ -15,9 +15,9 @@ from pathlib import Path, PurePath, PurePosixPath
|
||||
from types import TracebackType
|
||||
from typing import IO, Dict
|
||||
|
||||
from cibuildwheel.util import CIProvider, detect_ci_provider
|
||||
|
||||
from ._compat.typing import Literal, PathOrStr, PopenBytes
|
||||
from ._compat.typing import Literal
|
||||
from .typing import PathOrStr, PopenBytes
|
||||
from .util import CIProvider, detect_ci_provider
|
||||
|
||||
ContainerEngine = Literal["docker", "podman"]
|
||||
|
||||
|
||||
@@ -22,12 +22,13 @@ else:
|
||||
|
||||
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 .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, PlatformName
|
||||
from .util import (
|
||||
MANYLINUX_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 ._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__ = [
|
||||
"resources_dir",
|
||||
|
||||
@@ -16,11 +16,12 @@ from zipfile import ZipFile
|
||||
from filelock import FileLock
|
||||
from packaging.version import Version
|
||||
|
||||
from ._compat.typing import PathOrStr, assert_never
|
||||
from ._compat.typing import assert_never
|
||||
from .architecture import Architecture
|
||||
from .environment import ParsedEnvironment
|
||||
from .logger import log
|
||||
from .options import Options
|
||||
from .typing import PathOrStr
|
||||
from .util import (
|
||||
CIBW_CACHE_PATH,
|
||||
AlreadyBuiltWheelError,
|
||||
|
||||
Reference in New Issue
Block a user