Skip to content

Commit d380c3d

Browse files
authored
[setuptools] Add missing compilers (#15394)
1 parent 1b9a9d7 commit d380c3d

13 files changed

Lines changed: 177 additions & 4 deletions

File tree

stubs/setuptools/@tests/stubtest_allowlist.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ setuptools._distutils.command.install_headers
7070
setuptools._distutils.compat.numpy
7171
setuptools._distutils.compat.py39
7272
setuptools._distutils.core
73-
setuptools._distutils.cygwinccompiler
7473
setuptools._distutils.debug
7574
setuptools._distutils.dir_util
7675
setuptools._distutils.fancy_getopt
7776
setuptools._distutils.file_util
7877
setuptools._distutils.log
7978
setuptools._distutils.text_file
80-
setuptools._distutils.version
79+
setuptools._distutils.version.Version._cmp # abstract method
80+
setuptools._distutils.version.Version.parse # abstract method
81+
setuptools._distutils.version.suppress_known_deprecation
8182
setuptools._distutils.versionpredicate
82-
setuptools._distutils.zosccompiler
8383

8484
# Reexported from setuptools._distutils; problems should be fixed there
8585
distutils\..+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from setuptools._distutils.compilers.C.cygwin import *
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from setuptools._distutils.compilers.C.zos import *
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from setuptools._distutils.cygwinccompiler import *
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from setuptools._distutils.version import *
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from setuptools._distutils.zosccompiler import *

stubs/setuptools/setuptools/_distutils/compilers/C/base.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused
22
from collections.abc import Callable, Iterable, MutableSequence, Sequence
33
from subprocess import _ENV
44
from typing import ClassVar, Final, Literal, TypeVar, overload
5-
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
5+
from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated
66

77
_Macro: TypeAlias = tuple[str] | tuple[str, str | None]
88
_StrPathT = TypeVar("_StrPathT", bound=StrPath)
@@ -53,6 +53,12 @@ class Compiler:
5353
def set_link_objects(self, objects: list[str]) -> None: ...
5454
def detect_language(self, sources: str | list[str]) -> str | None: ...
5555
def find_library_file(self, dirs: Iterable[str], lib: str, debug: bool = False) -> str | None: ...
56+
@overload
57+
def has_function(
58+
self, funcname: str, libraries: list[str] | None = None, library_dirs: list[str] | tuple[str, ...] | None = None
59+
) -> bool: ...
60+
@overload
61+
@deprecated("The `includes`, `include_dirs` parameters are deprecated.")
5662
def has_function(
5763
self,
5864
funcname: str,
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
from _typeshed import StrPath
2+
from collections.abc import Callable, Iterable
3+
from shlex import _ShlexInstream
4+
from typing import ClassVar, Final, Literal, NoReturn
5+
from typing_extensions import Never, deprecated
6+
7+
from ...version import LooseVersion
8+
from . import unix
9+
10+
def get_msvcr() -> list[str]: ...
11+
12+
class Compiler(unix.Compiler):
13+
compiler_type: ClassVar[str]
14+
obj_extension: ClassVar[str]
15+
static_lib_extension: ClassVar[str]
16+
shared_lib_extension: ClassVar[str]
17+
dylib_lib_extension: ClassVar[str]
18+
static_lib_format: ClassVar[str]
19+
shared_lib_format: ClassVar[str]
20+
dylib_lib_format: ClassVar[str]
21+
exe_extension: ClassVar[str]
22+
cc: str
23+
cxx: str
24+
linker_dll: str
25+
linker_dll_cxx: str
26+
dll_libraries: list[str]
27+
def __init__(self, verbose: bool = False, force: bool = False) -> None: ...
28+
@property
29+
@deprecated(
30+
"gcc_version attribute of CygwinCCompiler is deprecated. "
31+
"Instead of returning actual gcc version a fixed value 11.2.0 is returned."
32+
)
33+
def gcc_version(self) -> LooseVersion: ...
34+
# `objects` and `libraries` uses list methods
35+
def link(
36+
self,
37+
target_desc: str,
38+
objects: list[str], # type: ignore[override]
39+
output_filename: str,
40+
output_dir: str | None = None,
41+
libraries: list[str] | None = None, # type: ignore[override]
42+
library_dirs: list[str] | tuple[str, ...] | None = None,
43+
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
44+
export_symbols: Iterable[str] | None = None,
45+
debug: bool = False,
46+
extra_preargs: list[str] | None = None,
47+
extra_postargs: list[str] | None = None,
48+
build_temp: StrPath | None = None,
49+
target_lang: str | None = None,
50+
) -> None: ...
51+
# cygwin doesn't support rpath; prints a warning and returns an empty list
52+
def runtime_library_dir_option(self, dir: str) -> list[Never]: ... # type: ignore[override]
53+
@property
54+
def out_extensions(self) -> dict[str, str]: ...
55+
56+
class MinGW32Compiler(Compiler):
57+
compiler_type: ClassVar[str]
58+
def __init__(self, verbose: bool = False, force: bool = False) -> None: ...
59+
def runtime_library_dir_option(self, dir: str) -> NoReturn: ...
60+
61+
CONFIG_H_OK: Final = "ok"
62+
CONFIG_H_NOTOK: Final = "not ok"
63+
CONFIG_H_UNCERTAIN: Final = "uncertain"
64+
65+
def check_config_h() -> tuple[Literal["ok", "not ok", "uncertain"], str]: ...
66+
def is_cygwincc(cc: str | _ShlexInstream) -> bool: ...
67+
68+
get_versions: Callable[[], tuple[LooseVersion | None, ...]] | None

stubs/setuptools/setuptools/_distutils/compilers/C/msvc.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Compiler(base.Compiler):
1616
static_lib_format = shared_lib_format
1717
exe_extension: ClassVar[str]
1818
initialized: bool
19+
plat_name: str | None
1920
def initialize(self, plat_name: str | None = None) -> None: ...
2021
@property
2122
def out_extensions(self) -> dict[str, str]: ...
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from _typeshed import StrPath
2+
from collections.abc import Iterable
3+
from typing import ClassVar, Literal
4+
5+
from . import unix
6+
7+
class Compiler(unix.Compiler):
8+
src_extensions: ClassVar[list[str]]
9+
zos_compiler: Literal["ibm-openxl", "ibm-xlclang", "ibm-xlc"]
10+
def __init__(self, verbose: bool = False, force: bool = False) -> None: ...
11+
def runtime_library_dir_option(self, dir: str) -> str: ...
12+
def link(
13+
self,
14+
target_desc: str,
15+
objects: list[str] | tuple[str, ...],
16+
output_filename: str,
17+
output_dir: str | None = None,
18+
libraries: list[str] | tuple[str, ...] | None = None,
19+
library_dirs: list[str] | tuple[str, ...] | None = None,
20+
runtime_library_dirs: list[str] | tuple[str, ...] | None = None,
21+
export_symbols: Iterable[str] | None = None,
22+
debug: bool = False,
23+
extra_preargs: list[str] | None = None,
24+
extra_postargs: list[str] | None = None,
25+
build_temp: StrPath | None = None,
26+
target_lang: str | None = None,
27+
) -> None: ...

0 commit comments

Comments
 (0)