|
34 | 34 | import typing
|
35 | 35 | import warnings
|
36 | 36 |
|
37 |
| -from typing import Dict |
38 |
| - |
39 | 37 |
|
40 | 38 | if sys.version_info < (3, 11):
|
41 | 39 | import tomli as tomllib
|
|
51 | 49 | import mesonpy._util
|
52 | 50 | import mesonpy._wheelfile
|
53 | 51 |
|
54 |
| -from mesonpy._compat import Collection, Mapping, cached_property, read_binary |
| 52 | +from mesonpy._compat import cached_property, read_binary |
| 53 | + |
55 | 54 |
|
| 55 | +_MESON_ARGS_KEYS = ['dist', 'setup', 'compile', 'install'] |
56 | 56 |
|
57 | 57 | if typing.TYPE_CHECKING: # pragma: no cover
|
58 |
| - from typing import Any, Callable, DefaultDict, List, Literal, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union |
| 58 | + from typing import Any, Callable, DefaultDict, Dict, List, Literal, Optional, Sequence, TextIO, Tuple, Type, TypeVar, Union |
59 | 59 |
|
60 |
| - from mesonpy._compat import Iterator, ParamSpec, Path |
| 60 | + from mesonpy._compat import Collection, Iterator, Mapping, ParamSpec, Path |
61 | 61 |
|
62 | 62 | P = ParamSpec('P')
|
63 | 63 | T = TypeVar('T')
|
64 | 64 |
|
65 |
| - |
66 |
| -__version__ = '0.15.0.dev0' |
67 |
| - |
68 |
| - |
69 |
| -# XXX: Once Python 3.8 is our minimum supported version, get rid of |
70 |
| -# meson_args_keys and use typing.get_args(MesonArgsKeys) instead. |
71 |
| - |
72 |
| -# Keep both definitions in sync! |
73 |
| -_MESON_ARGS_KEYS = ['dist', 'setup', 'compile', 'install'] |
74 |
| -if typing.TYPE_CHECKING: |
75 | 65 | MesonArgsKeys = Literal['dist', 'setup', 'compile', 'install']
|
76 | 66 | MesonArgs = Mapping[MesonArgsKeys, List[str]]
|
77 |
| -else: |
78 |
| - MesonArgs = dict |
| 67 | + |
| 68 | + |
| 69 | +__version__ = '0.15.0.dev0' |
79 | 70 |
|
80 | 71 |
|
81 | 72 | _COLORS = {
|
@@ -952,7 +943,7 @@ def _project(config_settings: Optional[Dict[Any, Any]] = None) -> Iterator[Proje
|
952 | 943 | """Create the project given the given config settings."""
|
953 | 944 |
|
954 | 945 | settings = _validate_config_settings(config_settings or {})
|
955 |
| - meson_args = typing.cast(MesonArgs, {name: settings.get(f'{name}-args', []) for name in _MESON_ARGS_KEYS}) |
| 946 | + meson_args = typing.cast('MesonArgs', {name: settings.get(f'{name}-args', []) for name in _MESON_ARGS_KEYS}) |
956 | 947 | source_dir = os.path.curdir
|
957 | 948 | build_dir = settings.get('build-dir')
|
958 | 949 | editable_verbose = bool(settings.get('editable-verbose'))
|
|
0 commit comments