|
1 | 1 | from _typeshed import Incomplete, StrPath |
2 | 2 | from abc import abstractmethod |
3 | 3 | from collections.abc import Iterable, Mapping, Sequence |
4 | | -from typing import Any, Literal, TypeVar, overload |
| 4 | +from typing import Any, Literal, TypedDict, TypeVar, overload, type_check_only |
| 5 | +from typing_extensions import NotRequired |
5 | 6 |
|
6 | 7 | from ._distutils.cmd import Command as _Command |
7 | 8 | from .command.alias import alias |
@@ -45,6 +46,14 @@ __all__ = [ |
45 | 46 |
|
46 | 47 | __version__: str |
47 | 48 |
|
| 49 | +@type_check_only |
| 50 | +class _BuildInfo(TypedDict): |
| 51 | + sources: list[str] | tuple[str, ...] |
| 52 | + obj_deps: NotRequired[dict[str, list[str] | tuple[str, ...]]] |
| 53 | + macros: NotRequired[list[tuple[str] | tuple[str, str | None]]] |
| 54 | + include_dirs: NotRequired[list[str]] |
| 55 | + cflags: NotRequired[list[str]] |
| 56 | + |
48 | 57 | # Pytype fails with the following: |
49 | 58 | # find_packages = PackageFinder.find |
50 | 59 | # find_namespace_packages = PEP420PackageFinder.find |
@@ -85,7 +94,8 @@ def setup( |
85 | 94 | command_options: Mapping[str, Mapping[str, tuple[Incomplete, Incomplete]]] = ..., |
86 | 95 | package_data: Mapping[str, list[str]] = ..., |
87 | 96 | include_package_data: bool = ..., |
88 | | - libraries: list[str] = ..., |
| 97 | + # libraries for `Distribution` or `build_clib`, not `Extension`, `build_ext` or `CCompiler` |
| 98 | + libraries: list[tuple[str, _BuildInfo]] = ..., |
89 | 99 | headers: list[str] = ..., |
90 | 100 | ext_package: str = ..., |
91 | 101 | include_dirs: list[str] = ..., |
|
0 commit comments