File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 3434from collections .abc import Iterable
3535from glob import glob
3636from sysconfig import get_path
37- from typing import TYPE_CHECKING , Callable , TypeVar
37+ from typing import TYPE_CHECKING , Callable , TypedDict , TypeVar
3838
3939from jaraco .text import yield_lines
4040
@@ -2038,14 +2038,19 @@ def chmod(path, mode):
20382038 log .debug ("chmod failed: %s" , e )
20392039
20402040
2041+ class SplitArgs (TypedDict , total = False ):
2042+ comments : bool
2043+ posix : bool
2044+
2045+
20412046class CommandSpec (list ):
20422047 """
20432048 A command spec for a #! header, specified as a list of arguments akin to
20442049 those passed to Popen.
20452050 """
20462051
20472052 options : list [str ] = []
2048- split_args : dict [ str , bool ] = dict ()
2053+ split_args = SplitArgs ()
20492054
20502055 @classmethod
20512056 def best (cls ):
@@ -2128,7 +2133,7 @@ def _render(items):
21282133
21292134
21302135class WindowsCommandSpec (CommandSpec ):
2131- split_args = dict (posix = False )
2136+ split_args = SplitArgs (posix = False )
21322137
21332138
21342139class ScriptWriter :
Original file line number Diff line number Diff line change 1313import os
1414import os .path
1515import platform
16- from typing import TYPE_CHECKING
16+ from typing import TYPE_CHECKING , TypedDict
1717
1818from more_itertools import unique_everseen
1919
2020import distutils .errors
2121
22+ if TYPE_CHECKING :
23+ from typing_extensions import NotRequired
24+
2225# https://github.com/python/mypy/issues/8166
2326if not TYPE_CHECKING and platform .system () == 'Windows' :
2427 import winreg
@@ -876,6 +879,14 @@ def _use_last_dir_name(path, prefix=''):
876879 return next (matching_dirs , None ) or ''
877880
878881
882+ class EnvironmentDict (TypedDict ):
883+ include : str
884+ lib : str
885+ libpath : str
886+ path : str
887+ py_vcruntime_redist : NotRequired [str | None ]
888+
889+
879890class EnvironmentInfo :
880891 """
881892 Return environment variables for specified Microsoft Visual C++ version
@@ -1420,7 +1431,7 @@ def VCRuntimeRedist(self) -> str | None:
14201431 )
14211432 return next (filter (os .path .isfile , candidate_paths ), None ) # type: ignore[arg-type] #python/mypy#12682
14221433
1423- def return_env (self , exists = True ):
1434+ def return_env (self , exists : bool = True ) -> EnvironmentDict :
14241435 """
14251436 Return environment dict.
14261437
@@ -1434,7 +1445,7 @@ def return_env(self, exists=True):
14341445 dict
14351446 environment
14361447 """
1437- env = dict (
1448+ env = EnvironmentDict (
14381449 include = self ._build_paths (
14391450 'include' ,
14401451 [
You can’t perform that action at this time.
0 commit comments