setuptools._distutils typing improvements from merging types upstream (#13534)

This commit is contained in:
Avasam
2025-02-24 18:51:37 -05:00
committed by GitHub
parent c27e41c33b
commit af32625bd4
18 changed files with 130 additions and 119 deletions
@@ -57,9 +57,6 @@ setuptools._distutils.command.install.INSTALL_SCHEMES
setuptools._distutils.command.install.SCHEME_KEYS
setuptools._distutils.command.install.WINDOWS_SCHEME
setuptools._distutils.command.install_lib.PYTHON_SOURCE_EXTENSION
setuptools._distutils.dist.DistributionMetadata.set_classifiers
setuptools._distutils.dist.DistributionMetadata.set_keywords
setuptools._distutils.dist.DistributionMetadata.set_platforms
setuptools._distutils.dist.fix_help_options
setuptools._distutils.extension.read_setup_file
setuptools._distutils.filelist.findall
@@ -32,4 +32,4 @@ def make_tarball(
owner: str | None = None,
group: str | None = None,
) -> str: ...
def make_zipfile(base_name: str, base_dir: str, verbose: bool = False, dry_run: bool = False) -> str: ...
def make_zipfile(base_name: str, base_dir: StrPath, verbose: bool = False, dry_run: bool = False) -> str: ...
@@ -9,9 +9,9 @@ _BytesPathT = TypeVar("_BytesPathT", bound=BytesPath)
_Ts = TypeVarTuple("_Ts")
def gen_lib_options(
compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str]
compiler: CCompiler, library_dirs: Iterable[str], runtime_library_dirs: Iterable[str], libraries: Iterable[str]
) -> list[str]: ...
def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ...
def gen_preprocess_options(macros: Iterable[_Macro], include_dirs: Iterable[str]) -> list[str]: ...
def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str: ...
def new_compiler(
plat: str | None = None, compiler: str | None = None, verbose: bool = False, dry_run: bool = False, force: bool = False
@@ -52,33 +52,33 @@ class CCompiler:
def add_link_object(self, object: str) -> None: ...
def set_link_objects(self, objects: list[str]) -> None: ...
def detect_language(self, sources: str | list[str]) -> str | None: ...
def find_library_file(self, dirs: list[str], lib: str, debug: bool = False) -> str | None: ...
def find_library_file(self, dirs: Iterable[str], lib: str, debug: bool = False) -> str | None: ...
def has_function(
self,
funcname: str,
includes: list[str] | None = None,
include_dirs: list[str] | None = None,
includes: Iterable[str] | None = None,
include_dirs: list[str] | tuple[str, ...] | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
) -> bool: ...
def library_dir_option(self, dir: str) -> str: ...
def library_option(self, lib: str) -> str: ...
def runtime_library_dir_option(self, dir: str) -> str: ...
def set_executables(self, **args: str) -> None: ...
def set_executables(self, **kwargs: str) -> None: ...
def compile(
self,
sources: Sequence[StrPath],
output_dir: str | None = None,
macros: list[_Macro] | None = None,
include_dirs: list[str] | None = None,
include_dirs: list[str] | tuple[str, ...] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
depends: list[str] | None = None,
depends: list[str] | tuple[str, ...] | None = None,
) -> list[str]: ...
def create_static_lib(
self,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_libname: str,
output_dir: str | None = None,
debug: bool = False,
@@ -87,27 +87,27 @@ class CCompiler:
def link(
self,
target_desc: str,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_filename: str,
output_dir: str | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
export_symbols: list[str] | None = None,
libraries: list[str] | tuple[str, ...] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
export_symbols: Iterable[str] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
build_temp: str | None = None,
build_temp: StrPath | None = None,
target_lang: str | None = None,
) -> None: ...
def link_executable(
self,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_progname: str,
output_dir: str | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
libraries: list[str] | tuple[str, ...] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
@@ -115,47 +115,47 @@ class CCompiler:
) -> None: ...
def link_shared_lib(
self,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_libname: str,
output_dir: str | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
export_symbols: list[str] | None = None,
libraries: list[str] | tuple[str, ...] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
export_symbols: Iterable[str] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
build_temp: str | None = None,
build_temp: StrPath | None = None,
target_lang: str | None = None,
) -> None: ...
def link_shared_object(
self,
objects: list[str],
objects: list[str] | tuple[str, ...],
output_filename: str,
output_dir: str | None = None,
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
export_symbols: list[str] | None = None,
libraries: list[str] | tuple[str, ...] | None = None,
library_dirs: list[str] | tuple[str, ...] | None = None,
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
export_symbols: Iterable[str] | None = None,
debug: bool = False,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
build_temp: str | None = None,
build_temp: StrPath | None = None,
target_lang: str | None = None,
) -> None: ...
def preprocess(
self,
source: str,
output_file: str | None = None,
source: StrPath,
output_file: StrPath | None = None,
macros: list[_Macro] | None = None,
include_dirs: list[str] | None = None,
include_dirs: list[str] | tuple[str, ...] | None = None,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
extra_postargs: Iterable[str] | None = None,
) -> None: ...
@overload
def executable_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ...
def executable_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ...
@overload
def executable_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ...
def executable_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ...
def library_filename(
self, libname: str, lib_type: str = "static", strip_dir: bool = False, output_dir: StrPath = ""
) -> str: ...
@@ -163,13 +163,13 @@ class CCompiler:
self, source_filenames: Iterable[StrPath], strip_dir: bool = False, output_dir: StrPath | None = ""
) -> list[str]: ...
@overload
def shared_object_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ...
def shared_object_filename(self, basename: str, strip_dir: Literal[False] = False, output_dir: StrPath = "") -> str: ...
@overload
def shared_object_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ...
def shared_object_filename(self, basename: StrPath, strip_dir: Literal[True], output_dir: StrPath = "") -> str: ...
def execute(
self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1
) -> None: ...
def spawn(self, cmd: MutableSequence[str]) -> None: ...
def spawn(self, cmd: MutableSequence[bytes | StrPath]) -> None: ...
def mkpath(self, name: str, mode: int = 0o777) -> None: ...
@overload
def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ...
@@ -4,7 +4,7 @@ from typing import ClassVar
from ..cmd import Command
class bdist_rpm(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
negative_opt: ClassVar[dict[str, str]]
@@ -41,12 +41,12 @@ class bdist_rpm(Command):
conflicts: Incomplete
build_requires: Incomplete
obsoletes: Incomplete
keep_temp: int
use_rpm_opt_flags: int
rpm3_mode: int
no_autoreq: int
keep_temp: bool
use_rpm_opt_flags: bool
rpm3_mode: bool
no_autoreq: bool
force_arch: Incomplete
quiet: int
quiet: bool
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
def finalize_package_data(self) -> None: ...
@@ -7,7 +7,7 @@ from ..cmd import Command
def show_compilers() -> None: ...
class build(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
@@ -20,7 +20,7 @@ class build(Command):
compiler: Incomplete
plat_name: Incomplete
debug: Incomplete
force: int
force: bool
executable: Incomplete
parallel: Incomplete
def initialize_options(self) -> None: ...
@@ -5,7 +5,7 @@ from typing import ClassVar
from ..cmd import Command
class build_clib(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str, str]]]
boolean_options: ClassVar[list[str]]
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
@@ -16,7 +16,7 @@ class build_clib(Command):
define: Incomplete
undef: Incomplete
debug: Incomplete
force: int
force: bool
compiler: Incomplete
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
@@ -6,7 +6,7 @@ from ..cmd import Command
from ..extension import Extension
class build_ext(Command):
description: str
description: ClassVar[str]
sep_by: Incomplete
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
@@ -15,7 +15,7 @@ class build_ext(Command):
build_lib: Incomplete
plat_name: Incomplete
build_temp: Incomplete
inplace: int
inplace: bool
package: Incomplete
include_dirs: Incomplete
define: Incomplete
@@ -4,7 +4,7 @@ from typing import ClassVar
from ..cmd import Command
class build_py(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
negative_opt: ClassVar[dict[str, str]]
@@ -13,8 +13,8 @@ class build_py(Command):
package: Incomplete
package_data: Incomplete
package_dir: Incomplete
compile: int
optimize: int
compile: bool
optimize: bool
force: Incomplete
def initialize_options(self) -> None: ...
packages: Incomplete
@@ -4,7 +4,7 @@ from typing import ClassVar
from ..cmd import Command
class install(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
negative_opt: ClassVar[dict[str, str]]
@@ -26,10 +26,10 @@ class install(Command):
compile: Incomplete
optimize: Incomplete
extra_path: Incomplete
install_path_file: int
force: int
skip_build: int
warn_dir: int
install_path_file: bool
force: bool
skip_build: bool
warn_dir: bool
build_base: Incomplete
build_lib: Incomplete
record: Incomplete
@@ -4,7 +4,7 @@ from typing import ClassVar
from ..cmd import Command
class install_data(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: Incomplete
install_dir: Incomplete
@@ -1,16 +1,16 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, MaybeNone
from typing import ClassVar
from ..cmd import Command
class install_lib(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
negative_opt: ClassVar[dict[str, str]]
install_dir: Incomplete
build_dir: Incomplete
force: int
force: bool
compile: Incomplete
optimize: Incomplete
skip_build: Incomplete
@@ -18,7 +18,7 @@ class install_lib(Command):
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def build(self) -> None: ...
def install(self) -> list[str]: ...
def install(self) -> list[str] | MaybeNone: ...
def byte_compile(self, files) -> None: ...
def get_outputs(self): ...
def get_inputs(self): ...
@@ -4,11 +4,11 @@ from typing import ClassVar
from ..cmd import Command
class install_scripts(Command):
description: str
description: ClassVar[str]
user_options: ClassVar[list[tuple[str, str | None, str]]]
boolean_options: ClassVar[list[str]]
install_dir: Incomplete
force: int
force: bool
build_dir: Incomplete
skip_build: Incomplete
def initialize_options(self) -> None: ...
@@ -18,15 +18,15 @@ class sdist(Command):
READMES: ClassVar[tuple[str, ...]]
template: Incomplete
manifest: Incomplete
use_defaults: int
prune: int
manifest_only: int
force_manifest: int
use_defaults: bool
prune: bool
manifest_only: bool
force_manifest: bool
formats: Incomplete
keep_temp: int
keep_temp: bool
dist_dir: Incomplete
archive_files: Incomplete
metadata_check: int
metadata_check: int # Soon to be updated to boolean upstream
owner: Incomplete
group: Incomplete
def initialize_options(self) -> None: ...
@@ -1 +1,6 @@
def consolidate_linker_args(args: list[str]) -> str | list[str]: ...
from collections.abc import Iterable
from typing import TypeVar
_IterableT = TypeVar("_IterableT", bound=Iterable[str])
def consolidate_linker_args(args: _IterableT) -> _IterableT | str: ...
+23 -20
View File
@@ -36,26 +36,29 @@ class DistributionMetadata:
def get_name(self) -> str: ...
def get_version(self) -> str: ...
def get_fullname(self) -> str: ...
def get_author(self) -> str: ...
def get_author_email(self) -> str: ...
def get_maintainer(self) -> str: ...
def get_maintainer_email(self) -> str: ...
def get_contact(self) -> str: ...
def get_contact_email(self) -> str: ...
def get_url(self) -> str: ...
def get_license(self) -> str: ...
def get_licence(self) -> str: ...
def get_description(self) -> str: ...
def get_long_description(self) -> str: ...
def get_author(self) -> str | None: ...
def get_author_email(self) -> str | None: ...
def get_maintainer(self) -> str | None: ...
def get_maintainer_email(self) -> str | None: ...
def get_contact(self) -> str | None: ...
def get_contact_email(self) -> str | None: ...
def get_url(self) -> str | None: ...
def get_license(self) -> str | None: ...
get_licence = get_license
def get_description(self) -> str | None: ...
def get_long_description(self) -> str | None: ...
def get_keywords(self) -> str | list[str]: ...
def get_platforms(self) -> str | list[str]: ...
def set_keywords(self, value: str | Iterable[str]) -> None: ...
def get_platforms(self) -> str | list[str] | None: ...
def set_platforms(self, value: str | Iterable[str]) -> None: ...
def get_classifiers(self) -> str | list[str]: ...
def get_download_url(self) -> str: ...
def get_requires(self) -> list[str]: ...
def set_classifiers(self, value): ...
def get_download_url(self) -> str | None: ...
def get_requires(self) -> str | list[str]: ...
def set_requires(self, value: Iterable[str]) -> None: ...
def get_provides(self) -> list[str]: ...
def get_provides(self) -> str | list[str]: ...
def set_provides(self, value: Iterable[str]) -> None: ...
def get_obsoletes(self) -> list[str]: ...
def get_obsoletes(self) -> str | list[str]: ...
def set_obsoletes(self, value: Iterable[str]) -> None: ...
class Distribution:
@@ -72,8 +75,8 @@ class Distribution:
verbose: bool
dry_run: bool
help: bool
command_packages: list[str] | None
script_name: str | None
command_packages: str | list[str] | None
script_name: StrPath | None
script_args: list[str] | None
command_options: dict[str, dict[str, tuple[str, str]]]
dist_files: list[tuple[str, str, str]]
@@ -108,9 +111,9 @@ class Distribution:
# NOTE: Because this is private setuptools implementation and we don't re-expose all commands here,
# we're not overloading each and every command possibility.
@overload
def get_command_obj(self, command: str, create: Literal[1, True] = 1) -> Command: ...
def get_command_obj(self, command: str, create: Literal[True] = True) -> Command: ...
@overload
def get_command_obj(self, command: str, create: Literal[0, False]) -> Command | None: ...
def get_command_obj(self, command: str, create: Literal[False]) -> Command | None: ...
def get_command_class(self, command: str) -> type[Command]: ...
@overload
def reinitialize_command(self, command: str, reinit_subcommands: bool = False) -> Command: ...
@@ -1,3 +1,4 @@
from _typeshed import StrPath, Unused
from collections.abc import Iterable
from re import Pattern
from typing import Literal, overload
@@ -6,10 +7,10 @@ from typing import Literal, overload
class FileList:
allfiles: Iterable[str] | None
files: list[str]
def __init__(self, warn: None = None, debug_print: None = None) -> None: ...
def __init__(self, warn: Unused = None, debug_print: Unused = None) -> None: ...
def set_allfiles(self, allfiles: Iterable[str]) -> None: ...
def findall(self, dir: str = ...) -> None: ...
def debug_print(self, msg: str) -> None: ...
def findall(self, dir: StrPath = ...) -> None: ...
def debug_print(self, msg: object) -> None: ...
def append(self, item: str) -> None: ...
def extend(self, items: Iterable[str]) -> None: ...
def sort(self) -> None: ...
@@ -17,21 +18,21 @@ class FileList:
def process_template_line(self, line: str) -> None: ...
@overload
def include_pattern(
self, pattern: str, anchor: bool = True, prefix: str | None = None, is_regex: Literal[0, False] = 0
self, pattern: str, anchor: bool = True, prefix: str | None = None, is_regex: Literal[False] = False
) -> bool: ...
@overload
def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1]) -> bool: ...
@overload
def include_pattern(
self, pattern: str | Pattern[str], anchor: bool = True, prefix: str | None = None, is_regex: bool = False
self, pattern: str | Pattern[str], anchor: bool = True, prefix: str | None = None, *, is_regex: Literal[True]
) -> bool: ...
@overload
def include_pattern(self, pattern: str | Pattern[str], anchor: bool, prefix: str | None, is_regex: Literal[True]) -> bool: ...
@overload
def exclude_pattern(
self, pattern: str, anchor: bool = True, prefix: str | None = None, is_regex: Literal[False] = False
) -> bool: ...
@overload
def exclude_pattern(
self, pattern: str, anchor: bool = True, prefix: str | None = None, is_regex: Literal[0, False] = 0
self, pattern: str | Pattern[str], anchor: bool = True, prefix: str | None = None, *, is_regex: Literal[True]
) -> bool: ...
@overload
def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1]) -> bool: ...
@overload
def exclude_pattern(
self, pattern: str | Pattern[str], anchor: bool = True, prefix: str | None = None, is_regex: bool = False
) -> bool: ...
def exclude_pattern(self, pattern: str | Pattern[str], anchor: bool, prefix: str | None, is_regex: Literal[True]) -> bool: ...
@@ -1,7 +1,12 @@
from _typeshed import StrPath
from collections.abc import MutableSequence
from subprocess import _ENV
def spawn(
cmd: MutableSequence[str], search_path: bool = True, verbose: bool = False, dry_run: bool = False, env: _ENV | None = None
cmd: MutableSequence[bytes | StrPath],
search_path: bool = True,
verbose: bool = False,
dry_run: bool = False,
env: _ENV | None = None,
) -> None: ...
def find_executable(executable: str, path: str | None = None) -> str | None: ...
@@ -1,6 +1,6 @@
from _typeshed import StrPath, Unused
from collections.abc import Callable, Mapping
from typing import Literal
from _typeshed import GenericPath, StrPath, Unused
from collections.abc import Callable, Iterable, Mapping
from typing import AnyStr, Literal
from typing_extensions import TypeVarTuple, Unpack
_Ts = TypeVarTuple("_Ts")
@@ -11,9 +11,9 @@ def get_macosx_target_ver_from_syscfg(): ...
def get_macosx_target_ver(): ...
def split_version(s: str) -> list[int]: ...
def convert_path(pathname: StrPath) -> str: ...
def change_root(new_root: str, pathname: str) -> str: ...
def change_root(new_root: GenericPath[AnyStr], pathname: GenericPath[AnyStr]) -> AnyStr: ...
def check_environ() -> None: ...
def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ...
def subst_vars(s: str, local_vars: Mapping[str, object]) -> str: ...
def grok_environment_error(exc: object, prefix: str = "error: ") -> str: ...
def split_quoted(s: str) -> list[str]: ...
def execute(
@@ -25,7 +25,7 @@ def execute(
) -> None: ...
def strtobool(val: str) -> Literal[0, 1]: ...
def byte_compile(
py_files: list[str],
py_files: Iterable[str],
optimize: int = 0,
force: bool = False,
prefix: str | None = None,