Files
cibuildwheel/cibuildwheel/typing.py
T

44 lines
980 B
Python
Raw Normal View History

import os
import subprocess
2021-01-09 15:40:40 -05:00
import sys
from typing import TYPE_CHECKING, NoReturn, Set, Union
if sys.version_info < (3, 8):
2021-10-12 02:05:47 +01:00
from typing_extensions import Final, Literal, OrderedDict, Protocol, TypedDict
2021-01-09 15:40:40 -05:00
else:
2021-10-12 02:05:47 +01:00
from typing import Final, Literal, OrderedDict, Protocol, TypedDict
2021-04-30 17:56:34 -04:00
__all__ = (
"Final",
"Literal",
2021-09-19 00:19:28 -04:00
"PLATFORMS",
2021-04-30 17:56:34 -04:00
"PathOrStr",
"PlatformName",
2021-10-15 11:30:16 -04:00
"Protocol",
2021-04-30 17:56:34 -04:00
"PLATFORMS",
2021-09-19 00:19:28 -04:00
"PopenBytes",
"Protocol",
"Set",
"TypedDict",
2021-10-12 02:05:47 +01:00
"OrderedDict",
2021-09-19 00:19:28 -04:00
"Union",
2021-04-30 17:56:34 -04:00
"assert_never",
)
2021-01-09 15:40:40 -05:00
if TYPE_CHECKING:
PopenBytes = subprocess.Popen[bytes]
PathOrStr = Union[str, os.PathLike[str]]
else:
PopenBytes = subprocess.Popen
PathOrStr = Union[str, "os.PathLike[str]"]
2021-01-09 15:40:40 -05:00
PlatformName = Literal["linux", "macos", "windows"]
PLATFORMS: Final[Set[PlatformName]] = {"linux", "macos", "windows"}
def assert_never(value: NoReturn) -> NoReturn:
2021-05-03 11:45:43 -04:00
assert False, f"Unhandled value: {value} ({type(value).__name__})" # noqa: B011