distutils: improve boolean parameters with int defaults (#11928)

This commit is contained in:
Avasam
2024-05-17 02:33:18 -04:00
committed by GitHub
parent 240114ac1a
commit c99adf4b85
26 changed files with 228 additions and 141 deletions

View File

@@ -1,5 +1,5 @@
from collections.abc import Callable
from typing import Any
from typing import Any, Literal
from typing_extensions import TypeAlias
_Macro: TypeAlias = tuple[str] | tuple[str, str | None]
@@ -10,7 +10,11 @@ def gen_lib_options(
def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ...
def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str: ...
def new_compiler(
plat: str | None = None, compiler: str | None = None, verbose: int = 0, dry_run: int = 0, force: int = 0
plat: str | None = None,
compiler: str | None = None,
verbose: bool | Literal[0, 1] = 0,
dry_run: bool | Literal[0, 1] = 0,
force: bool | Literal[0, 1] = 0,
) -> CCompiler: ...
def show_compilers() -> None: ...
@@ -25,7 +29,9 @@ class CCompiler:
library_dirs: list[str]
runtime_library_dirs: list[str]
objects: list[str]
def __init__(self, verbose: int = 0, dry_run: int = 0, force: int = 0) -> None: ...
def __init__(
self, verbose: bool | Literal[0, 1] = 0, dry_run: bool | Literal[0, 1] = 0, force: bool | Literal[0, 1] = 0
) -> None: ...
def add_include_dir(self, dir: str) -> None: ...
def set_include_dirs(self, dirs: list[str]) -> None: ...
def add_library(self, libname: str) -> None: ...
@@ -39,7 +45,7 @@ class CCompiler:
def add_link_object(self, object: str) -> None: ...
def set_link_objects(self, objects: list[str]) -> None: ...
def detect_language(self, sources: str | list[str]) -> str | None: ...
def find_library_file(self, dirs: list[str], lib: str, debug: bool = ...) -> str | None: ...
def find_library_file(self, dirs: list[str], lib: str, debug: bool | Literal[0, 1] = 0) -> str | None: ...
def has_function(
self,
funcname: str,
@@ -58,7 +64,7 @@ class CCompiler:
output_dir: str | None = None,
macros: list[_Macro] | None = None,
include_dirs: list[str] | None = None,
debug: bool = ...,
debug: bool | Literal[0, 1] = 0,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
depends: list[str] | None = None,
@@ -68,7 +74,7 @@ class CCompiler:
objects: list[str],
output_libname: str,
output_dir: str | None = None,
debug: bool = ...,
debug: bool | Literal[0, 1] = 0,
target_lang: str | None = None,
) -> None: ...
def link(
@@ -81,7 +87,7 @@ class CCompiler:
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
export_symbols: list[str] | None = None,
debug: bool = ...,
debug: bool | Literal[0, 1] = 0,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
build_temp: str | None = None,
@@ -95,7 +101,7 @@ class CCompiler:
libraries: list[str] | None = None,
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
debug: bool = ...,
debug: bool | Literal[0, 1] = 0,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
target_lang: str | None = None,
@@ -109,7 +115,7 @@ class CCompiler:
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
export_symbols: list[str] | None = None,
debug: bool = ...,
debug: bool | Literal[0, 1] = 0,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
build_temp: str | None = None,
@@ -124,7 +130,7 @@ class CCompiler:
library_dirs: list[str] | None = None,
runtime_library_dirs: list[str] | None = None,
export_symbols: list[str] | None = None,
debug: bool = ...,
debug: bool | Literal[0, 1] = 0,
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
build_temp: str | None = None,
@@ -139,10 +145,14 @@ class CCompiler:
extra_preargs: list[str] | None = None,
extra_postargs: list[str] | None = None,
) -> None: ...
def executable_filename(self, basename: str, strip_dir: int = 0, output_dir: str = "") -> str: ...
def library_filename(self, libname: str, lib_type: str = "static", strip_dir: int = 0, output_dir: str = "") -> str: ...
def object_filenames(self, source_filenames: list[str], strip_dir: int = 0, output_dir: str = "") -> list[str]: ...
def shared_object_filename(self, basename: str, strip_dir: int = 0, output_dir: str = "") -> str: ...
def executable_filename(self, basename: str, strip_dir: bool | Literal[0, 1] = 0, output_dir: str = "") -> str: ...
def library_filename(
self, libname: str, lib_type: str = "static", strip_dir: bool | Literal[0, 1] = 0, output_dir: str = ""
) -> str: ...
def object_filenames(
self, source_filenames: list[str], strip_dir: bool | Literal[0, 1] = 0, output_dir: str = ""
) -> list[str]: ...
def shared_object_filename(self, basename: str, strip_dir: bool | Literal[0, 1] = 0, output_dir: str = "") -> str: ...
def execute(self, func: Callable[..., object], args: tuple[Any, ...], msg: str | None = None, level: int = 1) -> None: ...
def spawn(self, cmd: list[str]) -> None: ...
def mkpath(self, name: str, mode: int = 0o777) -> None: ...