|
1 | | -from _typeshed import BytesPath, StrPath, Unused |
2 | | -from collections.abc import Callable, Iterable, MutableSequence, Sequence |
3 | | -from typing import ClassVar, Literal, TypeVar, overload |
4 | | -from typing_extensions import TypeAlias, TypeVarTuple, Unpack |
| 1 | +from .compilers.C import base |
| 2 | +from .compilers.C.base import gen_lib_options, gen_preprocess_options, get_default_compiler, new_compiler, show_compilers |
| 3 | +from .compilers.C.errors import CompileError, LinkError |
5 | 4 |
|
6 | | -_Macro: TypeAlias = tuple[str] | tuple[str, str | None] |
7 | | -_StrPathT = TypeVar("_StrPathT", bound=StrPath) |
8 | | -_BytesPathT = TypeVar("_BytesPathT", bound=BytesPath) |
9 | | -_Ts = TypeVarTuple("_Ts") |
| 5 | +__all__ = [ |
| 6 | + "CompileError", |
| 7 | + "LinkError", |
| 8 | + "gen_lib_options", |
| 9 | + "gen_preprocess_options", |
| 10 | + "get_default_compiler", |
| 11 | + "new_compiler", |
| 12 | + "show_compilers", |
| 13 | +] |
10 | 14 |
|
11 | | -def gen_lib_options( |
12 | | - compiler: CCompiler, library_dirs: Iterable[str], runtime_library_dirs: Iterable[str], libraries: Iterable[str] |
13 | | -) -> list[str]: ... |
14 | | -def gen_preprocess_options(macros: Iterable[_Macro], include_dirs: Iterable[str]) -> list[str]: ... |
15 | | -def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str: ... |
16 | | -def new_compiler( |
17 | | - plat: str | None = None, compiler: str | None = None, verbose: bool = False, dry_run: bool = False, force: bool = False |
18 | | -) -> CCompiler: ... |
19 | | -def show_compilers() -> None: ... |
20 | | - |
21 | | -class CCompiler: |
22 | | - src_extensions: ClassVar[list[str] | None] |
23 | | - obj_extension: ClassVar[str | None] |
24 | | - static_lib_extension: ClassVar[str | None] |
25 | | - shared_lib_extension: ClassVar[str | None] |
26 | | - static_lib_format: ClassVar[str | None] |
27 | | - shared_lib_format: ClassVar[str | None] |
28 | | - exe_extension: ClassVar[str | None] |
29 | | - language_map: ClassVar[dict[str, str]] |
30 | | - language_order: ClassVar[list[str]] |
31 | | - dry_run: bool |
32 | | - force: bool |
33 | | - verbose: bool |
34 | | - output_dir: str | None |
35 | | - macros: list[_Macro] |
36 | | - include_dirs: list[str] |
37 | | - libraries: list[str] |
38 | | - library_dirs: list[str] |
39 | | - runtime_library_dirs: list[str] |
40 | | - objects: list[str] |
41 | | - def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... |
42 | | - def add_include_dir(self, dir: str) -> None: ... |
43 | | - def set_include_dirs(self, dirs: list[str]) -> None: ... |
44 | | - def add_library(self, libname: str) -> None: ... |
45 | | - def set_libraries(self, libnames: list[str]) -> None: ... |
46 | | - def add_library_dir(self, dir: str) -> None: ... |
47 | | - def set_library_dirs(self, dirs: list[str]) -> None: ... |
48 | | - def add_runtime_library_dir(self, dir: str) -> None: ... |
49 | | - def set_runtime_library_dirs(self, dirs: list[str]) -> None: ... |
50 | | - def define_macro(self, name: str, value: str | None = None) -> None: ... |
51 | | - def undefine_macro(self, name: str) -> None: ... |
52 | | - def add_link_object(self, object: str) -> None: ... |
53 | | - def set_link_objects(self, objects: list[str]) -> None: ... |
54 | | - def detect_language(self, sources: str | list[str]) -> str | None: ... |
55 | | - def find_library_file(self, dirs: Iterable[str], lib: str, debug: bool = False) -> str | None: ... |
56 | | - def has_function( |
57 | | - self, |
58 | | - funcname: str, |
59 | | - includes: Iterable[str] | None = None, |
60 | | - include_dirs: list[str] | tuple[str, ...] | None = None, |
61 | | - libraries: list[str] | None = None, |
62 | | - library_dirs: list[str] | tuple[str, ...] | None = None, |
63 | | - ) -> bool: ... |
64 | | - def library_dir_option(self, dir: str) -> str: ... |
65 | | - def library_option(self, lib: str) -> str: ... |
66 | | - def runtime_library_dir_option(self, dir: str) -> str: ... |
67 | | - def set_executables(self, **kwargs: str) -> None: ... |
68 | | - def compile( |
69 | | - self, |
70 | | - sources: Sequence[StrPath], |
71 | | - output_dir: str | None = None, |
72 | | - macros: list[_Macro] | None = None, |
73 | | - include_dirs: list[str] | tuple[str, ...] | None = None, |
74 | | - debug: bool = False, |
75 | | - extra_preargs: list[str] | None = None, |
76 | | - extra_postargs: list[str] | None = None, |
77 | | - depends: list[str] | tuple[str, ...] | None = None, |
78 | | - ) -> list[str]: ... |
79 | | - def create_static_lib( |
80 | | - self, |
81 | | - objects: list[str] | tuple[str, ...], |
82 | | - output_libname: str, |
83 | | - output_dir: str | None = None, |
84 | | - debug: bool = False, |
85 | | - target_lang: str | None = None, |
86 | | - ) -> None: ... |
87 | | - def link( |
88 | | - self, |
89 | | - target_desc: str, |
90 | | - objects: list[str] | tuple[str, ...], |
91 | | - output_filename: str, |
92 | | - output_dir: str | None = None, |
93 | | - libraries: list[str] | tuple[str, ...] | None = None, |
94 | | - library_dirs: list[str] | tuple[str, ...] | None = None, |
95 | | - runtime_library_dirs: list[str] | tuple[str, ...] | None = None, |
96 | | - export_symbols: Iterable[str] | None = None, |
97 | | - debug: bool = False, |
98 | | - extra_preargs: list[str] | None = None, |
99 | | - extra_postargs: list[str] | None = None, |
100 | | - build_temp: StrPath | None = None, |
101 | | - target_lang: str | None = None, |
102 | | - ) -> None: ... |
103 | | - def link_executable( |
104 | | - self, |
105 | | - objects: list[str] | tuple[str, ...], |
106 | | - output_progname: str, |
107 | | - output_dir: str | None = None, |
108 | | - libraries: list[str] | tuple[str, ...] | None = None, |
109 | | - library_dirs: list[str] | tuple[str, ...] | None = None, |
110 | | - runtime_library_dirs: list[str] | tuple[str, ...] | None = None, |
111 | | - debug: bool = False, |
112 | | - extra_preargs: list[str] | None = None, |
113 | | - extra_postargs: list[str] | None = None, |
114 | | - target_lang: str | None = None, |
115 | | - ) -> None: ... |
116 | | - def link_shared_lib( |
117 | | - self, |
118 | | - objects: list[str] | tuple[str, ...], |
119 | | - output_libname: str, |
120 | | - output_dir: str | None = None, |
121 | | - libraries: list[str] | tuple[str, ...] | None = None, |
122 | | - library_dirs: list[str] | tuple[str, ...] | None = None, |
123 | | - runtime_library_dirs: list[str] | tuple[str, ...] | None = None, |
124 | | - export_symbols: Iterable[str] | None = None, |
125 | | - debug: bool = False, |
126 | | - extra_preargs: list[str] | None = None, |
127 | | - extra_postargs: list[str] | None = None, |
128 | | - build_temp: StrPath | None = None, |
129 | | - target_lang: str | None = None, |
130 | | - ) -> None: ... |
131 | | - def link_shared_object( |
132 | | - self, |
133 | | - objects: list[str] | tuple[str, ...], |
134 | | - output_filename: str, |
135 | | - output_dir: str | None = None, |
136 | | - libraries: list[str] | tuple[str, ...] | None = None, |
137 | | - library_dirs: list[str] | tuple[str, ...] | None = None, |
138 | | - runtime_library_dirs: list[str] | tuple[str, ...] | None = None, |
139 | | - export_symbols: Iterable[str] | None = None, |
140 | | - debug: bool = False, |
141 | | - extra_preargs: list[str] | None = None, |
142 | | - extra_postargs: list[str] | None = None, |
143 | | - build_temp: StrPath | None = None, |
144 | | - target_lang: str | None = None, |
145 | | - ) -> None: ... |
146 | | - def preprocess( |
147 | | - self, |
148 | | - source: StrPath, |
149 | | - output_file: StrPath | None = None, |
150 | | - macros: list[_Macro] | None = None, |
151 | | - include_dirs: list[str] | tuple[str, ...] | None = None, |
152 | | - extra_preargs: list[str] | None = None, |
153 | | - extra_postargs: Iterable[str] | None = None, |
154 | | - ) -> None: ... |
155 | | - @overload |
156 | | - def executable_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ... |
157 | | - @overload |
158 | | - def executable_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ... |
159 | | - def library_filename( |
160 | | - self, libname: str, lib_type: str = "static", strip_dir: bool = False, output_dir: StrPath = "" |
161 | | - ) -> str: ... |
162 | | - def object_filenames( |
163 | | - self, source_filenames: Iterable[StrPath], strip_dir: bool = False, output_dir: StrPath | None = "" |
164 | | - ) -> list[str]: ... |
165 | | - @overload |
166 | | - def shared_object_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ... |
167 | | - @overload |
168 | | - def shared_object_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ... |
169 | | - def execute( |
170 | | - self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 |
171 | | - ) -> None: ... |
172 | | - def spawn(self, cmd: MutableSequence[bytes | StrPath]) -> None: ... |
173 | | - def mkpath(self, name: str, mode: int = 0o777) -> None: ... |
174 | | - @overload |
175 | | - def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ... |
176 | | - @overload |
177 | | - def move_file(self, src: BytesPath, dst: _BytesPathT) -> _BytesPathT | bytes: ... |
178 | | - def announce(self, msg: str, level: int = 1) -> None: ... |
179 | | - def warn(self, msg: str) -> None: ... |
180 | | - def debug_print(self, msg: str) -> None: ... |
| 15 | +CCompiler = base.Compiler |
0 commit comments