From 271ac82a0ecb654be9d583ae9f7b600ec7a76c75 Mon Sep 17 00:00:00 2001 From: donbarbos Date: Sun, 8 Feb 2026 14:48:48 +0400 Subject: [PATCH 1/3] [setuptools] Add missing compilers --- .../setuptools/@tests/stubtest_allowlist.txt | 6 +- .../distutils/compilers/C/cygwin.pyi | 1 + .../setuptools/distutils/compilers/C/zos.pyi | 1 + .../setuptools/distutils/cygwinccompiler.pyi | 1 + stubs/setuptools/distutils/version.pyi | 1 + stubs/setuptools/distutils/zosccompiler.pyi | 1 + .../_distutils/compilers/C/base.pyi | 8 ++- .../_distutils/compilers/C/cygwin.pyi | 68 +++++++++++++++++++ .../_distutils/compilers/C/msvc.pyi | 1 + .../setuptools/_distutils/compilers/C/zos.pyi | 27 ++++++++ .../setuptools/_distutils/cygwinccompiler.pyi | 28 ++++++++ .../setuptools/_distutils/version.pyi | 35 ++++++++++ .../setuptools/_distutils/zosccompiler.pyi | 3 + 13 files changed, 177 insertions(+), 4 deletions(-) create mode 100644 stubs/setuptools/distutils/compilers/C/cygwin.pyi create mode 100644 stubs/setuptools/distutils/compilers/C/zos.pyi create mode 100644 stubs/setuptools/distutils/cygwinccompiler.pyi create mode 100644 stubs/setuptools/distutils/version.pyi create mode 100644 stubs/setuptools/distutils/zosccompiler.pyi create mode 100644 stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi create mode 100644 stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi create mode 100644 stubs/setuptools/setuptools/_distutils/cygwinccompiler.pyi create mode 100644 stubs/setuptools/setuptools/_distutils/version.pyi create mode 100644 stubs/setuptools/setuptools/_distutils/zosccompiler.pyi diff --git a/stubs/setuptools/@tests/stubtest_allowlist.txt b/stubs/setuptools/@tests/stubtest_allowlist.txt index 500a32862d49..09c4d676af8d 100644 --- a/stubs/setuptools/@tests/stubtest_allowlist.txt +++ b/stubs/setuptools/@tests/stubtest_allowlist.txt @@ -70,16 +70,16 @@ setuptools._distutils.command.install_headers setuptools._distutils.compat.numpy setuptools._distutils.compat.py39 setuptools._distutils.core -setuptools._distutils.cygwinccompiler setuptools._distutils.debug setuptools._distutils.dir_util setuptools._distutils.fancy_getopt setuptools._distutils.file_util setuptools._distutils.log setuptools._distutils.text_file -setuptools._distutils.version +setuptools._distutils.version.Version._cmp # abstract method +setuptools._distutils.version.Version.parse # abstract method +setuptools._distutils.version.suppress_known_deprecation setuptools._distutils.versionpredicate -setuptools._distutils.zosccompiler # Reexported from setuptools._distutils; problems should be fixed there distutils\..+ diff --git a/stubs/setuptools/distutils/compilers/C/cygwin.pyi b/stubs/setuptools/distutils/compilers/C/cygwin.pyi new file mode 100644 index 000000000000..9b7a9d9e0ca0 --- /dev/null +++ b/stubs/setuptools/distutils/compilers/C/cygwin.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.C.cygwin import * diff --git a/stubs/setuptools/distutils/compilers/C/zos.pyi b/stubs/setuptools/distutils/compilers/C/zos.pyi new file mode 100644 index 000000000000..921cd46b47ef --- /dev/null +++ b/stubs/setuptools/distutils/compilers/C/zos.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.C.zos import * diff --git a/stubs/setuptools/distutils/cygwinccompiler.pyi b/stubs/setuptools/distutils/cygwinccompiler.pyi new file mode 100644 index 000000000000..1784f31d60fc --- /dev/null +++ b/stubs/setuptools/distutils/cygwinccompiler.pyi @@ -0,0 +1 @@ +from setuptools._distutils.cygwinccompiler import * diff --git a/stubs/setuptools/distutils/version.pyi b/stubs/setuptools/distutils/version.pyi new file mode 100644 index 000000000000..1cac35f20653 --- /dev/null +++ b/stubs/setuptools/distutils/version.pyi @@ -0,0 +1 @@ +from setuptools._distutils.version import * diff --git a/stubs/setuptools/distutils/zosccompiler.pyi b/stubs/setuptools/distutils/zosccompiler.pyi new file mode 100644 index 000000000000..b69c6320e43b --- /dev/null +++ b/stubs/setuptools/distutils/zosccompiler.pyi @@ -0,0 +1 @@ +from setuptools._distutils.zosccompiler import * diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi index 8f51b6790596..3211f3b48958 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi @@ -2,7 +2,7 @@ from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused from collections.abc import Callable, Iterable, MutableSequence, Sequence from subprocess import _ENV from typing import ClassVar, Final, Literal, TypeVar, overload -from typing_extensions import TypeAlias, TypeVarTuple, Unpack +from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated _Macro: TypeAlias = tuple[str] | tuple[str, str | None] _StrPathT = TypeVar("_StrPathT", bound=StrPath) @@ -54,6 +54,12 @@ class Compiler: 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: ... + @overload + def has_function( + self, funcname: str, libraries: list[str] | None = None, library_dirs: list[str] | tuple[str, ...] | None = None + ) -> bool: ... + @overload + @deprecated("The `includes`, `include_dirs` parameters are deprecated.") def has_function( self, funcname: str, diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi new file mode 100644 index 000000000000..f689ed12b678 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi @@ -0,0 +1,68 @@ +from _typeshed import Incomplete, StrPath +from collections.abc import Callable, Iterable +from shlex import _ShlexInstream +from typing import ClassVar, Final, Literal, NoReturn +from typing_extensions import deprecated + +from ...version import LooseVersion +from . import unix + +def get_msvcr() -> list[str]: ... + +class Compiler(unix.Compiler): + compiler_type: ClassVar[str] + obj_extension: ClassVar[str] + static_lib_extension: ClassVar[str] + shared_lib_extension: ClassVar[str] + dylib_lib_extension: ClassVar[str] + static_lib_format: ClassVar[str] + shared_lib_format: ClassVar[str] + dylib_lib_format: ClassVar[str] + exe_extension: ClassVar[str] + cc: str + cxx: str + linker_dll: str + linker_dll_cxx: str + dll_libraries: list[str] + def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... + @property + @deprecated( + "gcc_version attribute of CygwinCCompiler is deprecated. " + "Instead of returning actual gcc version a fixed value 11.2.0 is returned." + ) + def gcc_version(self) -> LooseVersion: ... + # `objects` and `libraries` uses list methods + def link( + self, + target_desc: str, + objects: list[str], # type: ignore[override] + output_filename: str, + output_dir: str | None = None, + libraries: list[str] | None = None, # type: ignore[override] + 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: ... + # cygwin doesn't support rpath. writes a warning and returns an empty list + def runtime_library_dir_option(self, dir: str) -> list[Incomplete]: ... # type: ignore[override] + @property + def out_extensions(self) -> dict[str, str]: ... + +class MinGW32Compiler(Compiler): + compiler_type: ClassVar[str] + def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... + def runtime_library_dir_option(self, dir: str) -> NoReturn: ... + +CONFIG_H_OK: Final = "ok" +CONFIG_H_NOTOK: Final = "not ok" +CONFIG_H_UNCERTAIN: Final = "uncertain" + +def check_config_h() -> tuple[Literal["ok", "not ok", "uncertain"], str]: ... +def is_cygwincc(cc: str | _ShlexInstream) -> bool: ... + +get_versions: Callable[[], tuple[LooseVersion | None, ...]] | None diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi index ad2f16eb7d14..a882dd2c57ed 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi @@ -16,6 +16,7 @@ class Compiler(base.Compiler): static_lib_format = shared_lib_format exe_extension: ClassVar[str] initialized: bool + plat_name: str | None def initialize(self, plat_name: str | None = None) -> None: ... @property def out_extensions(self) -> dict[str, str]: ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi new file mode 100644 index 000000000000..6a5a4a28486b --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi @@ -0,0 +1,27 @@ +from _typeshed import StrPath +from collections.abc import Iterable +from typing import ClassVar, Literal + +from . import unix + +class Compiler(unix.Compiler): + src_extensions: ClassVar[list[str]] + zos_compiler: Literal["ibm-openxl", "ibm-xlclang", "ibm-xlc"] + def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... + def runtime_library_dir_option(self, dir: str) -> str: ... + 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: ... diff --git a/stubs/setuptools/setuptools/_distutils/cygwinccompiler.pyi b/stubs/setuptools/setuptools/_distutils/cygwinccompiler.pyi new file mode 100644 index 000000000000..db2a886c6882 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/cygwinccompiler.pyi @@ -0,0 +1,28 @@ +from collections.abc import Callable + +from .compilers.C import cygwin +from .compilers.C.cygwin import ( + CONFIG_H_NOTOK as CONFIG_H_NOTOK, + CONFIG_H_OK as CONFIG_H_OK, + CONFIG_H_UNCERTAIN as CONFIG_H_UNCERTAIN, + check_config_h as check_config_h, + get_msvcr as get_msvcr, + is_cygwincc as is_cygwincc, +) +from .version import LooseVersion + +__all__ = [ + "CONFIG_H_NOTOK", + "CONFIG_H_OK", + "CONFIG_H_UNCERTAIN", + "CygwinCCompiler", + "Mingw32CCompiler", + "check_config_h", + "get_msvcr", + "is_cygwincc", +] + +CygwinCCompiler = cygwin.Compiler +Mingw32CCompiler = cygwin.MinGW32Compiler + +get_versions: Callable[[], tuple[LooseVersion | None, ...]] | None diff --git a/stubs/setuptools/setuptools/_distutils/version.pyi b/stubs/setuptools/setuptools/_distutils/version.pyi new file mode 100644 index 000000000000..94b0512e37f5 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/version.pyi @@ -0,0 +1,35 @@ +from abc import abstractmethod +from re import Pattern +from typing_extensions import Self, deprecated + +@deprecated("The `Version` class is deprecated. Use `packaging.version` instead.") +class Version: + def __eq__(self, other: object) -> bool: ... + def __lt__(self, other: Self | str) -> bool: ... + def __le__(self, other: Self | str) -> bool: ... + def __gt__(self, other: Self | str) -> bool: ... + def __ge__(self, other: Self | str) -> bool: ... + @abstractmethod + def __init__(self, vstring: str | None = None) -> None: ... + @abstractmethod + def parse(self, vstring: str) -> Self: ... + @abstractmethod + def _cmp(self, other: Self | str) -> bool: ... + +@deprecated("The `StrictVersion` class is deprecated. Use `packaging.version` instead.") +class StrictVersion(Version): + version_re: Pattern[str] + version: tuple[int, int, int] + prerelease: tuple[str, int] | None + def __init__(self, vstring: str | None = None) -> None: ... + def parse(self, vstring: str) -> Self: ... + def _cmp(self, other: Self | str) -> bool: ... + +@deprecated("The `LooseVersion` class is deprecated. Use `packaging.version` instead.") +class LooseVersion(Version): + component_re: Pattern[str] + vstring: str + version: tuple[str | int, ...] + def __init__(self, vstring: str | None = None) -> None: ... + def parse(self, vstring: str) -> Self: ... + def _cmp(self, other: Self | str) -> bool: ... diff --git a/stubs/setuptools/setuptools/_distutils/zosccompiler.pyi b/stubs/setuptools/setuptools/_distutils/zosccompiler.pyi new file mode 100644 index 000000000000..e49630ac6ed8 --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/zosccompiler.pyi @@ -0,0 +1,3 @@ +from .compilers.C import zos + +zOSCCompiler = zos.Compiler From 430ba4c6841ae0ba67a60447148c7022d75cc1bb Mon Sep 17 00:00:00 2001 From: donbarbos Date: Sun, 8 Feb 2026 23:08:35 +0400 Subject: [PATCH 2/3] Mark empty list as `list[Never]` --- .../setuptools/_distutils/compilers/C/cygwin.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi index f689ed12b678..5d10eafeaa1e 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi @@ -1,8 +1,8 @@ -from _typeshed import Incomplete, StrPath +from _typeshed import StrPath from collections.abc import Callable, Iterable from shlex import _ShlexInstream from typing import ClassVar, Final, Literal, NoReturn -from typing_extensions import deprecated +from typing_extensions import Never, deprecated from ...version import LooseVersion from . import unix @@ -48,8 +48,8 @@ class Compiler(unix.Compiler): build_temp: StrPath | None = None, target_lang: str | None = None, ) -> None: ... - # cygwin doesn't support rpath. writes a warning and returns an empty list - def runtime_library_dir_option(self, dir: str) -> list[Incomplete]: ... # type: ignore[override] + # cygwin doesn't support rpath; prints a warning and returns an empty list + def runtime_library_dir_option(self, dir: str) -> list[Never]: ... # type: ignore[override] @property def out_extensions(self) -> dict[str, str]: ... From 1d8652afa4cdb03150544fd8bf58951e3fc946fb Mon Sep 17 00:00:00 2001 From: donbarbos Date: Mon, 9 Feb 2026 19:02:22 +0400 Subject: [PATCH 3/3] remove dry_run --- stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi | 4 ++-- stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi index 5d10eafeaa1e..814209f3d25c 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi @@ -24,7 +24,7 @@ class Compiler(unix.Compiler): linker_dll: str linker_dll_cxx: str dll_libraries: list[str] - def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... + def __init__(self, verbose: bool = False, force: bool = False) -> None: ... @property @deprecated( "gcc_version attribute of CygwinCCompiler is deprecated. " @@ -55,7 +55,7 @@ class Compiler(unix.Compiler): class MinGW32Compiler(Compiler): compiler_type: ClassVar[str] - def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... + def __init__(self, verbose: bool = False, force: bool = False) -> None: ... def runtime_library_dir_option(self, dir: str) -> NoReturn: ... CONFIG_H_OK: Final = "ok" diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi index 6a5a4a28486b..d948cbbf8056 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi @@ -7,7 +7,7 @@ from . import unix class Compiler(unix.Compiler): src_extensions: ClassVar[list[str]] zos_compiler: Literal["ibm-openxl", "ibm-xlclang", "ibm-xlc"] - def __init__(self, verbose: bool = False, dry_run: bool = False, force: bool = False) -> None: ... + def __init__(self, verbose: bool = False, force: bool = False) -> None: ... def runtime_library_dir_option(self, dir: str) -> str: ... def link( self,