setuptools & distutils: more accurate spawn method (#13036)

This commit is contained in:
Avasam
2024-11-19 06:50:38 -05:00
committed by GitHub
parent 6db3e0cec5
commit 4addb8dd0b
7 changed files with 18 additions and 7 deletions

View File

@@ -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: ...

View File

@@ -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: ...

View File

@@ -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

View File

@@ -0,0 +1 @@
from setuptools._distutils.spawn import *

View File

@@ -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: ...

View File

@@ -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,

View File

@@ -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: ...