From 2cd124936cbb6b9d54c0235e6518a66850dce28c Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 10 Mar 2025 22:41:51 -0400 Subject: [PATCH 1/3] Bump setuptools to 76.0.0 --- stubs/setuptools/METADATA.toml | 2 +- .../setuptools/distutils/compilers/C/base.pyi | 1 + .../distutils/compilers/C/errors.pyi | 1 + .../setuptools/distutils/compilers/C/msvc.pyi | 1 + .../setuptools/_distutils/_msvccompiler.pyi | 23 +-- .../setuptools/_distutils/ccompiler.pyi | 191 ++---------------- .../_distutils/compilers/C/base.pyi | 180 +++++++++++++++++ .../_distutils/compilers/C/errors.pyi | 7 + .../_distutils/compilers/C/msvc.pyi | 22 ++ .../setuptools/_distutils/errors.pyi | 18 +- 10 files changed, 240 insertions(+), 206 deletions(-) create mode 100644 stubs/setuptools/distutils/compilers/C/base.pyi create mode 100644 stubs/setuptools/distutils/compilers/C/errors.pyi create mode 100644 stubs/setuptools/distutils/compilers/C/msvc.pyi create mode 100644 stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi create mode 100644 stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi create mode 100644 stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi diff --git a/stubs/setuptools/METADATA.toml b/stubs/setuptools/METADATA.toml index b5e6c51d7221..f8c0ecb7c936 100644 --- a/stubs/setuptools/METADATA.toml +++ b/stubs/setuptools/METADATA.toml @@ -1,4 +1,4 @@ -version = "~=75.8.2" +version = "~=76.0.0" upstream_repository = "https://github.com/pypa/setuptools" extra_description = """\ Given that `pkg_resources` is typed since `setuptools >= 71.1`, \ diff --git a/stubs/setuptools/distutils/compilers/C/base.pyi b/stubs/setuptools/distutils/compilers/C/base.pyi new file mode 100644 index 000000000000..5e58ee9cbe68 --- /dev/null +++ b/stubs/setuptools/distutils/compilers/C/base.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.C.base import * diff --git a/stubs/setuptools/distutils/compilers/C/errors.pyi b/stubs/setuptools/distutils/compilers/C/errors.pyi new file mode 100644 index 000000000000..6cc2192bd587 --- /dev/null +++ b/stubs/setuptools/distutils/compilers/C/errors.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.C.errors import * diff --git a/stubs/setuptools/distutils/compilers/C/msvc.pyi b/stubs/setuptools/distutils/compilers/C/msvc.pyi new file mode 100644 index 000000000000..733c0ce32c3b --- /dev/null +++ b/stubs/setuptools/distutils/compilers/C/msvc.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.C.msvc import * diff --git a/stubs/setuptools/setuptools/_distutils/_msvccompiler.pyi b/stubs/setuptools/setuptools/_distutils/_msvccompiler.pyi index fb3046071af7..34d9735b0614 100644 --- a/stubs/setuptools/setuptools/_distutils/_msvccompiler.pyi +++ b/stubs/setuptools/setuptools/_distutils/_msvccompiler.pyi @@ -1,22 +1,3 @@ -from binascii import Incomplete -from typing import ClassVar, Final +from .compilers.C import msvc -from .ccompiler import CCompiler - -PLAT_SPEC_TO_RUNTIME: Final[dict[str, str]] - -class MSVCCompiler(CCompiler): - compiler_type: ClassVar[str] - executables: ClassVar[dict[Incomplete, Incomplete]] - src_extensions: ClassVar[list[str]] - res_extension: ClassVar[str] - obj_extension: ClassVar[str] - static_lib_extension: ClassVar[str] - shared_lib_extension: ClassVar[str] - shared_lib_format: ClassVar[str] - static_lib_format = shared_lib_format - exe_extension: ClassVar[str] - initialized: bool - def initialize(self, plat_name: str | None = None) -> None: ... - @property - def out_extensions(self) -> dict[str, str]: ... +MSVCCompiler = msvc.Compiler diff --git a/stubs/setuptools/setuptools/_distutils/ccompiler.pyi b/stubs/setuptools/setuptools/_distutils/ccompiler.pyi index dd0cddb919fb..cbb794e101a0 100644 --- a/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +++ b/stubs/setuptools/setuptools/_distutils/ccompiler.pyi @@ -1,180 +1,15 @@ -from _typeshed import BytesPath, StrPath, Unused -from collections.abc import Callable, Iterable, MutableSequence, Sequence -from typing import ClassVar, Literal, TypeVar, overload -from typing_extensions import TypeAlias, TypeVarTuple, Unpack +from .compilers.C import base +from .compilers.C.base import gen_lib_options, gen_preprocess_options, get_default_compiler, new_compiler, show_compilers +from .compilers.C.errors import CompileError, LinkError -_Macro: TypeAlias = tuple[str] | tuple[str, str | None] -_StrPathT = TypeVar("_StrPathT", bound=StrPath) -_BytesPathT = TypeVar("_BytesPathT", bound=BytesPath) -_Ts = TypeVarTuple("_Ts") +__all__ = [ + "CompileError", + "LinkError", + "gen_lib_options", + "gen_preprocess_options", + "get_default_compiler", + "new_compiler", + "show_compilers", +] -def gen_lib_options( - compiler: CCompiler, library_dirs: Iterable[str], runtime_library_dirs: Iterable[str], libraries: Iterable[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 -) -> CCompiler: ... -def show_compilers() -> None: ... - -class CCompiler: - src_extensions: ClassVar[list[str] | None] - obj_extension: ClassVar[str | None] - static_lib_extension: ClassVar[str | None] - shared_lib_extension: ClassVar[str | None] - static_lib_format: ClassVar[str | None] - shared_lib_format: ClassVar[str | None] - exe_extension: ClassVar[str | None] - language_map: ClassVar[dict[str, str]] - language_order: ClassVar[list[str]] - dry_run: bool - force: bool - verbose: bool - output_dir: str | None - macros: list[_Macro] - include_dirs: list[str] - libraries: list[str] - library_dirs: list[str] - runtime_library_dirs: list[str] - objects: list[str] - def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... - def add_include_dir(self, dir: str) -> None: ... - def set_include_dirs(self, dirs: list[str]) -> None: ... - def add_library(self, libname: str) -> None: ... - def set_libraries(self, libnames: list[str]) -> None: ... - def add_library_dir(self, dir: str) -> None: ... - def set_library_dirs(self, dirs: list[str]) -> None: ... - def add_runtime_library_dir(self, dir: str) -> None: ... - def set_runtime_library_dirs(self, dirs: list[str]) -> None: ... - def define_macro(self, name: str, value: str | None = None) -> None: ... - def undefine_macro(self, name: str) -> None: ... - 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: Iterable[str], lib: str, debug: bool = False) -> str | None: ... - def has_function( - self, - funcname: str, - includes: Iterable[str] | None = None, - include_dirs: list[str] | tuple[str, ...] | None = None, - libraries: 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, **kwargs: str) -> None: ... - def compile( - self, - sources: Sequence[StrPath], - output_dir: str | None = None, - macros: list[_Macro] | 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] | tuple[str, ...] | None = None, - ) -> list[str]: ... - def create_static_lib( - self, - objects: list[str] | tuple[str, ...], - output_libname: str, - output_dir: str | None = None, - debug: bool = False, - target_lang: str | None = None, - ) -> None: ... - def link( - self, - target_desc: str, - objects: list[str] | tuple[str, ...], - output_filename: str, - output_dir: 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: StrPath | None = None, - target_lang: str | None = None, - ) -> None: ... - def link_executable( - self, - objects: list[str] | tuple[str, ...], - output_progname: str, - output_dir: 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, - target_lang: str | None = None, - ) -> None: ... - def link_shared_lib( - self, - objects: list[str] | tuple[str, ...], - output_libname: str, - output_dir: 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: StrPath | None = None, - target_lang: str | None = None, - ) -> None: ... - def link_shared_object( - self, - objects: list[str] | tuple[str, ...], - output_filename: str, - output_dir: 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: StrPath | None = None, - target_lang: str | None = None, - ) -> None: ... - def preprocess( - self, - source: StrPath, - output_file: StrPath | None = None, - macros: list[_Macro] | None = None, - include_dirs: list[str] | tuple[str, ...] | None = None, - extra_preargs: list[str] | None = None, - extra_postargs: Iterable[str] | None = None, - ) -> None: ... - @overload - 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[True], output_dir: StrPath = "") -> str: ... - def library_filename( - self, libname: str, lib_type: str = "static", strip_dir: bool = False, output_dir: StrPath = "" - ) -> str: ... - def object_filenames( - 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[False] = False, output_dir: StrPath = "") -> str: ... - @overload - 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[bytes | StrPath]) -> None: ... - def mkpath(self, name: str, mode: int = 0o777) -> None: ... - @overload - def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ... - @overload - def move_file(self, src: BytesPath, dst: _BytesPathT) -> _BytesPathT | bytes: ... - def announce(self, msg: str, level: int = 1) -> None: ... - def warn(self, msg: str) -> None: ... - def debug_print(self, msg: str) -> None: ... +CCompiler = base.Compiler diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi new file mode 100644 index 000000000000..00389d22baec --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi @@ -0,0 +1,180 @@ +from _typeshed import BytesPath, StrPath, Unused +from collections.abc import Callable, Iterable, MutableSequence, Sequence +from typing import ClassVar, Literal, TypeVar, overload +from typing_extensions import TypeAlias, TypeVarTuple, Unpack + +_Macro: TypeAlias = tuple[str] | tuple[str, str | None] +_StrPathT = TypeVar("_StrPathT", bound=StrPath) +_BytesPathT = TypeVar("_BytesPathT", bound=BytesPath) +_Ts = TypeVarTuple("_Ts") + +def gen_lib_options( + compiler: Compiler, library_dirs: Iterable[str], runtime_library_dirs: Iterable[str], libraries: Iterable[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 +) -> Compiler: ... +def show_compilers() -> None: ... + +class Compiler: + src_extensions: ClassVar[list[str] | None] + obj_extension: ClassVar[str | None] + static_lib_extension: ClassVar[str | None] + shared_lib_extension: ClassVar[str | None] + static_lib_format: ClassVar[str | None] + shared_lib_format: ClassVar[str | None] + exe_extension: ClassVar[str | None] + language_map: ClassVar[dict[str, str]] + language_order: ClassVar[list[str]] + dry_run: bool + force: bool + verbose: bool + output_dir: str | None + macros: list[_Macro] + include_dirs: list[str] + libraries: list[str] + library_dirs: list[str] + runtime_library_dirs: list[str] + objects: list[str] + def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... + def add_include_dir(self, dir: str) -> None: ... + def set_include_dirs(self, dirs: list[str]) -> None: ... + def add_library(self, libname: str) -> None: ... + def set_libraries(self, libnames: list[str]) -> None: ... + def add_library_dir(self, dir: str) -> None: ... + def set_library_dirs(self, dirs: list[str]) -> None: ... + def add_runtime_library_dir(self, dir: str) -> None: ... + def set_runtime_library_dirs(self, dirs: list[str]) -> None: ... + def define_macro(self, name: str, value: str | None = None) -> None: ... + def undefine_macro(self, name: str) -> None: ... + 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: Iterable[str], lib: str, debug: bool = False) -> str | None: ... + def has_function( + self, + funcname: str, + includes: Iterable[str] | None = None, + include_dirs: list[str] | tuple[str, ...] | None = None, + libraries: 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, **kwargs: str) -> None: ... + def compile( + self, + sources: Sequence[StrPath], + output_dir: str | None = None, + macros: list[_Macro] | 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] | tuple[str, ...] | None = None, + ) -> list[str]: ... + def create_static_lib( + self, + objects: list[str] | tuple[str, ...], + output_libname: str, + output_dir: str | None = None, + debug: bool = False, + target_lang: str | None = None, + ) -> None: ... + def link( + self, + target_desc: str, + objects: list[str] | tuple[str, ...], + output_filename: str, + output_dir: 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: StrPath | None = None, + target_lang: str | None = None, + ) -> None: ... + def link_executable( + self, + objects: list[str] | tuple[str, ...], + output_progname: str, + output_dir: 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, + target_lang: str | None = None, + ) -> None: ... + def link_shared_lib( + self, + objects: list[str] | tuple[str, ...], + output_libname: str, + output_dir: 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: StrPath | None = None, + target_lang: str | None = None, + ) -> None: ... + def link_shared_object( + self, + objects: list[str] | tuple[str, ...], + output_filename: str, + output_dir: 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: StrPath | None = None, + target_lang: str | None = None, + ) -> None: ... + def preprocess( + self, + source: StrPath, + output_file: StrPath | None = None, + macros: list[_Macro] | None = None, + include_dirs: list[str] | tuple[str, ...] | None = None, + extra_preargs: list[str] | None = None, + extra_postargs: Iterable[str] | None = None, + ) -> None: ... + @overload + 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[True], output_dir: StrPath = "") -> str: ... + def library_filename( + self, libname: str, lib_type: str = "static", strip_dir: bool = False, output_dir: StrPath = "" + ) -> str: ... + def object_filenames( + 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[False] = False, output_dir: StrPath = "") -> str: ... + @overload + 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[bytes | StrPath]) -> None: ... + def mkpath(self, name: str, mode: int = 0o777) -> None: ... + @overload + def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ... + @overload + def move_file(self, src: BytesPath, dst: _BytesPathT) -> _BytesPathT | bytes: ... + def announce(self, msg: str, level: int = 1) -> None: ... + def warn(self, msg: str) -> None: ... + def debug_print(self, msg: str) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi new file mode 100644 index 000000000000..3b250ce573bf --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi @@ -0,0 +1,7 @@ +class Error(Exception): ... +class PreprocessError(Error): ... +class CompileError(Error): ... +class LibError(Error): ... +class LinkError(Error): ... +class UnknownFileError(Error): ... +class UnknownFileType(Error): ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi new file mode 100644 index 000000000000..5dbee069b328 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi @@ -0,0 +1,22 @@ +from binascii import Incomplete +from typing import ClassVar, Final + +from . import base + +PLAT_SPEC_TO_RUNTIME: Final[dict[str, str]] + +class Compiler(base.Compiler): + compiler_type: ClassVar[str] + executables: ClassVar[dict[Incomplete, Incomplete]] + src_extensions: ClassVar[list[str]] + res_extension: ClassVar[str] + obj_extension: ClassVar[str] + static_lib_extension: ClassVar[str] + shared_lib_extension: ClassVar[str] + shared_lib_format: ClassVar[str] + static_lib_format = shared_lib_format + exe_extension: ClassVar[str] + initialized: bool + def initialize(self, plat_name: str | None = None) -> None: ... + @property + def out_extensions(self) -> dict[str, str]: ... diff --git a/stubs/setuptools/setuptools/_distutils/errors.pyi b/stubs/setuptools/setuptools/_distutils/errors.pyi index e483362bfbf1..79eb7f7baa0f 100644 --- a/stubs/setuptools/setuptools/_distutils/errors.pyi +++ b/stubs/setuptools/setuptools/_distutils/errors.pyi @@ -1,3 +1,15 @@ +from .compilers.C.errors import ( + CompileError as CompileError, + Error as _Error, + LibError as LibError, + LinkError as LinkError, + PreprocessError as PreprocessError, + UnknownFileType as _UnknownFileType, +) + +CCompilerError = _Error +UnknownFileError = _UnknownFileType + class DistutilsError(Exception): ... class DistutilsModuleError(DistutilsError): ... class DistutilsClassError(DistutilsError): ... @@ -11,9 +23,3 @@ class DistutilsExecError(DistutilsError): ... class DistutilsInternalError(DistutilsError): ... class DistutilsTemplateError(DistutilsError): ... class DistutilsByteCompileError(DistutilsError): ... -class CCompilerError(Exception): ... -class PreprocessError(CCompilerError): ... -class CompileError(CCompilerError): ... -class LibError(CCompilerError): ... -class LinkError(CCompilerError): ... -class UnknownFileError(CCompilerError): ... From 4cc1b9e6c3e29f36e644fba33a467850968644b0 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 11 Mar 2025 19:42:03 -0400 Subject: [PATCH 2/3] Fix stubtest issues --- .../setuptools/@tests/stubtest_allowlist.txt | 10 ++--- .../_distutils/compilers/C/base.pyi | 40 +++++++++++++------ .../_distutils/compilers/C/errors.pyi | 1 - .../_distutils/compilers/C/msvc.pyi | 10 +++-- 4 files changed, 37 insertions(+), 24 deletions(-) diff --git a/stubs/setuptools/@tests/stubtest_allowlist.txt b/stubs/setuptools/@tests/stubtest_allowlist.txt index 4ab351051980..ef8af309865d 100644 --- a/stubs/setuptools/@tests/stubtest_allowlist.txt +++ b/stubs/setuptools/@tests/stubtest_allowlist.txt @@ -2,6 +2,9 @@ setuptools.modified.newer_pairwise_group setuptools._distutils._modified.newer_pairwise_group +# Runtime initializes to None, but this really should never be None when used +setuptools._distutils.compilers.C.base.Compiler.compiler_type + # Dynamically created in __init__ setuptools._distutils.dist.Distribution.get_name setuptools._distutils.dist.Distribution.get_version @@ -28,13 +31,6 @@ setuptools._distutils.dist.Distribution.get_obsoletes # Missing objects from setuptools._distutils setuptools._distutils.archive_util.ARCHIVE_FORMATS setuptools._distutils.archive_util.check_archive_formats -setuptools._distutils.ccompiler.CCompiler.EXECUTABLE -setuptools._distutils.ccompiler.CCompiler.SHARED_LIBRARY -setuptools._distutils.ccompiler.CCompiler.SHARED_OBJECT -setuptools._distutils.ccompiler.CCompiler.compiler_type -setuptools._distutils.ccompiler.CCompiler.out_extensions -setuptools._distutils.ccompiler.CCompiler.set_executable -setuptools._distutils.ccompiler.compiler_class setuptools._distutils.cmd.Command.dump_options setuptools._distutils.command.build_clib.show_compilers setuptools._distutils.command.build_ext.extension_name_re diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi index 00389d22baec..f33e86e6ba9f 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi @@ -1,6 +1,6 @@ -from _typeshed import BytesPath, StrPath, Unused +from _typeshed import BytesPath, Incomplete, StrPath, Unused from collections.abc import Callable, Iterable, MutableSequence, Sequence -from typing import ClassVar, Literal, TypeVar, overload +from typing import ClassVar, Final, Literal, TypeVar, overload from typing_extensions import TypeAlias, TypeVarTuple, Unpack _Macro: TypeAlias = tuple[str] | tuple[str, str | None] @@ -8,17 +8,12 @@ _StrPathT = TypeVar("_StrPathT", bound=StrPath) _BytesPathT = TypeVar("_BytesPathT", bound=BytesPath) _Ts = TypeVarTuple("_Ts") -def gen_lib_options( - compiler: Compiler, library_dirs: Iterable[str], runtime_library_dirs: Iterable[str], libraries: Iterable[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 -) -> Compiler: ... -def show_compilers() -> None: ... - class Compiler: + compiler_type: ClassVar[str] + executables: ClassVar[dict[str, Incomplete]] + + # Subclasses that rely on the standard filename generation methods + # implemented below should override these src_extensions: ClassVar[list[str] | None] obj_extension: ClassVar[str | None] static_lib_extension: ClassVar[str | None] @@ -26,6 +21,7 @@ class Compiler: static_lib_format: ClassVar[str | None] shared_lib_format: ClassVar[str | None] exe_extension: ClassVar[str | None] + language_map: ClassVar[dict[str, str]] language_order: ClassVar[list[str]] dry_run: bool @@ -38,6 +34,10 @@ class Compiler: library_dirs: list[str] runtime_library_dirs: list[str] objects: list[str] + + SHARED_OBJECT: Final = "shared_object" + SHARED_LIBRARY: Final = "shared_library" + EXECUTABLE: Final = "executable" def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... def add_include_dir(self, dir: str) -> None: ... def set_include_dirs(self, dirs: list[str]) -> None: ... @@ -65,6 +65,7 @@ class Compiler: def library_option(self, lib: str) -> str: ... def runtime_library_dir_option(self, dir: str) -> str: ... def set_executables(self, **kwargs: str) -> None: ... + def set_executable(self, key: str, value) -> None: ... def compile( self, sources: Sequence[StrPath], @@ -159,6 +160,8 @@ class Compiler: def library_filename( self, libname: str, lib_type: str = "static", strip_dir: bool = False, output_dir: StrPath = "" ) -> str: ... + @property + def out_extensions(self) -> dict[str, str]: ... def object_filenames( self, source_filenames: Iterable[StrPath], strip_dir: bool = False, output_dir: StrPath | None = "" ) -> list[str]: ... @@ -178,3 +181,16 @@ class Compiler: def announce(self, msg: str, level: int = 1) -> None: ... def warn(self, msg: str) -> None: ... def debug_print(self, msg: str) -> None: ... + +def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str: ... + +compiler_class: dict[str, tuple[str, str, str]] + +def show_compilers() -> None: ... +def new_compiler( + plat: str | None = None, compiler: str | None = None, verbose: bool = False, dry_run: bool = False, force: bool = False +) -> Compiler: ... +def gen_preprocess_options(macros: Iterable[_Macro], include_dirs: Iterable[str]) -> list[str]: ... +def gen_lib_options( + compiler: Compiler, library_dirs: Iterable[str], runtime_library_dirs: Iterable[str], libraries: Iterable[str] +) -> list[str]: ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi index 3b250ce573bf..5c3cf1e9f0c6 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi @@ -3,5 +3,4 @@ class PreprocessError(Error): ... class CompileError(Error): ... class LibError(Error): ... class LinkError(Error): ... -class UnknownFileError(Error): ... class UnknownFileType(Error): ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi index 5dbee069b328..2b419aa986d7 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi @@ -1,4 +1,4 @@ -from binascii import Incomplete +from _typeshed import Incomplete from typing import ClassVar, Final from . import base @@ -7,14 +7,16 @@ PLAT_SPEC_TO_RUNTIME: Final[dict[str, str]] class Compiler(base.Compiler): compiler_type: ClassVar[str] - executables: ClassVar[dict[Incomplete, Incomplete]] + executables: ClassVar[dict[str, Incomplete]] src_extensions: ClassVar[list[str]] res_extension: ClassVar[str] obj_extension: ClassVar[str] static_lib_extension: ClassVar[str] shared_lib_extension: ClassVar[str] - shared_lib_format: ClassVar[str] - static_lib_format = shared_lib_format + # This was accidentally removed upstream and should be back pretty soon. + # shared_lib_format: ClassVar[str] + # static_lib_format = shared_lib_format + static_lib_format: ClassVar[str] exe_extension: ClassVar[str] initialized: bool def initialize(self, plat_name: str | None = None) -> None: ... From 1f8bfbc37692710fcf39ab112168d266420a7c33 Mon Sep 17 00:00:00 2001 From: Avasam Date: Tue, 11 Mar 2025 20:06:45 -0400 Subject: [PATCH 3/3] Interesting __all__ interraction --- stubs/setuptools/distutils/ccompiler.pyi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/stubs/setuptools/distutils/ccompiler.pyi b/stubs/setuptools/distutils/ccompiler.pyi index e1770cfdf09d..d8f1af11ef33 100644 --- a/stubs/setuptools/distutils/ccompiler.pyi +++ b/stubs/setuptools/distutils/ccompiler.pyi @@ -1 +1,12 @@ from setuptools._distutils.ccompiler import * +from setuptools._distutils.ccompiler import CCompiler as CCompiler + +__all__ = [ + "CompileError", + "LinkError", + "gen_lib_options", + "gen_preprocess_options", + "get_default_compiler", + "new_compiler", + "show_compilers", +]