summaryrefslogtreecommitdiff
path: root/mesonbuild/cmake/generator.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-08-10 21:19:29 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-08-11 13:41:03 -0400
commit90ce0841441506e3f409ab59ded1df8f2e6e7363 (patch)
tree3478769eef2620e9d7b5a41b73dd94c75b003465 /mesonbuild/cmake/generator.py
parentde1cc0b02bcb1bab6977f0ab8bb3fef0cd0646dd (diff)
downloadmeson-90ce0841441506e3f409ab59ded1df8f2e6e7363.tar.gz
treewide: automatic rewriting of all comment-style type annotations
Performed using https://github.com/ilevkivskyi/com2ann This has no actual effect on the codebase as type checkers (still) support both and negligible effect on runtime performance since __future__ annotations ameliorates that. Technically, the bytecode would be bigger for non function-local annotations, of which we have many either way. So if it doesn't really matter, why do a large-scale refactor? Simple: because people keep wanting to, but it's getting nickle-and-dimed. If we're going to do this we might as well do it consistently in one shot, using tooling that guarantees repeatability and correctness. Repeat with: ``` com2ann mesonbuild/ ```
Diffstat (limited to 'mesonbuild/cmake/generator.py')
-rw-r--r--mesonbuild/cmake/generator.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/cmake/generator.py b/mesonbuild/cmake/generator.py
index f47625c83..750e4c282 100644
--- a/mesonbuild/cmake/generator.py
+++ b/mesonbuild/cmake/generator.py
@@ -98,7 +98,7 @@ def parse_generator_expressions(
return ';'.join([x for x in tgt.properties['IMPORTED_LOCATION'] if x])
return ''
- supported = {
+ supported: T.Dict[str, T.Callable[[str], str]] = {
# Boolean functions
'BOOL': lambda x: '0' if x.upper() in {'', '0', 'FALSE', 'OFF', 'N', 'NO', 'IGNORE', 'NOTFOUND'} or x.endswith('-NOTFOUND') else '1',
'AND': lambda x: '1' if all(y == '1' for y in x.split(',')) else '0',
@@ -140,7 +140,7 @@ def parse_generator_expressions(
'TARGET_NAME_IF_EXISTS': lambda x: x if x in trace.targets else '',
'TARGET_PROPERTY': target_property,
'TARGET_FILE': target_file,
- } # type: T.Dict[str, T.Callable[[str], str]]
+ }
# Recursively evaluate generator expressions
def eval_generator_expressions() -> str: