Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions stubs/setuptools/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -85,4 +82,3 @@ distutils\..+
setuptools.config._validate_pyproject.*
setuptools.compat.*
setuptools.command.build_py.build_py.existing_egg_info_dir
.+?\.tests.*
7 changes: 5 additions & 2 deletions stubs/setuptools/METADATA.toml
Original file line number Diff line number Diff line change
@@ -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`, \
Expand All @@ -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 }
1 change: 0 additions & 1 deletion stubs/setuptools/distutils/compat/__init__.pyi

This file was deleted.

1 change: 1 addition & 0 deletions stubs/setuptools/distutils/compilers/errors.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from setuptools._distutils.compilers.errors import *
1 change: 1 addition & 0 deletions stubs/setuptools/distutils/compilers/platform/detect.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from setuptools._distutils.compilers.platform.detect import *
1 change: 1 addition & 0 deletions stubs/setuptools/distutils/compilers/platform/macos.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from setuptools._distutils.compilers.platform.macos import *
4 changes: 3 additions & 1 deletion stubs/setuptools/setuptools/_distutils/ccompiler.pyi
Original file line number Diff line number Diff line change
@@ -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__ = [
Expand All @@ -13,3 +13,5 @@ __all__ = [
]

CCompiler = base.Compiler

def show_compilers() -> None: ...
13 changes: 7 additions & 6 deletions stubs/setuptools/setuptools/_distutils/cmd.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down
27 changes: 14 additions & 13 deletions stubs/setuptools/setuptools/_distutils/command/build_ext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/setuptools/setuptools/_distutils/command/install.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions stubs/setuptools/setuptools/_distutils/compat/__init__.pyi

This file was deleted.

16 changes: 7 additions & 9 deletions stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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: ...
Expand Down
3 changes: 3 additions & 0 deletions stubs/setuptools/setuptools/_distutils/compilers/C/cygwin.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions stubs/setuptools/setuptools/_distutils/compilers/C/errors.pyi
Original file line number Diff line number Diff line change
@@ -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): ...
6 changes: 4 additions & 2 deletions stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from _typeshed import StrPath
from _typeshed import StrOrBytesPath
from collections.abc import Sequence
from typing import ClassVar, Final

Expand All @@ -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]
Expand All @@ -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: ...
3 changes: 3 additions & 0 deletions stubs/setuptools/setuptools/_distutils/compilers/C/unix.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
2 changes: 2 additions & 0 deletions stubs/setuptools/setuptools/_distutils/compilers/C/zos.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
3 changes: 3 additions & 0 deletions stubs/setuptools/setuptools/_distutils/compilers/errors.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Error(Exception): ...
class UnknownFileType(Error): ...
class PlatformError(Error): ...
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
def get_host_platform() -> str: ...
def get_platform() -> str: ...
def is_mingw() -> bool: ...
Original file line number Diff line number Diff line change
@@ -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: ...
16 changes: 8 additions & 8 deletions stubs/setuptools/setuptools/_distutils/dist.pyi
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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]
Expand Down
25 changes: 23 additions & 2 deletions stubs/setuptools/setuptools/_distutils/errors.pyi
Original file line number Diff line number Diff line change
@@ -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): ...
Expand Down
Loading