diff --git a/stubs/setuptools/@tests/stubtest_allowlist.txt b/stubs/setuptools/@tests/stubtest_allowlist.txt index ec19bc003004..f1daacd06921 100644 --- a/stubs/setuptools/@tests/stubtest_allowlist.txt +++ b/stubs/setuptools/@tests/stubtest_allowlist.txt @@ -1,9 +1,6 @@ # Is a functools.partial, so stubtest says "is not a function" 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 @@ -37,7 +34,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.dir_util.SkipRepeatAbsolutePaths.instance setuptools._distutils.dist.fix_help_options setuptools._distutils.extension.read_setup_file setuptools._distutils.filelist.findall @@ -53,10 +49,10 @@ setuptools._distutils.sysconfig.parse_config_h setuptools._distutils.sysconfig.parse_makefile setuptools._distutils.sysconfig.project_base setuptools._distutils.sysconfig.python_build -setuptools._distutils.util.MACOSX_VERSION_VAR # Missing submodules from setuptools._distutils # (Many of these may be implementation details, +# in an already private vendored module, # but they can be added if people ask for them) setuptools._distutils.command.__all__ setuptools._distutils.command.bdist_dumb @@ -66,11 +62,12 @@ setuptools._distutils.command.clean setuptools._distutils.command.config setuptools._distutils.command.install_egg_info setuptools._distutils.command.install_headers -setuptools._distutils.compat.numpy -setuptools._distutils.compat.py39 +setuptools._distutils.compat.* setuptools._distutils.core 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.Version._cmp # abstract method @@ -85,4 +82,3 @@ distutils\..+ setuptools.config._validate_pyproject.* setuptools.compat.* setuptools.command.build_py.build_py.existing_egg_info_dir -.+?\.tests.* diff --git a/stubs/setuptools/METADATA.toml b/stubs/setuptools/METADATA.toml index 2354f4fa48e2..f7ba41591377 100644 --- a/stubs/setuptools/METADATA.toml +++ b/stubs/setuptools/METADATA.toml @@ -1,4 +1,4 @@ -version = "83.0.*" +version = "84.0.*" upstream-repository = "https://github.com/pypa/setuptools" extra-description = """\ Given that `pkg_resources` is typed since `setuptools >= 71.1`, \ @@ -11,6 +11,9 @@ ci-platforms = ["linux", "win32"] stubtest-dependencies = ["more_itertools", "tomli"] # Stubtest fails on trying to run mypy on the source files rather than our stubs -[mypy-tests.distutils] +[mypy-tests.distutils1] module-name = "setuptools._distutils.compilers.C.*" values = { ignore_errors = true } +[mypy-tests.distutils2] +module-name = "setuptools._distutils.compilers.platform.detect" +values = { ignore_errors = true } diff --git a/stubs/setuptools/distutils/compat/__init__.pyi b/stubs/setuptools/distutils/compat/__init__.pyi deleted file mode 100644 index bbcbf9cc1f7a..000000000000 --- a/stubs/setuptools/distutils/compat/__init__.pyi +++ /dev/null @@ -1 +0,0 @@ -from setuptools._distutils.compat import * diff --git a/stubs/setuptools/distutils/compilers/errors.pyi b/stubs/setuptools/distutils/compilers/errors.pyi new file mode 100644 index 000000000000..ab573602be36 --- /dev/null +++ b/stubs/setuptools/distutils/compilers/errors.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.errors import * diff --git a/stubs/setuptools/distutils/compilers/platform/detect.pyi b/stubs/setuptools/distutils/compilers/platform/detect.pyi new file mode 100644 index 000000000000..aaf32add0a26 --- /dev/null +++ b/stubs/setuptools/distutils/compilers/platform/detect.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.platform.detect import * diff --git a/stubs/setuptools/distutils/compilers/platform/macos.pyi b/stubs/setuptools/distutils/compilers/platform/macos.pyi new file mode 100644 index 000000000000..5d87f38778dd --- /dev/null +++ b/stubs/setuptools/distutils/compilers/platform/macos.pyi @@ -0,0 +1 @@ +from setuptools._distutils.compilers.platform.macos import * diff --git a/stubs/setuptools/setuptools/_distutils/ccompiler.pyi b/stubs/setuptools/setuptools/_distutils/ccompiler.pyi index cbb794e101a0..f63dfd6e9ec4 100644 --- a/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +++ b/stubs/setuptools/setuptools/_distutils/ccompiler.pyi @@ -1,5 +1,5 @@ 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.base import gen_lib_options, gen_preprocess_options, get_default_compiler, new_compiler from .compilers.C.errors import CompileError, LinkError __all__ = [ @@ -13,3 +13,5 @@ __all__ = [ ] CCompiler = base.Compiler + +def show_compilers() -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/cmd.pyi b/stubs/setuptools/setuptools/_distutils/cmd.pyi index 879a0858d97d..272bf0ba7c0c 100644 --- a/stubs/setuptools/setuptools/_distutils/cmd.pyi +++ b/stubs/setuptools/setuptools/_distutils/cmd.pyi @@ -1,7 +1,7 @@ from _typeshed import BytesPath, StrOrBytesPath, StrPath, Unused from abc import abstractmethod -from collections.abc import Callable, MutableSequence, Sequence -from typing import Any, ClassVar, Literal, TypeVar, overload +from collections.abc import Callable, Sequence +from typing import Any, ClassVar, TypeVar, overload from typing_extensions import TypeVarTuple, Unpack from .dist import Distribution @@ -20,6 +20,10 @@ class Command: list[tuple[str, str, str]] | list[tuple[str, str | None, str]] ] + verbose: bool + force: bool | None + help: bool + finalized: bool def __init__(self, dist: Distribution) -> None: ... def ensure_finalized(self) -> None: ... @abstractmethod @@ -89,10 +93,7 @@ class Command: @overload def move_file(self, src: BytesPath, dst: _BytesPathT, level: Unused = 1) -> _BytesPathT | bytes: ... - @overload - def spawn(self, cmd: Sequence[StrOrBytesPath], search_path: Literal[False], level: Unused = 1) -> None: ... - @overload - def spawn(self, cmd: MutableSequence[bytes | StrPath], search_path: Literal[True] = True, level: Unused = 1) -> None: ... + def spawn(self, cmd: Sequence[StrOrBytesPath], search_path: Unused = True, level: Unused = 1) -> None: ... @overload def make_archive( diff --git a/stubs/setuptools/setuptools/_distutils/command/build_ext.pyi b/stubs/setuptools/setuptools/_distutils/command/build_ext.pyi index a37eb6d17c55..91a7ba47b1db 100644 --- a/stubs/setuptools/setuptools/_distutils/command/build_ext.pyi +++ b/stubs/setuptools/setuptools/_distutils/command/build_ext.pyi @@ -2,6 +2,7 @@ from _typeshed import Incomplete, Unused from collections.abc import Callable from typing import ClassVar +from ..ccompiler import CCompiler from ..cmd import Command from ..extension import Extension @@ -11,27 +12,27 @@ class build_ext(Command): 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]]]] - extensions: Incomplete - build_lib: Incomplete - plat_name: Incomplete - build_temp: Incomplete + extensions: list[Extension] | None + build_lib: str + plat_name: str + build_temp: str inplace: bool - package: Incomplete - include_dirs: Incomplete + package: str | None + include_dirs: list[str] define: Incomplete undef: Incomplete - libraries: Incomplete - library_dirs: Incomplete - rpath: Incomplete + libraries: list[str] + library_dirs: list[str] + rpath: list[str] link_objects: Incomplete debug: Incomplete - force: Incomplete - compiler: Incomplete + force: bool | None + compiler: str | CCompiler | None swig: Incomplete swig_cpp: Incomplete - swig_opts: Incomplete + swig_opts: list[str] user: Incomplete - parallel: Incomplete + parallel: int | None def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... def run(self) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/command/install.pyi b/stubs/setuptools/setuptools/_distutils/command/install.pyi index 77d083545d05..02d63c8f7518 100644 --- a/stubs/setuptools/setuptools/_distutils/command/install.pyi +++ b/stubs/setuptools/setuptools/_distutils/command/install.pyi @@ -13,8 +13,8 @@ class install(Command): exec_prefix: Incomplete home: str | None user: bool - install_base: Incomplete - install_platbase: Incomplete + install_base: str | None + install_platbase: str | None root: str | None install_purelib: str | None install_platlib: str | None diff --git a/stubs/setuptools/setuptools/_distutils/compat/__init__.pyi b/stubs/setuptools/setuptools/_distutils/compat/__init__.pyi deleted file mode 100644 index 7325c194f699..000000000000 --- a/stubs/setuptools/setuptools/_distutils/compat/__init__.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from collections.abc import Iterable -from typing import TypeVar - -_IterableT = TypeVar("_IterableT", bound=Iterable[str]) - -def consolidate_linker_args(args: _IterableT) -> _IterableT | str: ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi index 041c2ef772c0..05fb8399721e 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi @@ -1,5 +1,5 @@ from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused -from collections.abc import Callable, Iterable, MutableSequence, Sequence +from collections.abc import Callable, Iterable, Sequence from subprocess import _ENV from typing import ClassVar, Final, Literal, TypeAlias, TypeVar, overload from typing_extensions import TypeVarTuple, Unpack, deprecated @@ -11,6 +11,7 @@ _Ts = TypeVarTuple("_Ts") class Compiler: compiler_type: ClassVar[str] + description: ClassVar[str] executables: ClassVar[dict[str, Incomplete]] # Subclasses that rely on the standard filename generation methods @@ -72,6 +73,8 @@ class Compiler: def library_dir_option(self, dir: str) -> str: ... def library_option(self, lib: str) -> str: ... def runtime_library_dir_option(self, dir: str) -> str | list[str]: ... + def initialize(self, plat_name: str | None = None) -> None: ... + def configure_system(self) -> None: ... def set_executables(self, **kwargs: str) -> None: ... def set_executable(self, key: str, value) -> None: ... def compile( @@ -184,14 +187,8 @@ class Compiler: def execute( self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 ) -> None: ... - - @overload - def spawn(self, cmd: Sequence[StrOrBytesPath], *, search_path: Literal[False], env: _ENV | None = None) -> None: ... - @overload - def spawn( - self, cmd: MutableSequence[bytes | StrPath], *, search_path: Literal[True] = True, env: _ENV | None = None - ) -> None: ... - + def call(self, cmd: Sequence[StrOrBytesPath], *, env: _ENV | None = None, **kwargs) -> None: ... + def spawn(self, cmd: Sequence[StrOrBytesPath], *, env: _ENV | None = None, **kwargs) -> None: ... def mkpath(self, name: str, mode: int = 0o777) -> None: ... @overload @@ -208,6 +205,7 @@ def get_default_compiler(osname: str | None = None, platform: str | None = None) compiler_class: dict[str, tuple[str, str, str]] def show_compilers() -> None: ... +def get_compilers() -> dict[str, type[Compiler]]: ... def new_compiler( plat: str | None = None, compiler: str | None = None, verbose: bool = False, force: bool = False ) -> Compiler: ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi index 14fd3bdc641c..62469a25df49 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi @@ -11,6 +11,7 @@ def get_msvcr() -> list[str]: ... class Compiler(unix.Compiler): compiler_type: ClassVar[str] + description: ClassVar[str] obj_extension: ClassVar[str] static_lib_extension: ClassVar[str] shared_lib_extension: ClassVar[str] @@ -55,7 +56,9 @@ class Compiler(unix.Compiler): class MinGW32Compiler(Compiler): compiler_type: ClassVar[str] + description: ClassVar[str] def __init__(self, verbose: bool = False, force: bool = False) -> None: ... + def configure_system(self) -> None: ... def runtime_library_dir_option(self, dir: str) -> Never: ... CONFIG_H_OK: Final = "ok" diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi index 5c3cf1e9f0c6..280e85790683 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi @@ -1,6 +1,6 @@ -class Error(Exception): ... +from ..errors import Error + class PreprocessError(Error): ... class CompileError(Error): ... class LibError(Error): ... class LinkError(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 ef06b85f4d74..5631b5ca4f56 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi @@ -1,4 +1,4 @@ -from _typeshed import StrPath +from _typeshed import StrOrBytesPath from collections.abc import Sequence from typing import ClassVar, Final @@ -7,6 +7,8 @@ from . import base PLAT_SPEC_TO_RUNTIME: Final[dict[str, str]] class Compiler(base.Compiler): + compiler_type: ClassVar[str] + description: ClassVar[str] src_extensions: ClassVar[list[str]] res_extension: ClassVar[str] obj_extension: ClassVar[str] @@ -20,4 +22,4 @@ class Compiler(base.Compiler): def initialize(self, plat_name: str | None = None) -> None: ... @property def out_extensions(self) -> dict[str, str]: ... - def spawn(self, cmd: Sequence[bytes | StrPath]): ... # type: ignore[override] # Less params + def call(self, cmd: Sequence[StrOrBytesPath], *, env=None, **kwargs) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/unix.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/unix.pyi index 2e78f191dd55..7b54ecbdcac8 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/unix.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/unix.pyi @@ -3,6 +3,8 @@ from typing import ClassVar from . import base class Compiler(base.Compiler): + compiler_type: ClassVar[str] + description: ClassVar[str] src_extensions: ClassVar[list[str]] obj_extension: ClassVar[str] static_lib_extension: ClassVar[str] @@ -13,4 +15,5 @@ class Compiler(base.Compiler): shared_lib_format: ClassVar[str] dylib_lib_format: ClassVar[str] xcode_stub_lib_format: ClassVar[str] + def configure_system(self) -> None: ... def runtime_library_dir_option(self, dir: str) -> str | list[str]: ... # type: ignore[override] diff --git a/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi b/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi index d948cbbf8056..1db69f4cdca8 100644 --- a/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi +++ b/stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi @@ -5,6 +5,8 @@ from typing import ClassVar, Literal from . import unix class Compiler(unix.Compiler): + compiler_type: ClassVar[str] + description: ClassVar[str] src_extensions: ClassVar[list[str]] zos_compiler: Literal["ibm-openxl", "ibm-xlclang", "ibm-xlc"] def __init__(self, verbose: bool = False, force: bool = False) -> None: ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/errors.pyi b/stubs/setuptools/setuptools/_distutils/compilers/errors.pyi new file mode 100644 index 000000000000..287be1b8200d --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/compilers/errors.pyi @@ -0,0 +1,3 @@ +class Error(Exception): ... +class UnknownFileType(Error): ... +class PlatformError(Error): ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/platform/detect.pyi b/stubs/setuptools/setuptools/_distutils/compilers/platform/detect.pyi new file mode 100644 index 000000000000..1b890d82eadf --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/compilers/platform/detect.pyi @@ -0,0 +1,3 @@ +def get_host_platform() -> str: ... +def get_platform() -> str: ... +def is_mingw() -> bool: ... diff --git a/stubs/setuptools/setuptools/_distutils/compilers/platform/macos.pyi b/stubs/setuptools/setuptools/_distutils/compilers/platform/macos.pyi new file mode 100644 index 000000000000..22da842310bb --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/compilers/platform/macos.pyi @@ -0,0 +1,11 @@ +from collections.abc import Mapping +from typing import Any, Final, TypeVar + +_MappingT = TypeVar("_MappingT", bound=Mapping[Any, Any]) + +VERSION_VAR: Final = "MACOSX_DEPLOYMENT_TARGET" + +def customize_compiler(config_vars) -> None: ... +def _target_ver_from_syscfg(): ... +def target_ver() -> str | None: ... +def inject_ver(env: _MappingT | None) -> _MappingT | dict[str, str | int] | None: ... diff --git a/stubs/setuptools/setuptools/_distutils/dist.pyi b/stubs/setuptools/setuptools/_distutils/dist.pyi index 664c33f71a46..fe8c517c3a46 100644 --- a/stubs/setuptools/setuptools/_distutils/dist.pyi +++ b/stubs/setuptools/setuptools/_distutils/dist.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete, StrOrBytesPath, StrPath, SupportsWrite -from collections.abc import Iterable, MutableMapping +from collections.abc import Iterable, Mapping, MutableMapping from re import Pattern from typing import IO, ClassVar, Literal, TypeAlias, TypeVar, overload @@ -81,16 +81,16 @@ class Distribution: dist_files: list[tuple[str, str, str]] packages: list[str] | None package_data: dict[str, list[str]] - package_dir: dict[str, str] | None + package_dir: Mapping[str, str] | None py_modules: list[str] | None - libraries: Incomplete - headers: Incomplete + libraries: list[tuple[str, dict[str, Incomplete]]] | None + headers: list[str] | None ext_modules: list[Extension] | None - ext_package: Incomplete - include_dirs: Incomplete + ext_package: str | None + include_dirs: list[str] | None extra_path: Incomplete - scripts: Incomplete - data_files: list[str | tuple[Incomplete, ...]] | None + scripts: list[str] | None + data_files: list[tuple[str, list[str]]] | None password: str command_obj: dict[str, Command] have_run: dict[str, bool] diff --git a/stubs/setuptools/setuptools/_distutils/errors.pyi b/stubs/setuptools/setuptools/_distutils/errors.pyi index 79eb7f7baa0f..76960eb1ac25 100644 --- a/stubs/setuptools/setuptools/_distutils/errors.pyi +++ b/stubs/setuptools/setuptools/_distutils/errors.pyi @@ -1,15 +1,36 @@ from .compilers.C.errors import ( CompileError as CompileError, - Error as _Error, LibError as LibError, LinkError as LinkError, PreprocessError as PreprocessError, - UnknownFileType as _UnknownFileType, ) +from .compilers.errors import Error as _Error, UnknownFileType as _UnknownFileType CCompilerError = _Error UnknownFileError = _UnknownFileType +__all__ = [ + "CCompilerError", + "CompileError", + "DistutilsArgError", + "DistutilsByteCompileError", + "DistutilsClassError", + "DistutilsError", + "DistutilsExecError", + "DistutilsFileError", + "DistutilsGetoptError", + "DistutilsInternalError", + "DistutilsModuleError", + "DistutilsOptionError", + "DistutilsPlatformError", + "DistutilsSetupError", + "DistutilsTemplateError", + "LibError", + "LinkError", + "PreprocessError", + "UnknownFileError", +] + class DistutilsError(Exception): ... class DistutilsModuleError(DistutilsError): ... class DistutilsClassError(DistutilsError): ... diff --git a/stubs/setuptools/setuptools/_distutils/extension.pyi b/stubs/setuptools/setuptools/_distutils/extension.pyi index 1aee26696a94..a1711fb8bcb9 100644 --- a/stubs/setuptools/setuptools/_distutils/extension.pyi +++ b/stubs/setuptools/setuptools/_distutils/extension.pyi @@ -1,39 +1,23 @@ from _typeshed import StrPath from collections.abc import Iterable +from dataclasses import dataclass +@dataclass() class Extension: name: str - sources: list[str] - include_dirs: list[str] - define_macros: list[tuple[str, str | None]] - undef_macros: list[str] - library_dirs: list[str] - libraries: list[str] - runtime_library_dirs: list[str] - extra_objects: list[str] - extra_compile_args: list[str] - extra_link_args: list[str] - export_symbols: list[str] - swig_opts: list[str] - depends: list[str] - language: str | None - optional: bool | None - def __init__( - self, - name: str, - sources: Iterable[StrPath], - include_dirs: list[str] | None = None, - define_macros: list[tuple[str, str | None]] | None = None, - undef_macros: list[str] | None = None, - library_dirs: list[str] | None = None, - libraries: list[str] | None = None, - runtime_library_dirs: list[str] | None = None, - extra_objects: list[str] | None = None, - extra_compile_args: list[str] | None = None, - extra_link_args: list[str] | None = None, - export_symbols: list[str] | None = None, - swig_opts: list[str] | None = None, - depends: list[str] | None = None, - language: str | None = None, - optional: bool | None = None, - ) -> None: ... + sources: Iterable[StrPath] + include_dirs: list[str] = ... + define_macros: list[tuple[str, str | None]] = ... + undef_macros: list[str] = ... + library_dirs: list[str] = ... + libraries: list[str] = ... + runtime_library_dirs: list[str] = ... + extra_objects: list[str] = ... + extra_compile_args: list[str] = ... + extra_link_args: list[str] = ... + export_symbols: list[str] = ... + swig_opts: list[str] = ... + depends: list[str] = ... + language: str | None = None + optional: bool = False + def __post_init__(self): ... diff --git a/stubs/setuptools/setuptools/_distutils/filelist.pyi b/stubs/setuptools/setuptools/_distutils/filelist.pyi index 39c3e77d79fc..c9e063474d18 100644 --- a/stubs/setuptools/setuptools/_distutils/filelist.pyi +++ b/stubs/setuptools/setuptools/_distutils/filelist.pyi @@ -19,7 +19,7 @@ class FileList: @overload def include_pattern( - self, pattern: str, anchor: bool = True, prefix: str | None = None, is_regex: Literal[False] = False + self, pattern: str | None, anchor: bool = True, prefix: str | None = None, is_regex: Literal[False] = False ) -> bool: ... @overload def include_pattern( @@ -30,7 +30,7 @@ class FileList: @overload def exclude_pattern( - self, pattern: str, anchor: bool = True, prefix: str | None = None, is_regex: Literal[False] = False + self, pattern: str | None, anchor: bool = True, prefix: str | None = None, is_regex: Literal[False] = False ) -> bool: ... @overload def exclude_pattern( diff --git a/stubs/setuptools/setuptools/_distutils/spawn.pyi b/stubs/setuptools/setuptools/_distutils/spawn.pyi index c76535e0bf5e..60e386c2fce2 100644 --- a/stubs/setuptools/setuptools/_distutils/spawn.pyi +++ b/stubs/setuptools/setuptools/_distutils/spawn.pyi @@ -1,15 +1,6 @@ -from _typeshed import StrOrBytesPath, StrPath, Unused -from collections.abc import MutableSequence, Sequence +from _typeshed import StrOrBytesPath +from collections.abc import Sequence from subprocess import _ENV -from typing import Literal, overload - -@overload -def spawn( - cmd: Sequence[StrOrBytesPath], search_path: Literal[False], verbose: Unused = False, env: _ENV | None = None -) -> None: ... -@overload -def spawn( - cmd: MutableSequence[bytes | StrPath], search_path: Literal[True] = True, verbose: Unused = False, env: _ENV | None = None -) -> None: ... +def spawn(cmd: Sequence[StrOrBytesPath], *, env: _ENV | None = None, **kwargs) -> None: ... def find_executable(executable: str, path: str | None = None) -> str | None: ... diff --git a/stubs/setuptools/setuptools/_distutils/sysconfig.pyi b/stubs/setuptools/setuptools/_distutils/sysconfig.pyi index e3b0292ef39b..50df58168ab0 100644 --- a/stubs/setuptools/setuptools/_distutils/sysconfig.pyi +++ b/stubs/setuptools/setuptools/_distutils/sysconfig.pyi @@ -15,7 +15,7 @@ def get_config_var(name: str) -> int | str | None: ... @overload def get_config_vars() -> dict[str, str | int]: ... @overload -def get_config_vars(arg: str, /, *args: str) -> list[str | int]: ... +def get_config_vars(arg: str, /, *args: str) -> list[str | int | None]: ... def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... diff --git a/stubs/setuptools/setuptools/_distutils/util.pyi b/stubs/setuptools/setuptools/_distutils/util.pyi index 1f9ef45e5ab8..ac4c1f849842 100644 --- a/stubs/setuptools/setuptools/_distutils/util.pyi +++ b/stubs/setuptools/setuptools/_distutils/util.pyi @@ -1,17 +1,22 @@ -from _typeshed import GenericPath, StrPath, Unused +from _typeshed import StrPath, Unused from collections.abc import Callable, Iterable, Mapping -from typing import AnyStr, Literal +from typing import Literal from typing_extensions import TypeVarTuple, Unpack +from .compilers.platform import detect, macos + _Ts = TypeVarTuple("_Ts") -def get_host_platform() -> str: ... -def get_platform() -> str: ... -def get_macosx_target_ver_from_syscfg(): ... -def get_macosx_target_ver(): ... +get_host_platform = detect.get_host_platform +get_platform = detect.get_platform +is_mingw = detect.is_mingw +MACOSX_VERSION_VAR = macos.VERSION_VAR +get_macosx_target_ver = macos.target_ver +get_macosx_target_ver_from_syscfg = macos._target_ver_from_syscfg + def split_version(s: str) -> list[int]: ... def convert_path(pathname: StrPath) -> str: ... -def change_root(new_root: GenericPath[AnyStr], pathname: GenericPath[AnyStr]) -> AnyStr: ... +def change_root(new_root: StrPath, pathname: StrPath) -> str: ... def check_environ() -> None: ... def subst_vars(s: str, local_vars: Mapping[str, object]) -> str: ... def grok_environment_error(exc: object, prefix: str = "error: ") -> str: ... @@ -30,5 +35,4 @@ def byte_compile( direct: bool | None = None, ) -> None: ... def rfc822_escape(header: str) -> str: ... -def is_mingw() -> bool: ... def is_freethreaded() -> bool: ... diff --git a/stubs/setuptools/setuptools/command/bdist_egg.pyi b/stubs/setuptools/setuptools/command/bdist_egg.pyi index dc921dde8c8a..9c25dcc1799c 100644 --- a/stubs/setuptools/setuptools/command/bdist_egg.pyi +++ b/stubs/setuptools/setuptools/command/bdist_egg.pyi @@ -1,15 +1,16 @@ from _typeshed import GenericPath, Incomplete, StrPath from collections.abc import Iterator from types import CodeType -from typing import AnyStr, ClassVar, Final, Literal, TypeVar +from typing import ClassVar, Final, Literal, TypeVar from zipfile import _ZipFileMode from .. import Command _StrPathT = TypeVar("_StrPathT", bound=StrPath) +_StrOrBytesT = TypeVar("_StrOrBytesT", str, bytes) def strip_module(filename): ... -def sorted_walk(dir: GenericPath[AnyStr]) -> Iterator[tuple[AnyStr, list[AnyStr], list[AnyStr]]]: ... +def sorted_walk(dir: GenericPath[_StrOrBytesT]) -> Iterator[tuple[_StrOrBytesT, list[_StrOrBytesT], list[_StrOrBytesT]]]: ... def write_stub(resource, pyfile) -> None: ... class bdist_egg(Command): diff --git a/stubs/setuptools/setuptools/glob.pyi b/stubs/setuptools/setuptools/glob.pyi index e5d6431bbe95..a89dadc475f7 100644 --- a/stubs/setuptools/setuptools/glob.pyi +++ b/stubs/setuptools/setuptools/glob.pyi @@ -1,5 +1,9 @@ +from collections.abc import Iterator +from typing import TypeVar + +_StrOrBytesT = TypeVar("_StrOrBytesT", str, bytes) __all__ = ["glob", "iglob", "escape"] -def glob(pathname, recursive: bool = False): ... -def iglob(pathname, recursive: bool = False): ... +def glob(pathname: _StrOrBytesT, recursive: bool = False) -> list[_StrOrBytesT]: ... +def iglob(pathname: _StrOrBytesT, recursive: bool = False) -> Iterator[_StrOrBytesT]: ... def escape(pathname): ...