[setuptools] Update to 71.1.* (#12176)

This commit is contained in:
Sebastian Rittau
2024-06-25 00:38:59 +02:00
committed by GitHub
parent da443145bc
commit eff4ca189c
14 changed files with 153 additions and 62 deletions

View File

@@ -3,6 +3,9 @@ pkg_resources.PathMetadata.egg_info
pkg_resources.EggMetadata.loader
pkg_resources.ZipProvider.loader
# @classmethod alias not handled correctly by stubtest
pkg_resources.ZipManifests.load
# Is a functools.partial, so stubtest says "is not a function"
setuptools.modified.newer_pairwise_group
setuptools._distutils._modified.newer_pairwise_group

View File

@@ -1,4 +1,4 @@
version = "70.0.*"
version = "70.1.*"
upstream_repository = "https://github.com/pypa/setuptools"
[tool.stubtest]

View File

@@ -1,4 +1,3 @@
import sys
import types
import zipimport
from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused
@@ -7,21 +6,16 @@ from io import BytesIO
from itertools import chain
from pkgutil import get_importer as get_importer
from re import Pattern
from typing import IO, Any, ClassVar, Final, Literal, NoReturn, Protocol, TypeVar, overload, type_check_only
from typing import IO, Any, ClassVar, Final, Literal, NamedTuple, NoReturn, Protocol, TypeVar, overload, type_check_only
from typing_extensions import Self, TypeAlias
from zipfile import ZipInfo
from ._vendored_packaging import requirements as packaging_requirements, version as packaging_version
# TODO: Use _typeshed.importlib.LoaderProtocol once mypy has included it in its vendored typeshed
class _LoaderProtocol(Protocol):
def load_module(self, fullname: str, /) -> types.ModuleType: ...
# defined in setuptools
_T = TypeVar("_T")
_D = TypeVar("_D", bound=Distribution)
_NestedStr: TypeAlias = str | Iterable[_NestedStr]
_StrictInstallerType: TypeAlias = Callable[[Requirement], _D]
_InstallerType: TypeAlias = Callable[[Requirement], Distribution | None] | None
_InstallerType: TypeAlias = Callable[[Requirement], Distribution | None]
_PkgReqType: TypeAlias = str | Requirement
_EPDistType: TypeAlias = Distribution | _PkgReqType
_MetadataType: TypeAlias = IResourceProvider | None
@@ -32,6 +26,14 @@ _DistFinderType: TypeAlias = Callable[[_T, str, bool], Iterable[Distribution]]
_NSHandlerType: TypeAlias = Callable[[_T, str, str, types.ModuleType], str | None]
_ResourceStream: TypeAlias = Incomplete # A readable file-like object
# TODO: Use _typeshed.importlib.LoaderProtocol after mypy 1.11 is released
class _LoaderProtocol(Protocol):
def load_module(self, fullname: str, /) -> types.ModuleType: ...
# typeshed only
_D = TypeVar("_D", bound=Distribution)
_StrictInstallerType: TypeAlias = Callable[[Requirement], _D]
__all__ = [
"require",
"run_script",
@@ -147,7 +149,7 @@ class WorkingSet:
self,
requirements: Iterable[Requirement],
env: Environment | None = None,
installer: _InstallerType = None,
installer: _InstallerType | None = None,
replace_conflicting: bool = False,
extras: tuple[str, ...] | None = None,
) -> list[Distribution]: ...
@@ -169,7 +171,7 @@ class WorkingSet:
self,
plugin_env: Environment,
full_env: Environment | None = None,
installer: _InstallerType = None,
installer: _InstallerType | None = None,
fallback: bool = True,
) -> tuple[list[Distribution], dict[Distribution, Exception]]: ...
def require(self, *requirements: _NestedStr) -> Sequence[Distribution]: ...
@@ -190,14 +192,18 @@ class Environment:
) -> _D: ...
@overload
def best_match(
self, req: Requirement, working_set: WorkingSet, installer: _InstallerType = None, replace_conflicting: bool = False
self,
req: Requirement,
working_set: WorkingSet,
installer: _InstallerType | None = None,
replace_conflicting: bool = False,
) -> Distribution | None: ...
@overload
def obtain(self, requirement: Requirement, installer: _StrictInstallerType[_D]) -> _D: ... # type: ignore[overload-overlap]
@overload
def obtain(self, requirement: Requirement, installer: Callable[[Requirement], None] | None = None) -> None: ...
@overload
def obtain(self, requirement: Requirement, installer: _InstallerType = None) -> Distribution | None: ...
def obtain(self, requirement: Requirement, installer: _InstallerType | None = None) -> Distribution | None: ...
def __iter__(self) -> Iterator[str]: ...
def __iadd__(self, other: Distribution | Environment) -> Self: ...
def __add__(self, other: Distribution | Environment) -> Self: ...
@@ -239,12 +245,12 @@ class EntryPoint:
) -> None: ...
@overload
def load(
self, require: Literal[True] = True, env: Environment | None = None, installer: _InstallerType = None
self, require: Literal[True] = True, env: Environment | None = None, installer: _InstallerType | None = None
) -> _ResolvedEntryPoint: ...
@overload
def load(self, require: Literal[False], *args: Unused, **kwargs: Unused) -> _ResolvedEntryPoint: ...
def resolve(self) -> _ResolvedEntryPoint: ...
def require(self, env: Environment | None = None, installer: _InstallerType = None) -> None: ...
def require(self, env: Environment | None = None, installer: _InstallerType | None = None) -> None: ...
pattern: ClassVar[Pattern[str]]
@classmethod
def parse(cls, src: str, dist: Distribution | None = None) -> Self: ...
@@ -256,6 +262,15 @@ class EntryPoint:
) -> dict[str, dict[str, Self]]: ...
def find_distributions(path_item: str, only: bool = False) -> Generator[Distribution, None, None]: ...
def find_eggs_in_zip(importer: zipimport.zipimporter, path_item: str, only: bool = False) -> Iterator[Distribution]: ...
def find_nothing(importer: object | None, path_item: str | None, only: bool | None = False) -> tuple[Distribution, ...]: ...
def find_on_path(importer: object | None, path_item: str, only: bool = False) -> Generator[Distribution, None, None]: ...
def dist_factory(path_item: StrPath, entry: str, only: bool) -> Callable[[str], Iterable[Distribution]]: ...
class NoDists:
def __bool__(self) -> Literal[False]: ...
def __call__(self, fullpath: Unused) -> Iterator[Distribution]: ...
@overload
def get_distribution(dist: _D) -> _D: ...
@overload
@@ -279,7 +294,7 @@ class ResourceManager:
def resource_listdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> list[str]: ...
def extraction_error(self) -> NoReturn: ...
def get_cache_path(self, archive_name: str, names: Iterable[StrPath] = ()) -> str: ...
def postprocess(self, tempname: StrOrBytesPath, filename: str) -> None: ...
def postprocess(self, tempname: StrOrBytesPath, filename: StrOrBytesPath) -> None: ...
def set_extraction_path(self, path: str) -> None: ...
def cleanup_resources(self, force: bool = False) -> list[str]: ...
@@ -298,16 +313,6 @@ class IMetadataProvider(Protocol):
class ResolutionError(Exception): ...
class DistributionNotFound(ResolutionError):
def __init__(self, req: Requirement, requirers: set[str] | None, /, *args: object) -> None: ...
@property
def req(self) -> Requirement: ...
@property
def requirers(self) -> set[str] | None: ...
@property
def requirers_str(self) -> str: ...
def report(self) -> str: ...
class VersionConflict(ResolutionError):
def __init__(self, dist: Distribution, req: Requirement, /, *args: object) -> None: ...
@property
@@ -322,6 +327,16 @@ class ContextualVersionConflict(VersionConflict):
@property
def required_by(self) -> set[str]: ...
class DistributionNotFound(ResolutionError):
def __init__(self, req: Requirement, requirers: set[str] | None, /, *args: object) -> None: ...
@property
def req(self) -> Requirement: ...
@property
def requirers(self) -> set[str] | None: ...
@property
def requirers_str(self) -> str: ...
def report(self) -> str: ...
class UnknownExtra(ResolutionError): ...
class ExtractionError(Exception):
@@ -331,6 +346,7 @@ class ExtractionError(Exception):
def register_finder(importer_type: type[_T], distribution_finder: _DistFinderType[_T]) -> None: ...
def register_loader_type(loader_type: type[_ModuleLike], provider_factory: _ProviderFactoryType) -> None: ...
def resolve_egg_link(path: str) -> Iterable[Distribution]: ...
def register_namespace_handler(importer_type: type[_T], namespace_handler: _NSHandlerType[_T]) -> None: ...
class IResourceProvider(IMetadataProvider, Protocol):
@@ -454,6 +470,18 @@ class EmptyProvider(NullProvider):
empty_provider: EmptyProvider
class ZipManifests(dict[str, MemoizedZipManifests.manifest_mod]):
@classmethod
def build(cls, path: str) -> dict[str, ZipInfo]: ...
load = build
class MemoizedZipManifests(ZipManifests):
class manifest_mod(NamedTuple):
manifest: dict[str, ZipInfo]
mtime: float
def load(self, path: str) -> dict[str, ZipInfo]: ... # type: ignore[override]
class FileMetadata(EmptyProvider):
path: StrPath
def __init__(self, path: StrPath) -> None: ...
@@ -499,8 +527,3 @@ iter_entry_points = working_set.iter_entry_points
add_activation_listener = working_set.subscribe
run_script = working_set.run_script
run_main = run_script
if sys.version_info >= (3, 10):
LOCALE_ENCODING: Final = "locale"
else:
LOCALE_ENCODING: Final = None

