Skip to content

Commit af32625

Browse files
authored
setuptools._distutils typing improvements from merging types upstream (#13534)
1 parent c27e41c commit af32625

File tree

18 files changed

+128
-117
lines changed

18 files changed

+128
-117
lines changed

stubs/setuptools/@tests/stubtest_allowlist.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ setuptools._distutils.command.install.INSTALL_SCHEMES
5757
setuptools._distutils.command.install.SCHEME_KEYS
5858
setuptools._distutils.command.install.WINDOWS_SCHEME
5959
setuptools._distutils.command.install_lib.PYTHON_SOURCE_EXTENSION
60-
setuptools._distutils.dist.DistributionMetadata.set_classifiers
61-
setuptools._distutils.dist.DistributionMetadata.set_keywords
62-
setuptools._distutils.dist.DistributionMetadata.set_platforms
6360
setuptools._distutils.dist.fix_help_options
6461
setuptools._distutils.extension.read_setup_file
6562
setuptools._distutils.filelist.findall

stubs/setuptools/setuptools/_distutils/archive_util.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ def make_tarball(
3232
owner: str | None = None,
3333
group: str | None = None,
3434
) -> str: ...
35-
def make_zipfile(base_name: str, base_dir: str, verbose: bool = False, dry_run: bool = False) -> str: ...
35+
def make_zipfile(base_name: str, base_dir: StrPath, verbose: bool = False, dry_run: bool = False) -> str: ...

stubs/setuptools/setuptools/_distutils/ccompiler.pyi

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ _BytesPathT = TypeVar("_BytesPathT", bound=BytesPath)
99
_Ts = TypeVarTuple("_Ts")
1010

1111
def gen_lib_options(
12-
compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str]
12+
compiler: CCompiler, library_dirs: Iterable[str], runtime_library_dirs: Iterable[str], libraries: Iterable[str]
1313
) -> list[str]: ...
14-
def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ...
14+
def gen_preprocess_options(macros: Iterable[_Macro], include_dirs: Iterable[str]) -> list[str]: ...
1515
def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str: ...
1616
def new_compiler(
1717
plat: str | None = None, compiler: str | None = None, verbose: bool = False, dry_run: bool = False, force: bool = False
@@ -52,33 +52,33 @@ class CCompiler:
5252
def add_link_object(self, object: str) -> None: ...
5353
def set_link_objects(self, objects: list[str]) -> None: ...
5454
def detect_language(self, sources: str | list[str]) -> str | None: ...
55-
def find_library_file(self, dirs: list[str], lib: str, debug: bool = False) -> str | None: ...
55+
def find_library_file(self, dirs: Iterable[str], lib: str, debug: bool = False) -> str | None: ...
5656
def has_function(
5757
self,
5858
funcname: str,
59-
includes: list[str] | None = None,
60-
include_dirs: list[str] | None = None,
59+
includes: Iterable[str] | None = None,
60+
include_dirs: list[str] | tuple[str, ...] | None = None,
6161
libraries: list[str] | None = None,
62-
library_dirs: list[str] | None = None,
62+
library_dirs: list[str] | tuple[str, ...] | None = None,
6363
) -> bool: ...
6464
def library_dir_option(self, dir: str) -> str: ...
6565
def library_option(self, lib: str) -> str: ...
6666
def runtime_library_dir_option(self, dir: str) -> str: ...
67-
def set_executables(self, **args: str) -> None: ...
67+
def set_executables(self, **kwargs: str) -> None: ...
6868
def compile(
6969
self,
7070
sources: Sequence[StrPath],
7171
output_dir: str | None = None,
7272
macros: list[_Macro] | None = None,
73-
include_dirs: list[str] | None = None,
73+
include_dirs: list[str] | tuple[str, ...] | None = None,
7474
debug: bool = False,
7575
extra_preargs: list[str] | None = None,
7676
extra_postargs: list[str] | None = None,
77-
depends: list[str] | None = None,
77+
depends: list[str] | tuple[str, ...] | None = None,
7878
) -> list[str]: ...
7979
def create_static_lib(
8080
self,
81-
objects: list[str],
81+
objects: list[str] | tuple[str, ...],
8282
output_libname: str,
8383
output_dir: str | None = None,
8484
debug: bool = False,
@@ -87,89 +87,89 @@ class CCompiler:
8787
def link(
8888
self,
8989
target_desc: str,
90-
objects: list[str],
90+
objects: list[str] | tuple[str, ...],
9191
output_filename: str,
9292
output_dir: str | None = None,
93-
libraries: list[str] | None = None,
94-
library_dirs: list[str] | None = None,
95-
runtime_library_dirs: list[str] | None = None,
96-
export_symbols: list[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,
9797
debug: bool = False,
9898
extra_preargs: list[str] | None = None,
9999
extra_postargs: list[str] | None = None,
100-
build_temp: str | None = None,
100+
build_temp: StrPath | None = None,
101101
target_lang: str | None = None,
102102
) -> None: ...
103103
def link_executable(
104104
self,
105-
objects: list[str],
105+
objects: list[str] | tuple[str, ...],
106106
output_progname: str,
107107
output_dir: str | None = None,
108-
libraries: list[str] | None = None,
109-
library_dirs: list[str] | None = None,
110-
runtime_library_dirs: list[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,
111111
debug: bool = False,
112112
extra_preargs: list[str] | None = None,
113113
extra_postargs: list[str] | None = None,
114114
target_lang: str | None = None,
115115
) -> None: ...
116116
def link_shared_lib(
117117
self,
118-
objects: list[str],
118+
objects: list[str] | tuple[str, ...],
119119
output_libname: str,
120120
output_dir: str | None = None,
121-
libraries: list[str] | None = None,
122-
library_dirs: list[str] | None = None,
123-
runtime_library_dirs: list[str] | None = None,
124-
export_symbols: list[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,
125125
debug: bool = False,
126126
extra_preargs: list[str] | None = None,
127127
extra_postargs: list[str] | None = None,
128-
build_temp: str | None = None,
128+
build_temp: StrPath | None = None,
129129
target_lang: str | None = None,
130130
) -> None: ...
131131
def link_shared_object(
132132
self,
133-
objects: list[str],
133+
objects: list[str] | tuple[str, ...],
134134
output_filename: str,
135135
output_dir: str | None = None,
136-
libraries: list[str] | None = None,
137-
library_dirs: list[str] | None = None,
138-
runtime_library_dirs: list[str] | None = None,
139-
export_symbols: list[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,
140140
debug: bool = False,
141141
extra_preargs: list[str] | None = None,
142142
extra_postargs: list[str] | None = None,
143-
build_temp: str | None = None,
143+
build_temp: StrPath | None = None,
144144
target_lang: str | None = None,
145145
) -> None: ...
146146
def preprocess(
147147
self,
148-
source: str,
149-
output_file: str | None = None,
148+
source: StrPath,
149+
output_file: StrPath | None = None,
150150
macros: list[_Macro] | None = None,
151-
include_dirs: list[str] | None = None,
151+
include_dirs: list[str] | tuple[str, ...] | None = None,
152152
extra_preargs: list[str] | None = None,
153-
extra_postargs: list[str] | None = None,
153+
extra_postargs: Iterable[str] | None = None,
154154
) -> None: ...
155155
@overload
156-
def executable_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ...
156+
def executable_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ...
157157
@overload
158-
def executable_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ...
158+
def executable_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ...
159159
def library_filename(
160160
self, libname: str, lib_type: str = "static", strip_dir: bool = False, output_dir: StrPath = ""
161161
) -> str: ...
162162
def object_filenames(
163163
self, source_filenames: Iterable[StrPath], strip_dir: bool = False, output_dir: StrPath | None = ""
164164
) -> list[str]: ...
165165
@overload
166-
def shared_object_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ...
166+
def shared_object_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ...
167167
@overload
168-
def shared_object_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ...
168+
def shared_object_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ...
169169
def execute(
170170
self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1
171171
) -> None: ...
172-
def spawn(self, cmd: MutableSequence[str]) -> None: ...
172+
def spawn(self, cmd: MutableSequence[bytes | StrPath]) -> None: ...
173173
def mkpath(self, name: str, mode: int = 0o777) -> None: ...
174174
@overload
175175
def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ...

stubs/setuptools/setuptools/_distutils/command/bdist_rpm.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from typing import ClassVar
44
from ..cmd import Command
55

66
class bdist_rpm(Command):
7-
description: str
7+
description: ClassVar[str]
88
user_options: ClassVar[list[tuple[str, str | None, str]]]
99
boolean_options: ClassVar[list[str]]
1010
negative_opt: ClassVar[dict[str, str]]
@@ -41,12 +41,12 @@ class bdist_rpm(Command):
4141
conflicts: Incomplete
4242
build_requires: Incomplete
4343
obsoletes: Incomplete
44-
keep_temp: int
45-
use_rpm_opt_flags: int
46-
rpm3_mode: int
47-
no_autoreq: int
44+
keep_temp: bool
45+
use_rpm_opt_flags: bool
46+
rpm3_mode: bool
47+
no_autoreq: bool
4848
force_arch: Incomplete
49-
quiet: int
49+
quiet: bool
5050
def initialize_options(self) -> None: ...
5151
def finalize_options(self) -> None: ...
5252
def finalize_package_data(self) -> None: ...

stubs/setuptools/setuptools/_distutils/command/build.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from ..cmd import Command
77
def show_compilers() -> None: ...
88

99
class build(Command):
10-
description: str
10+
description: ClassVar[str]
1111
user_options: ClassVar[list[tuple[str, str | None, str]]]
1212
boolean_options: ClassVar[list[str]]
1313
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
@@ -20,7 +20,7 @@ class build(Command):
2020
compiler: Incomplete
2121
plat_name: Incomplete
2222
debug: Incomplete
23-
force: int
23+
force: bool
2424
executable: Incomplete
2525
parallel: Incomplete
2626
def initialize_options(self) -> None: ...

stubs/setuptools/setuptools/_distutils/command/build_clib.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from typing import ClassVar
55
from ..cmd import Command
66

77
class build_clib(Command):
8-
description: str
8+
description: ClassVar[str]
99
user_options: ClassVar[list[tuple[str, str, str]]]
1010
boolean_options: ClassVar[list[str]]
1111
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
@@ -16,7 +16,7 @@ class build_clib(Command):
1616
define: Incomplete
1717
undef: Incomplete
1818
debug: Incomplete
19-
force: int
19+
force: bool
2020
compiler: Incomplete
2121
def initialize_options(self) -> None: ...
2222
def finalize_options(self) -> None: ...

stubs/setuptools/setuptools/_distutils/command/build_ext.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from ..cmd import Command
66
from ..extension import Extension
77

88
class build_ext(Command):
9-
description: str
9+
description: ClassVar[str]
1010
sep_by: Incomplete
1111
user_options: ClassVar[list[tuple[str, str | None, str]]]
1212
boolean_options: ClassVar[list[str]]
@@ -15,7 +15,7 @@ class build_ext(Command):
1515
build_lib: Incomplete
1616
plat_name: Incomplete
1717
build_temp: Incomplete
18-
inplace: int
18+
inplace: bool
1919
package: Incomplete
2020
include_dirs: Incomplete
2121
define: Incomplete

stubs/setuptools/setuptools/_distutils/command/build_py.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from typing import ClassVar
44
from ..cmd import Command
55

66
class build_py(Command):
7-
description: str
7+
description: ClassVar[str]
88
user_options: ClassVar[list[tuple[str, str | None, str]]]
99
boolean_options: ClassVar[list[str]]
1010
negative_opt: ClassVar[dict[str, str]]
@@ -13,8 +13,8 @@ class build_py(Command):
1313
package: Incomplete
1414
package_data: Incomplete
1515
package_dir: Incomplete
16-
compile: int
17-
optimize: int
16+
compile: bool
17+
optimize: bool
1818
force: Incomplete
1919
def initialize_options(self) -> None: ...
2020
packages: Incomplete

stubs/setuptools/setuptools/_distutils/command/install.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from typing import ClassVar
44
from ..cmd import Command
55

66
class install(Command):
7-
description: str
7+
description: ClassVar[str]
88
user_options: ClassVar[list[tuple[str, str | None, str]]]
99
boolean_options: ClassVar[list[str]]
1010
negative_opt: ClassVar[dict[str, str]]
@@ -26,10 +26,10 @@ class install(Command):
2626
compile: Incomplete
2727
optimize: Incomplete
2828
extra_path: Incomplete
29-
install_path_file: int
30-
force: int
31-
skip_build: int
32-
warn_dir: int
29+
install_path_file: bool
30+
force: bool
31+
skip_build: bool
32+
warn_dir: bool
3333
build_base: Incomplete
3434
build_lib: Incomplete
3535
record: Incomplete

stubs/setuptools/setuptools/_distutils/command/install_data.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from typing import ClassVar
44
from ..cmd import Command
55

66
class install_data(Command):
7-
description: str
7+
description: ClassVar[str]
88
user_options: ClassVar[list[tuple[str, str | None, str]]]
99
boolean_options: Incomplete
1010
install_dir: Incomplete

0 commit comments

Comments
 (0)