Skip to content

Commit bb92099

Browse files
committed
Vendor stdlib distutils from typeshed
1 parent ae22ac2 commit bb92099

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2044
-0
lines changed

typings/distutils-stubs/__init__.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Attempts to improve these stubs are probably not the best use of time:
2+
# - distutils is deleted in Python 3.12 and newer
3+
# - Most users already do not use stdlib distutils, due to setuptools monkeypatching
4+
# - We have very little quality assurance on these stubs, since due to the two above issues
5+
# we allowlist all distutils errors in stubtest.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from _typeshed import StrOrBytesPath, StrPath
2+
from typing import Literal, overload
3+
4+
@overload
5+
def make_archive(
6+
base_name: str,
7+
format: str,
8+
root_dir: StrOrBytesPath | None = None,
9+
base_dir: str | None = None,
10+
verbose: bool | Literal[0, 1] = 0,
11+
dry_run: bool | Literal[0, 1] = 0,
12+
owner: str | None = None,
13+
group: str | None = None,
14+
) -> str: ...
15+
@overload
16+
def make_archive(
17+
base_name: StrPath,
18+
format: str,
19+
root_dir: StrOrBytesPath,
20+
base_dir: str | None = None,
21+
verbose: bool | Literal[0, 1] = 0,
22+
dry_run: bool | Literal[0, 1] = 0,
23+
owner: str | None = None,
24+
group: str | None = None,
25+
) -> str: ...
26+
def make_tarball(
27+
base_name: str,
28+
base_dir: StrPath,
29+
compress: str | None = "gzip",
30+
verbose: bool | Literal[0, 1] = 0,
31+
dry_run: bool | Literal[0, 1] = 0,
32+
owner: str | None = None,
33+
group: str | None = None,
34+
) -> str: ...
35+
def make_zipfile(base_name: str, base_dir: str, verbose: bool | Literal[0, 1] = 0, dry_run: bool | Literal[0, 1] = 0) -> str: ...
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from distutils.ccompiler import CCompiler
2+
3+
class BCPPCompiler(CCompiler): ...

typings/distutils-stubs/ccompiler.pyi

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

0 commit comments

Comments
 (0)