Skip to content

Commit a6c6bc1

Browse files
authored
Fix stdlib/disutils testing (#9734)
1 parent 880c0da commit a6c6bc1

File tree

18 files changed

+171
-268
lines changed

18 files changed

+171
-268
lines changed

.github/workflows/daily.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
cache: pip
4949
cache-dependency-path: requirements-tests.txt
5050
- name: Install dependencies
51-
run: pip install $(grep mypy== requirements-tests.txt)
51+
run: pip install -r requirements-tests.txt
5252
- name: Run stubtest
5353
run: python tests/stubtest_stdlib.py
5454

.github/workflows/stubtest_stdlib.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ jobs:
4444
cache: pip
4545
cache-dependency-path: requirements-tests.txt
4646
- name: Install dependencies
47-
run: pip install $(grep mypy== requirements-tests.txt)
47+
run: pip install -r requirements-tests.txt
4848
- name: Run stubtest
4949
run: python tests/stubtest_stdlib.py

pyrightconfig.stricter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// test cases use a custom pyrightconfig file
1010
"stubs/**/@tests/test_cases",
1111
"stdlib/distutils/command",
12+
"stdlib/distutils/dist.pyi",
1213
"stdlib/lib2to3/refactor.pyi",
1314
"stdlib/_tkinter.pyi",
1415
"stdlib/tkinter/__init__.pyi",

stdlib/distutils/cmd.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from _typeshed import Incomplete
12
from abc import abstractmethod
23
from collections.abc import Callable, Iterable
34
from distutils.dist import Distribution
@@ -60,3 +61,5 @@ class Command:
6061
skip_msg: str | None = None,
6162
level: Any = 1,
6263
) -> None: ... # level is not used
64+
def ensure_finalized(self) -> None: ...
65+
def dump_options(self, header: Incomplete | None = None, indent: str = "") -> None: ...

stdlib/distutils/core.pyi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
from _typeshed import StrOrBytesPath
12
from collections.abc import Mapping
23
from distutils.cmd import Command as Command
34
from distutils.dist import Distribution as Distribution
45
from distutils.extension import Extension as Extension
56
from typing import Any
67

