1
1
from _typeshed import BytesPath , StrPath , Unused
2
2
from collections .abc import Callable , Iterable
3
- from distutils .file_util import _BytesPathT , _StrPathT
4
- from typing import Literal , overload
3
+ from typing import ClassVar , Literal , TypeVar , overload
5
4
from typing_extensions import TypeAlias , TypeVarTuple , Unpack
6
5
7
6
_Macro : TypeAlias = tuple [str ] | tuple [str , str | None ]
7
+ _StrPathT = TypeVar ("_StrPathT" , bound = StrPath )
8
+ _BytesPathT = TypeVar ("_BytesPathT" , bound = BytesPath )
8
9
_Ts = TypeVarTuple ("_Ts" )
9
10
10
11
def gen_lib_options (
@@ -13,15 +14,20 @@ def gen_lib_options(
13
14
def gen_preprocess_options (macros : list [_Macro ], include_dirs : list [str ]) -> list [str ]: ...
14
15
def get_default_compiler (osname : str | None = None , platform : str | None = None ) -> str : ...
15
16
def new_compiler (
16
- plat : str | None = None ,
17
- compiler : str | None = None ,
18
- verbose : bool | Literal [0 , 1 ] = 0 ,
19
- dry_run : bool | Literal [0 , 1 ] = 0 ,
20
- force : bool | Literal [0 , 1 ] = 0 ,
17
+ plat : str | None = None , compiler : str | None = None , verbose : bool = False , dry_run : bool = False , force : bool = False
21
18
) -> CCompiler : ...
22
19
def show_compilers () -> None : ...
23
20
24
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 ]]
25
31
dry_run : bool
26
32
force : bool
27
33
verbose : bool
@@ -32,9 +38,7 @@ class CCompiler:
32
38
library_dirs : list [str ]
33
39
runtime_library_dirs : list [str ]
34
40
objects : list [str ]
35
- def __init__ (
36
- self , verbose : bool | Literal [0 , 1 ] = 0 , dry_run : bool | Literal [0 , 1 ] = 0 , force : bool | Literal [0 , 1 ] = 0
37
- ) -> None : ...
41
+ def __init__ (self , verbose : bool = False , dry_run : bool = False , force : bool = False ) -> None : ...
38
42
def add_include_dir (self , dir : str ) -> None : ...
39
43
def set_include_dirs (self , dirs : list [str ]) -> None : ...
40
44
def add_library (self , libname : str ) -> None : ...
@@ -48,7 +52,7 @@ class CCompiler:
48
52
def add_link_object (self , object : str ) -> None : ...
49
53
def set_link_objects (self , objects : list [str ]) -> None : ...
50
54
def detect_language (self , sources : str | list [str ]) -> str | None : ...
51
- def find_library_file (self , dirs : list [str ], lib : str , debug : bool | Literal [ 0 , 1 ] = 0 ) -> str | None : ...
55
+ def find_library_file (self , dirs : list [str ], lib : str , debug : bool = False ) -> str | None : ...
52
56
def has_function (
53
57
self ,
54
58
funcname : str ,
@@ -67,7 +71,7 @@ class CCompiler:
67
71
output_dir : str | None = None ,
68
72
macros : list [_Macro ] | None = None ,
69
73
include_dirs : list [str ] | None = None ,
70
- debug : bool | Literal [ 0 , 1 ] = 0 ,
74
+ debug : bool = False ,
71
75
extra_preargs : list [str ] | None = None ,
72
76
extra_postargs : list [str ] | None = None ,
73
77
depends : list [str ] | None = None ,
@@ -77,7 +81,7 @@ class CCompiler:
77
81
objects : list [str ],
78
82
output_libname : str ,
79
83
output_dir : str | None = None ,
80
- debug : bool | Literal [ 0 , 1 ] = 0 ,
84
+ debug : bool = False ,
81
85
target_lang : str | None = None ,
82
86
) -> None : ...
83
87
def link (
@@ -90,7 +94,7 @@ class CCompiler:
90
94
library_dirs : list [str ] | None = None ,
91
95
runtime_library_dirs : list [str ] | None = None ,
92
96
export_symbols : list [str ] | None = None ,
93
- debug : bool | Literal [ 0 , 1 ] = 0 ,
97
+ debug : bool = False ,
94
98
extra_preargs : list [str ] | None = None ,
95
99
extra_postargs : list [str ] | None = None ,
96
100
build_temp : str | None = None ,
@@ -104,7 +108,7 @@ class CCompiler:
104
108
libraries : list [str ] | None = None ,
105
109
library_dirs : list [str ] | None = None ,
106
110
runtime_library_dirs : list [str ] | None = None ,
107
- debug : bool | Literal [ 0 , 1 ] = 0 ,
111
+ debug : bool = False ,
108
112
extra_preargs : list [str ] | None = None ,
109
113
extra_postargs : list [str ] | None = None ,
110
114
target_lang : str | None = None ,
@@ -118,7 +122,7 @@ class CCompiler:
118
122
library_dirs : list [str ] | None = None ,
119
123
runtime_library_dirs : list [str ] | None = None ,
120
124
export_symbols : list [str ] | None = None ,
121
- debug : bool | Literal [ 0 , 1 ] = 0 ,
125
+ debug : bool = False ,
122
126
extra_preargs : list [str ] | None = None ,
123
127
extra_postargs : list [str ] | None = None ,
124
128
build_temp : str | None = None ,
@@ -133,7 +137,7 @@ class CCompiler:
133
137
library_dirs : list [str ] | None = None ,
134
138
runtime_library_dirs : list [str ] | None = None ,
135
139
export_symbols : list [str ] | None = None ,
136
- debug : bool | Literal [ 0 , 1 ] = 0 ,
140
+ debug : bool = False ,
137
141
extra_preargs : list [str ] | None = None ,
138
142
extra_postargs : list [str ] | None = None ,
139
143
build_temp : str | None = None ,
@@ -153,10 +157,10 @@ class CCompiler:
153
157
@overload
154
158
def executable_filename (self , basename : StrPath , strip_dir : Literal [1 , True ], output_dir : StrPath = "" ) -> str : ...
155
159
def library_filename (
156
- self , libname : str , lib_type : str = "static" , strip_dir : bool | Literal [ 0 , 1 ] = 0 , output_dir : StrPath = ""
160
+ self , libname : str , lib_type : str = "static" , strip_dir : bool = False , output_dir : StrPath = ""
157
161
) -> str : ...
158
162
def object_filenames (
159
- self , source_filenames : Iterable [StrPath ], strip_dir : bool | Literal [ 0 , 1 ] = 0 , output_dir : StrPath | None = ""
163
+ self , source_filenames : Iterable [StrPath ], strip_dir : bool = False , output_dir : StrPath | None = None
160
164
) -> list [str ]: ...
161
165
@overload
162
166
def shared_object_filename (self , basename : str , strip_dir : Literal [0 , False ] = 0 , output_dir : StrPath = "" ) -> str : ...
0 commit comments