Skip to content

Commit ed1d086

Browse files
committed
Merge setuptools/_distutils from typeshed
1 parent bb92099 commit ed1d086

23 files changed

+343
-464
lines changed

typings/distutils-stubs/_modified.pyi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from _typeshed import StrOrBytesPath
2+
from collections.abc import Callable, Iterable
3+
from typing import Literal, TypeVar
4+
5+
_SourcesT = TypeVar("_SourcesT", bound=StrOrBytesPath)
6+
_TargetsT = TypeVar("_TargetsT", bound=StrOrBytesPath)
7+
8+
def newer(source: StrOrBytesPath, target: StrOrBytesPath) -> bool: ...
9+
def newer_pairwise(
10+
sources: Iterable[_SourcesT], targets: Iterable[_TargetsT], newer: Callable[[_SourcesT, _TargetsT], bool] = newer
11+
) -> tuple[list[_SourcesT], list[_TargetsT]]: ...
12+
def newer_group(
13+
sources: Iterable[StrOrBytesPath], target: StrOrBytesPath, missing: Literal["error", "ignore", "newer"] = "error"
14+
) -> bool: ...
15+
def newer_pairwise_group(
16+
sources: Iterable[_SourcesT], targets: Iterable[_TargetsT], *, newer: Callable[[_SourcesT, _TargetsT], bool] = newer
17+
) -> tuple[list[_SourcesT], list[_TargetsT]]: ...

typings/distutils-stubs/archive_util.pyi

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ def make_archive(
77
format: str,
88
root_dir: StrOrBytesPath | None = None,
99
base_dir: str | None = None,
10-
verbose: bool | Literal[0, 1] = 0,
11-
dry_run: bool | Literal[0, 1] = 0,
10+
verbose: bool = False,
11+
dry_run: bool = False,
1212
owner: str | None = None,
1313
group: str | None = None,
1414
) -> str: ...
@@ -18,18 +18,18 @@ def make_archive(
1818
format: str,
1919
root_dir: StrOrBytesPath,
2020
base_dir: str | None = None,
21-
verbose: bool | Literal[0, 1] = 0,
22-
dry_run: bool | Literal[0, 1] = 0,
21+
verbose: bool = False,
22+
dry_run: bool = False,
2323
owner: str | None = None,
2424
group: str | None = None,
2525
) -> str: ...
2626
def make_tarball(
2727
base_name: str,
2828
base_dir: StrPath,
29-
compress: str | None = "gzip",
30-
verbose: bool | Literal[0, 1] = 0,
31-
dry_run: bool | Literal[0, 1] = 0,
29+
compress: Literal["gzip", "bzip2", "xz"] | None = "gzip",
30+
verbose: bool = False,
31+
dry_run: bool = False,
3232
owner: str | None = None,
3333
group: str | None = None,
3434
) -> 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: ...
35+
def make_zipfile(base_name: str, base_dir: str, verbose: bool = False, dry_run: bool = False) -> str: ...

typings/distutils-stubs/ccompiler.pyi

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from _typeshed import BytesPath, StrPath, Unused
22
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
54
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
65

76
_Macro: TypeAlias = tuple[str] | tuple[str, str | None]
7+
_StrPathT = TypeVar("_StrPathT", bound=StrPath)
8+
_BytesPathT = TypeVar("_BytesPathT", bound=BytesPath)
89
_Ts = TypeVarTuple("_Ts")
910

1011
def gen_lib_options(
@@ -13,15 +14,20 @@ def gen_lib_options(
1314
def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ...
1415
def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str: ...
1516
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
2118
) -> CCompiler: ...
2219
def show_compilers() -> None: ...
2320

2421
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]]
2531
dry_run: bool
2632
force: bool
2733
verbose: bool
@@ -32,9 +38,7 @@ class CCompiler:
3238
library_dirs: list[str]
3339
runtime_library_dirs: list[str]
3440
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: ...
3842
def add_include_dir(self, dir: str) -> None: ...
3943
def set_include_dirs(self, dirs: list[str]) -> None: ...
4044
def add_library(self, libname: str) -> None: ...
@@ -48,7 +52,7 @@ class CCompiler:
4852
def add_link_object(self, object: str) -> None: ...
4953
def set_link_objects(self, objects: list[str]) -> None: ...
5054
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: ...
5256
def has_function(
5357
self,
5458
funcname: str,
@@ -67,7 +71,7 @@ class CCompiler:
6771
output_dir: str | None = None,
6872
macros: list[_Macro] | None = None,
6973
include_dirs: list[str] | None = None,
70-
debug: bool | Literal[0, 1] = 0,
74+
debug: bool = False,
7175
extra_preargs: list[str] | None = None,
7276
extra_postargs: list[str] | None = None,
7377
depends: list[str] | None = None,
@@ -77,7 +81,7 @@ class CCompiler:
7781
objects: list[str],
7882
output_libname: str,
7983
output_dir: str | None = None,
80-
debug: bool | Literal[0, 1] = 0,
84+
debug: bool = False,
8185
target_lang: str | None = None,
8286
) -> None: ...
8387
def link(
@@ -90,7 +94,7 @@ class CCompiler:
9094
library_dirs: list[str] | None = None,
9195
runtime_library_dirs: list[str] | None = None,
9296
export_symbols: list[str] | None = None,
93-
debug: bool | Literal[0, 1] = 0,
97+
debug: bool = False,
9498
extra_preargs: list[str] | None = None,
9599
extra_postargs: list[str] | None = None,
96100
build_temp: str | None = None,
@@ -104,7 +108,7 @@ class CCompiler:
104108
libraries: list[str] | None = None,
105109
library_dirs: list[str] | None = None,
106110
runtime_library_dirs: list[str] | None = None,
107-
debug: bool | Literal[0, 1] = 0,
111+
debug: bool = False,
108112
extra_preargs: list[str] | None = None,
109113
extra_postargs: list[str] | None = None,
110114
target_lang: str | None = None,
@@ -118,7 +122,7 @@ class CCompiler:
118122
library_dirs: list[str] | None = None,
119123
runtime_library_dirs: list[str] | None = None,
120124
export_symbols: list[str] | None = None,
121-
debug: bool | Literal[0, 1] = 0,
125+
debug: bool = False,
122126
extra_preargs: list[str] | None = None,
123127
extra_postargs: list[str] | None = None,
124128
build_temp: str | None = None,
@@ -133,7 +137,7 @@ class CCompiler:
133137
library_dirs: list[str] | None = None,
134138
runtime_library_dirs: list[str] | None = None,
135139
export_symbols: list[str] | None = None,
136-
debug: bool | Literal[0, 1] = 0,
140+
debug: bool = False,
137141
extra_preargs: list[str] | None = None,
138142
extra_postargs: list[str] | None = None,
139143
build_temp: str | None = None,
@@ -153,10 +157,10 @@ class CCompiler:
153157
@overload
154158
def executable_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ...
155159
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 = ""
157161
) -> str: ...
158162
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
160164
) -> list[str]: ...
161165
@overload
162166
def shared_object_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ...

0 commit comments

Comments
 (0)