distutils & setuptools: Relax path related params (#11948)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Avasam
2024-05-20 23:41:20 -04:00
committed by GitHub
parent 6816cf47f7
commit a375953f63
24 changed files with 247 additions and 93 deletions
@@ -1,6 +1,17 @@
from typing import Literal
from _typeshed import StrOrBytesPath
from collections.abc import Callable, Iterable
from typing import Literal, TypeVar
def newer(source, target): ...
def newer_pairwise(sources, targets, newer=...): ...
def newer_group(sources, target, missing: Literal["error", "newer", "ignore"] = "error"): ...
def newer_pairwise_group(sources, targets, *, newer=...): ...
_SourcesT = TypeVar("_SourcesT", bound=StrOrBytesPath)
_TargetsT = TypeVar("_TargetsT", bound=StrOrBytesPath)
def newer(source: StrOrBytesPath, target: StrOrBytesPath) -> bool: ...
def newer_pairwise(
sources: Iterable[_SourcesT], targets: Iterable[_TargetsT], newer: Callable[[_SourcesT, _TargetsT], bool] = ...
) -> tuple[list[_SourcesT], list[_TargetsT]]: ...
def newer_group(
sources: Iterable[StrOrBytesPath], target: StrOrBytesPath, missing: Literal["error", "ignore", "newer"] = "error"
) -> bool: ...
def newer_pairwise_group(
sources: Iterable[_SourcesT], targets: Iterable[_TargetsT], *, newer: Callable[[_SourcesT, _TargetsT], bool] = ...
) -> tuple[list[_SourcesT], list[_TargetsT]]: ...
@@ -1,18 +1,31 @@
from typing import Literal
from _typeshed import StrOrBytesPath, StrPath
from typing import Literal, overload
@overload
def make_archive(
base_name: str,
format: str,
root_dir: str | None = ...,
base_dir: str | None = ...,
root_dir: StrOrBytesPath | None = None,
base_dir: str | None = None,
verbose: bool | Literal[0, 1] = 0,
dry_run: bool | Literal[0, 1] = 0,
owner: str | None = ...,
group: str | None = ...,
owner: str | None = None,
group: str | None = None,
) -> str: ...
@overload
def make_archive(
base_name: StrPath,
format: str,
root_dir: StrOrBytesPath,
base_dir: str | None = None,
verbose: bool | Literal[0, 1] = 0,
dry_run: bool | Literal[0, 1] = 0,
owner: str | None = None,
group: str | None = None,
) -> str: ...
def make_tarball(
base_name: str,
base_dir: str,
base_dir: StrPath,
compress: str | None = ...,
verbose: bool | Literal[0, 1] = 0,
dry_run: bool | Literal[0, 1] = 0,
@@ -1,8 +1,11 @@
from collections.abc import Callable
from typing import Any, ClassVar, Literal
from _typeshed import BytesPath, StrPath
from collections.abc import Callable, Iterable
from typing import Any, ClassVar, Literal, TypeVar, overload
from typing_extensions import TypeAlias
_Macro: TypeAlias = tuple[str] | tuple[str, str | None]
_StrPathT = TypeVar("_StrPathT", bound=StrPath)
_BytesPathT = TypeVar("_BytesPathT", bound=BytesPath)
def gen_lib_options(
compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str]
@@ -154,18 +157,27 @@ class CCompiler:
extra_preargs: list[str] | None = ...,
extra_postargs: list[str] | None = ...,
) -> None: ...
def executable_filename(self, basename: str, strip_dir: bool | Literal[0, 1] = 0, output_dir: str = ...) -> str: ...
@overload
def executable_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = ...) -> str: ...
@overload
def executable_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = ...) -> str: ...
def library_filename(
self, libname: str, lib_type: str = "static", strip_dir: bool | Literal[0, 1] = 0, output_dir: str = ""
self, libname: str, lib_type: str = "static", strip_dir: bool | Literal[0, 1] = 0, output_dir: StrPath = ""
) -> str: ...
def object_filenames(
self, source_filenames: list[str], strip_dir: bool | Literal[0, 1] = 0, output_dir: str = ...
self, source_filenames: Iterable[StrPath], strip_dir: bool | Literal[0, 1] = 0, output_dir: StrPath | None = ...
) -> list[str]: ...
def shared_object_filename(self, basename: str, strip_dir: bool | Literal[0, 1] = 0, output_dir: str = ...) -> str: ...
@overload
def shared_object_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = ...) -> str: ...
@overload
def shared_object_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = ...) -> str: ...
def execute(self, func: Callable[..., object], args: tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ...
def spawn(self, cmd: list[str]) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
def move_file(self, src: str, dst: str) -> str: ...
@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 = ...) -> None: ...
def warn(self, msg: str) -> None: ...
def debug_print(self, msg: str) -> None: ...
+37 -9
View File
@@ -1,10 +1,13 @@
from _typeshed import Incomplete, Unused
from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused
from abc import abstractmethod
from collections.abc import Callable, Iterable
from typing import Any, ClassVar, Literal
from typing import Any, ClassVar, Literal, TypeVar, overload
from .dist import Distribution
_StrPathT = TypeVar("_StrPathT", bound=StrPath)
_BytesPathT = TypeVar("_BytesPathT", bound=BytesPath)
class Command:
distribution: Distribution
# Any to work around variance issues
@@ -34,31 +37,56 @@ class Command:
self, func: Callable[..., object], args: Iterable[Incomplete], msg: str | None = ..., level: int = ...
) -> None: ...
def mkpath(self, name: str, mode: int = ...) -> None: ...
@overload
def copy_file(
self,
infile: str,
outfile: str,
infile: StrPath,
outfile: _StrPathT,
preserve_mode: bool | Literal[0, 1] = 1,
preserve_times: bool | Literal[0, 1] = 1,
link: str | None = None,
level: Unused = 1,
) -> tuple[str, bool]: ...
) -> tuple[_StrPathT | str, bool]: ...
@overload
def copy_file(
self,
infile: BytesPath,
outfile: _BytesPathT,
preserve_mode: bool | Literal[0, 1] = 1,
preserve_times: bool | Literal[0, 1] = 1,
link: str | None = None,
level: Unused = 1,
) -> tuple[_BytesPathT | bytes, bool]: ...
def copy_tree(
self,
infile: str,
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,
level: Unused = 1,
) -> list[str]: ...
def move_file(self, src: str, dst: str, level: Unused = 1) -> str: ...
@overload
def move_file(self, src: StrPath, dst: _StrPathT, level: Unused = 1) -> _StrPathT | str: ...
@overload
def move_file(self, src: BytesPath, dst: _BytesPathT, level: Unused = 1) -> _BytesPathT | bytes: ...
def spawn(self, cmd: Iterable[str], search_path: bool | Literal[0, 1] = 1, level: Unused = 1) -> None: ...
@overload
def make_archive(
self,
base_name: str,
format: str,
root_dir: str | None = None,
root_dir: StrOrBytesPath | None = None,
base_dir: str | None = None,
owner: str | None = None,
group: str | None = None,
) -> str: ...
@overload
def make_archive(
self,
base_name: StrPath,
format: str,
root_dir: StrOrBytesPath,
base_dir: str | None = None,
owner: str | None = None,
group: str | None = None,
@@ -66,7 +94,7 @@ class Command:
def make_file(
self,
infiles: str | list[str] | tuple[str, ...],
outfile: str,
outfile: StrOrBytesPath,
func: Callable[..., object],
args: list[Incomplete],
exec_msg: str | None = None,
@@ -17,7 +17,7 @@ class install_lib(Command):
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def build(self) -> None: ...
def install(self): ...
def install(self) -> list[str]: ...
def byte_compile(self, files) -> None: ...
def get_outputs(self): ...
def get_inputs(self): ...
@@ -12,7 +12,7 @@ class install_scripts(Command):
skip_build: Incomplete
def initialize_options(self) -> None: ...
def finalize_options(self) -> None: ...
outfiles: Incomplete
outfiles: list[str]
def run(self) -> None: ...
def get_inputs(self): ...
def get_outputs(self): ...
@@ -1,4 +1,4 @@
from _typeshed import Incomplete
from _typeshed import Incomplete, StrOrBytesPath
from collections.abc import Iterable, Iterator
from typing import AnyStr, ClassVar, TypeVar, overload
@@ -18,7 +18,7 @@ class upload(PyPIRCCommand):
realm: Incomplete
def finalize_options(self) -> None: ...
def run(self) -> None: ...
def upload_file(self, command: str, pyversion: str, filename: str) -> None: ...
def upload_file(self, command: str, pyversion: str, filename: StrOrBytesPath) -> None: ...
@overload
def make_iterable(values: None) -> list[None]: ...
@@ -1,3 +1 @@
def newer(source: str, target: str) -> bool: ...
def newer_pairwise(sources: list[str], targets: list[str]) -> list[tuple[str, str]]: ...
def newer_group(sources: list[str], target: str, missing: str = ...) -> bool: ...
from ._modified import newer as newer, newer_group as newer_group, newer_pairwise as newer_pairwise
@@ -1,4 +1,4 @@
from _typeshed import FileDescriptorOrPath, Incomplete, SupportsWrite
from _typeshed import Incomplete, StrOrBytesPath, StrPath, SupportsWrite
from collections.abc import Iterable, Mapping
from re import Pattern
from typing import IO, Any, ClassVar, Literal, TypeVar, overload
@@ -12,7 +12,7 @@ _OptionsList: TypeAlias = list[tuple[str, str | None, str, int] | tuple[str, str
_CommandT = TypeVar("_CommandT", bound=Command)
class DistributionMetadata:
def __init__(self, path: FileDescriptorOrPath | None = None) -> None: ...
def __init__(self, path: StrOrBytesPath | None = None) -> None: ...
name: str | None
version: str | None
author: str | None
@@ -31,7 +31,7 @@ class DistributionMetadata:
requires: list[str] | None
obsoletes: list[str] | None
def read_pkg_file(self, file: IO[str]) -> None: ...
def write_pkg_info(self, base_dir: str) -> None: ...
def write_pkg_info(self, base_dir: StrPath) -> None: ...
def write_pkg_file(self, file: SupportsWrite[str]) -> None: ...
def get_name(self) -> str: ...
def get_version(self) -> str: ...
+4 -3
View File
@@ -1,3 +1,4 @@
from _typeshed import StrPath
from collections.abc import Mapping
from typing import Any
@@ -33,11 +34,11 @@ class _BuildMetaBackend:
self, metadata_directory: str, config_settings: Mapping[str, Any] | None = None
) -> str: ...
def build_wheel(
self, wheel_directory: str, config_settings: Mapping[str, Any] | None = None, metadata_directory: str | None = None
self, wheel_directory: StrPath, config_settings: Mapping[str, Any] | None = None, metadata_directory: str | None = None
) -> str: ...
def build_sdist(self, sdist_directory: str, config_settings: Mapping[str, Any] | None = None) -> str: ...
def build_sdist(self, sdist_directory: StrPath, config_settings: Mapping[str, Any] | None = None) -> str: ...
def build_editable(
self, wheel_directory: str, config_settings: Mapping[str, Any] | None = None, metadata_directory: str | None = None
self, wheel_directory: StrPath, config_settings: Mapping[str, Any] | 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(
@@ -1,4 +1,4 @@
from _typeshed import Unused
from _typeshed import StrPath, Unused
from typing import Literal
from .._distutils.command import install_lib as orig
@@ -8,8 +8,8 @@ class install_lib(orig.install_lib):
def get_exclusions(self): ...
def copy_tree(
self,
infile,
outfile,
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,
@@ -1,10 +1,8 @@
from typing import Any
from .._distutils.command import install_scripts as orig
class install_scripts(orig.install_scripts):
no_ep: bool
def initialize_options(self) -> None: ...
outfiles: Any
outfiles: list[str]
def run(self) -> None: ...
def write_script(self, script_name, contents, mode: str = "t", *ignored) -> None: ...
@@ -16,7 +16,7 @@ class StaticModule:
def __getattr__(self, attr): ...
def glob_relative(patterns: Iterable[str], root_dir: StrPath | None = None) -> list[str]: ...
def read_files(filepaths: str | bytes | Iterable[StrPath], root_dir: Incomplete | None = None) -> str: ...
def read_files(filepaths: StrPath | Iterable[StrPath], root_dir: StrPath | None = None) -> str: ...
def read_attr(attr_desc: str, package_dir: Mapping[str, str] | None = None, root_dir: StrPath | None = None): ...
def resolve_class(
qualified_class_name: str, package_dir: Mapping[str, str] | None = None, root_dir: StrPath | None = None