Skip to content

Commit fc10a94

Browse files
neiljpJelleZijlstra
authored andcommitted
Distutils improvements to cmd.pyi and log.pyi (#1748)
* Add more functions to distutils.cmd.Command. * Add detail to distutils.log, previously an empty file.
1 parent c1971fb commit fc10a94

File tree

2 files changed

+54
-1
lines changed

2 files changed

+54
-1
lines changed

stdlib/2and3/distutils/cmd.pyi

+26-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stubs for distutils.cmd
22

3-
from typing import Callable, List, Tuple, Union
3+
from typing import Callable, List, Tuple, Union, Optional, Iterable, Any, Text
44
from abc import abstractmethod
55
from distutils.dist import Distribution
66

@@ -13,3 +13,28 @@ class Command:
1313
def finalize_options(self) -> None: ...
1414
@abstractmethod
1515
def run(self) -> None: ...
16+
17+
def announce(self, msg: Text, level: int = ...) -> None: ...
18+
def debug_print(self, msg: Text) -> None: ...
19+
20+
def ensure_string(self, option: str, default: Optional[str] = ...) -> None: ...
21+
def ensure_string_list(self, option: Union[str, List[str]]) -> None: ...
22+
def ensure_filename(self, option: str) -> None: ...
23+
def ensure_dirname(self, option: str) -> None: ...
24+
25+
def get_command_name(self) -> str: ...
26+
def set_undefined_options(self, src_cmd: Text, *option_pairs: Tuple[str, str]) -> None: ...
27+
def get_finalized_command(self, command: Text, create: int = ...) -> Command: ...
28+
def reinitialize_command(self, command: Union[Command, Text], reinit_subcommands: int = ...) -> Command: ...
29+
def run_command(self, command: Text) -> None: ...
30+
def get_sub_commands(self) -> List[str]: ...
31+
32+
def warn(self, msg: Text) -> None: ...
33+
def execute(self, func: Callable[..., Any], args: Iterable[Any], msg: Optional[Text] = ..., level: int = ...) -> None: ...
34+
def mkpath(self, name: str, mode: int = ...) -> None: ...
35+
def copy_file(self, infile: str, outfile: str, preserve_mode: int = ..., preserve_times: int = ..., link: Optional[str] = ..., level: Any = ...) -> Tuple[str, bool]: ... # level is not used
36+
def copy_tree(self, infile: str, outfile: str, preserve_mode: int = ..., preserve_times: int = ..., preserve_symlinks: int = ..., level: Any = ...) -> List[str]: ... # level is not used
37+
def move_file(self, src: str, dest: str, level: Any = ...) -> str: ... # level is not used
38+
def spawn(self, cmd: Iterable[str], search_path: int = ..., level: Any = ...) -> None: ... # level is not used
39+
def make_archive(self, base_name: str, format: str, root_dir: Optional[str] = ..., base_dir: Optional[str] = ..., owner: Optional[str] = ..., group: Optional[str] = ...) -> str: ...
40+
def make_file(self, infiles: Union[str, List[str], Tuple[str]], outfile: str, func: Callable[..., Any], args: List[Any], exec_msg: Optional[str] = ..., skip_msg: Optional[str] = ..., level: Any = ...) -> None: ... # level is not used

stdlib/2and3/distutils/log.pyi

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from typing import Any, Callable, Iterable, Text
2+
3+
DEBUG: int
4+
INFO: int
5+
WARN: int
6+
ERROR: int
7+
FATAL: int
8+
9+
class Log:
10+
def __init__(self, threshold: int = ...) -> None: ...
11+
def log(self, level: int, msg: Text, *args: Any) -> None: ...
12+
def debug(self, msg: Text, *args: Any) -> None: ...
13+
def info(self, msg: Text, *args: Any) -> None: ...
14+
def warn(self, msg: Text, *args: Any) -> None: ...
15+
def error(self, msg: Text, *args: Any) -> None: ...
16+
def fatal(self, msg: Text, *args: Any) -> None: ...
17+
18+
_LogFunc = Callable[[Text, Iterable[Any]], None]
19+
20+
log: Callable[[int, Text, Iterable[Any]], None]
21+
debug: _LogFunc
22+
info: _LogFunc
23+
warn: _LogFunc
24+
error: _LogFunc
25+
fatal: _LogFunc
26+
27+
def set_threshold(level: int) -> int: ...
28+
def set_verbosity(v: int) -> None: ...

0 commit comments

Comments
 (0)