Files
cibuildwheel/cibuildwheel/typing.py
T

45 lines
1008 B
Python
Raw Normal View History

from __future__ import annotations
import os
import subprocess
2021-01-09 15:40:40 -05:00
import sys
2022-10-03 23:23:11 -04:00
from typing import TYPE_CHECKING, Union
2021-01-09 15:40:40 -05:00
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
if sys.version_info < (3, 11):
2022-10-03 23:23:11 -04:00
from typing_extensions import NotRequired, assert_never
else:
2022-10-03 23:23:11 -04:00
from typing import NotRequired, assert_never
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",
"TypedDict",
2021-10-12 02:05:47 +01:00
"OrderedDict",
2021-04-30 17:56:34 -04:00
"assert_never",
"NotRequired",
2021-04-30 17:56:34 -04:00
)
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"}