View File

@@ -1,7 +1,7 @@
from _typeshed import StrPath
from abc import abstractmethod
from collections.abc import Iterable, Mapping, Sequence
from typing import Any, Literal
from typing import Any
from ._distutils.cmd import Command as _Command
from .depends import Require as Require
@@ -76,9 +76,7 @@ class Command(_Command):
distribution: Distribution
def __init__(self, dist: Distribution, **kw: Any) -> None: ...
def ensure_string_list(self, option: str | list[str]) -> None: ...
def reinitialize_command(
self, command: _Command | str, reinit_subcommands: bool | Literal[0, 1] = 0, **kw: Any
) -> _Command: ...
def reinitialize_command(self, command: _Command | str, reinit_subcommands: bool = False, **kw: Any) -> _Command: ... # type: ignore[override]
@abstractmethod
def initialize_options(self) -> None: ...
@abstractmethod

View File

@@ -1,6 +1,7 @@
from _typeshed import StrPath
from collections.abc import Mapping
from typing import Any
from typing_extensions import TypeAlias
from . import dist
@@ -17,6 +18,8 @@ __all__ = [
"SetupRequirementsError",
]
_ConfigSettings: TypeAlias = dict[str, str | list[str] | None] | None
class SetupRequirementsError(BaseException):
specifiers: Any
def __init__(self, specifiers) -> None: ...
@@ -34,11 +37,11 @@ class _BuildMetaBackend:
self, metadata_directory: str, config_settings: Mapping[str, Any] | None = None
) -> str: ...
def build_wheel(
self, wheel_directory: StrPath, config_settings: Mapping[str, Any] | None = None, metadata_directory: str | None = None
self, wheel_directory: StrPath, config_settings: _ConfigSettings | None = None, metadata_directory: StrPath | None = None
) -> str: ...
def build_sdist(self, sdist_directory: StrPath, config_settings: Mapping[str, Any] | None = None) -> str: ...
def build_sdist(self, sdist_directory: StrPath, config_settings: _ConfigSettings | None = None) -> str: ...
def build_editable(
self, wheel_directory: StrPath, config_settings: Mapping[str, Any] | None = None, metadata_directory: str | None = None
self, wheel_directory: StrPath, config_settings: _ConfigSettings | None = None, metadata_directory: str | None = None
) -> str: ...
def get_requires_for_build_editable(self, config_settings: Mapping[str, Any] | None = None) -> list[str]: ...
def prepare_metadata_for_build_editable(

View File

@@ -1,6 +1,5 @@
from _typeshed import Incomplete
from collections.abc import Generator
from typing import Literal
from .. import Command
@@ -14,9 +13,9 @@ class bdist_egg(Command):
boolean_options: Incomplete
bdist_dir: Incomplete
plat_name: Incomplete
keep_temp: int
keep_temp: bool
dist_dir: Incomplete
skip_build: int
skip_build: bool
egg_output: Incomplete
exclude_source_files: Incomplete
def initialize_options(self) -> None: ...
@@ -48,10 +47,5 @@ def can_scan(): ...
INSTALL_DIRECTORY_ATTRS: Incomplete
def make_zipfile(
zip_filename,
base_dir,
verbose: bool | Literal[0, 1] = 0,
dry_run: bool | Literal[0, 1] = 0,
compress: bool = True,
mode: str = "w",
zip_filename, base_dir, verbose: bool = False, dry_run: bool = False, compress: bool = True, mode: str = "w"
): ...

View File

@@ -0,0 +1,61 @@
from _typeshed import Incomplete
from collections.abc import Callable, Iterable
from types import TracebackType
from typing import Any, ClassVar, Final, Literal
from setuptools import Command
def safe_name(name: str) -> str: ...
def safe_version(version: str) -> str: ...
setuptools_major_version: Final[int]
PY_LIMITED_API_PATTERN: Final[str]
def python_tag() -> str: ...
def get_platform(archive_root: str | None) -> str: ...
def get_flag(var: str, fallback: bool, expected: bool = True, warn: bool = True) -> bool: ...
def get_abi_tag() -> str | None: ...
def safer_name(name: str) -> str: ...
def safer_version(version: str) -> str: ...
def remove_readonly(
func: Callable[..., object], path: str, excinfo: tuple[type[Exception], Exception, TracebackType]
) -> None: ...
def remove_readonly_exc(func: Callable[..., object], path: str, exc: Exception) -> None: ...
class bdist_wheel(Command):
description: ClassVar[str]
supported_compressions: ClassVar[dict[str, int]]
user_options: ClassVar[list[tuple[Any, ...]]]
boolean_options: ClassVar[list[str]]
bdist_dir: str | None
data_dir: Incomplete | None
plat_name: str | None
plat_tag: Incomplete | None
format: str
keep_temp: bool
dist_dir: str | None
egginfo_dir: Incomplete | None
root_is_pure: bool | None
skip_build: Incomplete | None
relative: bool
owner: Incomplete | None
group: Incomplete | None
universal: bool
compression: str | int
python_tag: str
build_number: str | None
py_limited_api: str | Literal[False]
plat_name_supplied: bool
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
@property
def wheel_dist_name(self) -> str: ...
def get_tag(self) -> tuple[str, str, str]: ...
def run(self) -> None: ...
def write_wheelfile(self, wheelfile_base: str, generator: str = ...) -> None: ...
@property
def license_paths(self) -> Iterable[str]: ...
def egg2dist(self, egginfo_path: str, distinfo_path: str) -> None: ...

View File

@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from typing import Any, ClassVar, Literal
from typing import Any, ClassVar
from .._distutils.command.build_ext import build_ext as _build_ext
@@ -40,7 +40,7 @@ def link_shared_object(
library_dirs: Incomplete | None = None,
runtime_library_dirs: Incomplete | None = None,
export_symbols: Incomplete | None = None,
debug: bool | Literal[0, 1] = 0,
debug: bool = False,
extra_preargs: Incomplete | None = None,
extra_postargs: Incomplete | None = None,
build_temp: Incomplete | None = None,

View File

@@ -1,6 +1,7 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, StrPath
from typing import Any, ClassVar
from .._distutils.cmd import _StrPathT
from .._distutils.command import build_py as orig
def make_writable(target) -> None: ...
@@ -10,12 +11,22 @@ class build_py(orig.build_py):
package_data: Any
exclude_package_data: Any
def finalize_options(self) -> None: ...
def copy_file( # type: ignore[override]
self,
infile: StrPath,
outfile: _StrPathT,
preserve_mode: bool = True,
preserve_times: bool = True,
link: str | None = None,
level=1,
) -> tuple[_StrPathT | str, bool]: ...
def run(self) -> None: ...
data_files: Any
def __getattr__(self, attr: str): ...
def build_module(self, module, module_file, package): ...
def get_data_files_without_manifest(self) -> list[tuple[Incomplete, Incomplete, Incomplete, list[Incomplete]]]: ...
def find_data_files(self, package, src_dir): ...
def get_outputs(self, include_bytecode: bool = True) -> list[str]: ... # type: ignore[override]
def build_package_data(self) -> None: ...
manifest_files: Any
def get_output_mapping(self) -> dict[str, str]: ...

View File

@@ -16,7 +16,7 @@ class easy_install(Command):
boolean_options: Incomplete
negative_opt: Incomplete
create_index: Incomplete
user: int
user: bool
zip_ok: Incomplete
install_dir: Incomplete
index_url: Incomplete

View File

@@ -59,10 +59,10 @@ class FileList(_FileList):
class manifest_maker(sdist):
template: str
use_defaults: int
prune: int
manifest_only: int
force_manifest: int
use_defaults: bool
prune: bool
manifest_only: bool
force_manifest: bool
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
filelist: Incomplete

View File

@@ -1,5 +1,4 @@
from _typeshed import StrPath, Unused
from typing import Literal
from .._distutils.command import install_lib as orig
@@ -10,9 +9,9 @@ class install_lib(orig.install_lib):
self,
infile: StrPath,
outfile: str,
preserve_mode: bool | Literal[0, 1] = 1,
preserve_times: bool | Literal[0, 1] = 1,
preserve_symlinks: bool | Literal[0, 1] = 0,
preserve_mode: bool = True, # type: ignore[override]
preserve_times: bool = True, # type: ignore[override]
preserve_symlinks: bool = False, # type: ignore[override]
level: Unused = 1,
): ...
def get_outputs(self): ...

View File

@@ -1,4 +1,4 @@
from _typeshed import StrOrBytesPath
from shutil import _OnExcCallback
def shutil_rmtree(path: StrOrBytesPath, ignore_errors: bool = False, onexc: _OnExcCallback | None = None): ...
def shutil_rmtree(path: StrOrBytesPath, ignore_errors: bool = False, onexc: _OnExcCallback | None = None) -> None: ...

View File

@@ -7,7 +7,6 @@ from typing_extensions import Self
from ..dist import Distribution
chain_iter: Incomplete
_K = TypeVar("_K")
_VCo = TypeVar("_VCo", covariant=True)