8+
USAGE: str
9+
10+
def gen_usage(script_name: StrOrBytesPath) -> str: ...
11+
12+
setup_keywords: tuple[str, ...]
13+
extension_keywords: tuple[str, ...]
14+
715
def setup(
816
*,
917
name: str = ...,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
from distutils.unixccompiler import UnixCCompiler
2+
from distutils.version import LooseVersion
3+
from re import Pattern
4+
from typing_extensions import Literal
5+
6+
def get_msvcr() -> list[str] | None: ...
27

38
class CygwinCCompiler(UnixCCompiler): ...
49
class Mingw32CCompiler(CygwinCCompiler): ...
10+
11+
CONFIG_H_OK: str
12+
CONFIG_H_NOTOK: str
13+
CONFIG_H_UNCERTAIN: str
14+
15+
def check_config_h() -> tuple[Literal["ok", "not ok", "uncertain"], str]: ...
16+
17+
RE_VERSION: Pattern[bytes]
18+
19+
def get_versions() -> tuple[LooseVersion | None, ...]: ...
20+
def is_cygwingcc() -> bool: ...

stdlib/distutils/dist.pyi

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
from _typeshed import FileDescriptorOrPath, SupportsWrite
1+
from _typeshed import FileDescriptorOrPath, Incomplete, SupportsWrite
22
from collections.abc import Iterable, Mapping
33
from distutils.cmd import Command
4+
from re import Pattern
45
from typing import IO, Any
56

7+
command_re: Pattern[str]
8+
69
class DistributionMetadata:
710
def __init__(self, path: FileDescriptorOrPath | None = None) -> None: ...
811
name: str | None
@@ -57,3 +60,57 @@ class Distribution:
5760
def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ...
5861
def parse_config_files(self, filenames: Iterable[str] | None = None) -> None: ...
5962
def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ...
63+
global_options: Incomplete
64+
common_usage: str
65+
display_options: Incomplete
66+
display_option_names: Incomplete
67+
negative_opt: Incomplete
68+
verbose: int
69+
dry_run: int
70+
help: int
71+
command_packages: Incomplete
72+
script_name: Incomplete
73+
script_args: Incomplete
74+
command_options: Incomplete
75+
dist_files: Incomplete
76+
packages: Incomplete
77+
package_data: Incomplete
78+
package_dir: Incomplete
79+
py_modules: Incomplete
80+
libraries: Incomplete
81+
headers: Incomplete
82+
ext_modules: Incomplete
83+
ext_package: Incomplete
84+
include_dirs: Incomplete
85+
extra_path: Incomplete
86+
scripts: Incomplete
87+
data_files: Incomplete
88+
password: str
89+
command_obj: Incomplete
90+
have_run: Incomplete
91+
want_user_cfg: bool
92+
def dump_option_dicts(
93+
self, header: Incomplete | None = ..., commands: Incomplete | None = ..., indent: str = ...
94+
) -> None: ...
95+
def find_config_files(self): ...
96+
commands: Incomplete
97+
def parse_command_line(self): ...
98+
def finalize_options(self) -> None: ...
99+
def handle_display_options(self, option_order): ...
100+
def print_command_list(self, commands, header, max_length) -> None: ...
101+
def print_commands(self) -> None: ...
102+
def get_command_list(self): ...
103+
def get_command_packages(self): ...
104+
def get_command_class(self, command): ...
105+
def reinitialize_command(self, command, reinit_subcommands: int = ...): ...
106+
def announce(self, msg, level=...) -> None: ...
107+
def run_commands(self) -> None: ...
108+
def run_command(self, command) -> None: ...
109+
def has_pure_modules(self): ...
110+
def has_ext_modules(self): ...
111+
def has_c_libraries(self): ...
112+
def has_modules(self): ...
113+
def has_headers(self): ...
114+
def has_scripts(self): ...
115+
def has_data_files(self): ...
116+
def is_pure(self): ...

stdlib/distutils/fancy_getopt.pyi

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
from collections.abc import Iterable, Mapping
2+
from re import Pattern
23
from typing import Any, overload
34
from typing_extensions import TypeAlias
45

56
_Option: TypeAlias = tuple[str, str | None, str]
67
_GR: TypeAlias = tuple[list[str], OptionDummy]
78

8-
def fancy_getopt(
9-
options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None
10-
) -> list[str] | _GR: ...
11-
def wrap_text(text: str, width: int) -> list[str]: ...
9+
longopt_pat: str
10+
longopt_re: Pattern[str]
11+
neg_alias_re: Pattern[str]
12+
longopt_xlate: dict[int, int]
1213

1314
class FancyGetopt:
1415
def __init__(self, option_table: list[_Option] | None = None) -> None: ...
@@ -20,5 +21,14 @@ class FancyGetopt:
2021
def get_option_order(self) -> list[tuple[str, str]]: ...
2122
def generate_help(self, header: str | None = None) -> list[str]: ...
2223

24+
def fancy_getopt(
25+
options: list[_Option], negative_opt: Mapping[_Option, _Option], object: Any, args: list[str] | None
26+
) -> list[str] | _GR: ...
27+
28+
WS_TRANS: dict[int, str]
29+
30+
def wrap_text(text: str, width: int) -> list[str]: ...
31+
def translate_longopt(opt: str) -> str: ...
32+
2333
class OptionDummy:
2434
def __init__(self, options: Iterable[str] = ...) -> None: ...

stdlib/distutils/sysconfig.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
import sys
12
from collections.abc import Mapping
23
from distutils.ccompiler import CCompiler
34

45
PREFIX: str
56
EXEC_PREFIX: str
7+
BASE_PREFIX: str
8+
BASE_EXEC_PREFIX: str
9+
project_base: str
10+
python_build: bool
611

12+
def expand_makefile_vars(s: str, vars: Mapping[str, str]) -> str: ...
713
def get_config_var(name: str) -> int | str | None: ...
814
def get_config_vars(*args: str) -> Mapping[str, int | str]: ...
915
def get_config_h_filename() -> str: ...
1016
def get_makefile_filename() -> str: ...
1117
def get_python_inc(plat_specific: bool = ..., prefix: str | None = None) -> str: ...
1218
def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: str | None = None) -> str: ...
1319
def customize_compiler(compiler: CCompiler) -> None: ...
20+
21+
if sys.version_info < (3, 10):
22+
def get_python_version() -> str: ...

stdlib/distutils/util.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
import sys
12
from _typeshed import StrPath, Unused
23
from collections.abc import Callable, Container, Iterable, Mapping
34
from typing import Any
45
from typing_extensions import Literal
56

7+
if sys.version_info >= (3, 8):
8+
def get_host_platform() -> str: ...
9+
610
def get_platform() -> str: ...
711
def convert_path(pathname: str) -> str: ...
812
def change_root(new_root: str, pathname: str) -> str: ...

0 commit comments

Comments
 (0)