diff --git a/stdlib/distutils/ccompiler.pyi b/stdlib/distutils/ccompiler.pyi index 56617d8a7..5bff20980 100644 --- a/stdlib/distutils/ccompiler.pyi +++ b/stdlib/distutils/ccompiler.pyi @@ -165,7 +165,7 @@ class CCompiler: def execute( self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 ) -> None: ... - def spawn(self, cmd: list[str]) -> None: ... + def spawn(self, cmd: Iterable[str]) -> None: ... def mkpath(self, name: str, mode: int = 0o777) -> None: ... @overload def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ... diff --git a/stdlib/distutils/spawn.pyi b/stdlib/distutils/spawn.pyi index 50d89aeb9..ae07a4950 100644 --- a/stdlib/distutils/spawn.pyi +++ b/stdlib/distutils/spawn.pyi @@ -1,6 +1,10 @@ +from collections.abc import Iterable from typing import Literal def spawn( - cmd: list[str], search_path: bool | Literal[0, 1] = 1, verbose: bool | Literal[0, 1] = 0, dry_run: bool | Literal[0, 1] = 0 + cmd: Iterable[str], + search_path: bool | Literal[0, 1] = 1, + verbose: bool | Literal[0, 1] = 0, + dry_run: bool | Literal[0, 1] = 0, ) -> None: ... def find_executable(executable: str, path: str | None = None) -> str | None: ... diff --git a/stubs/setuptools/@tests/stubtest_allowlist.txt b/stubs/setuptools/@tests/stubtest_allowlist.txt index 29d7ddcc0..9b7880996 100644 --- a/stubs/setuptools/@tests/stubtest_allowlist.txt +++ b/stubs/setuptools/@tests/stubtest_allowlist.txt @@ -98,7 +98,6 @@ setuptools._distutils.dir_util setuptools._distutils.fancy_getopt setuptools._distutils.file_util setuptools._distutils.log -setuptools._distutils.spawn setuptools._distutils.text_file setuptools._distutils.unixccompiler setuptools._distutils.version diff --git a/stubs/setuptools/distutils/spawn.pyi b/stubs/setuptools/distutils/spawn.pyi new file mode 100644 index 000000000..4432100c0 --- /dev/null +++ b/stubs/setuptools/distutils/spawn.pyi @@ -0,0 +1 @@ +from setuptools._distutils.spawn import * diff --git a/stubs/setuptools/setuptools/_distutils/ccompiler.pyi b/stubs/setuptools/setuptools/_distutils/ccompiler.pyi index b0de29033..dafed2a04 100644 --- a/stubs/setuptools/setuptools/_distutils/ccompiler.pyi +++ b/stubs/setuptools/setuptools/_distutils/ccompiler.pyi @@ -1,5 +1,5 @@ from _typeshed import BytesPath, StrPath, Unused -from collections.abc import Callable, Iterable, Sequence +from collections.abc import Callable, Iterable, MutableSequence, Sequence from typing import ClassVar, Literal, TypeVar, overload from typing_extensions import TypeAlias, TypeVarTuple, Unpack @@ -169,7 +169,7 @@ class CCompiler: def execute( self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1 ) -> None: ... - def spawn(self, cmd: list[str]) -> None: ... + def spawn(self, cmd: MutableSequence[str]) -> None: ... def mkpath(self, name: str, mode: int = 0o777) -> None: ... @overload def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ... diff --git a/stubs/setuptools/setuptools/_distutils/cmd.pyi b/stubs/setuptools/setuptools/_distutils/cmd.pyi index e43d941b0..5fb3f4231 100644 --- a/stubs/setuptools/setuptools/_distutils/cmd.pyi +++ b/stubs/setuptools/setuptools/_distutils/cmd.pyi @@ -1,6 +1,6 @@ from _typeshed import BytesPath, StrOrBytesPath, StrPath, Unused from abc import abstractmethod -from collections.abc import Callable, Iterable +from collections.abc import Callable, MutableSequence from typing import Any, ClassVar, TypeVar, overload from typing_extensions import TypeVarTuple, Unpack @@ -79,7 +79,7 @@ class Command: 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 = True, level: Unused = 1) -> None: ... + def spawn(self, cmd: MutableSequence[str], search_path: bool = True, level: Unused = 1) -> None: ... @overload def make_archive( self, diff --git a/stubs/setuptools/setuptools/_distutils/spawn.pyi b/stubs/setuptools/setuptools/_distutils/spawn.pyi new file mode 100644 index 000000000..5deb19d0d --- /dev/null +++ b/stubs/setuptools/setuptools/_distutils/spawn.pyi @@ -0,0 +1,7 @@ +from collections.abc import MutableSequence +from subprocess import _ENV + +def spawn( + cmd: MutableSequence[str], search_path: bool = True, verbose: bool = False, dry_run: bool = False, env: _ENV | None = None +) -> None: ... +def find_executable(executable: str, path: str | None = None) -> str | None: ...