aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2024-04-18 14:35:39 -0700
committerDylan Baker <dylan@pnwbakers.com>2024-04-24 20:40:34 -0700
commitf603a266eca1d8138c37946a7f4ae3f3903c7e45 (patch)
treeceba04b7bfa111f07bd1b6eeecfe52148b57dbfa
parentcf0fecfcef77235257546a43811559aa08b6c5de (diff)
downloadmeson-f603a266eca1d8138c37946a7f4ae3f3903c7e45.zip
meson-f603a266eca1d8138c37946a7f4ae3f3903c7e45.tar.gz
meson-f603a266eca1d8138c37946a7f4ae3f3903c7e45.tar.bz2
backend: fix type annotation of Backend.generate
`func(value: dict = None)` is invalid, it must be `func(value: dict | None = None)`, or in our older syntax: `T.Optional[T.Dict] = None`
-rw-r--r--mesonbuild/backend/backends.py2
-rw-r--r--mesonbuild/backend/ninjabackend.py2
-rw-r--r--mesonbuild/backend/nonebackend.py3
-rw-r--r--mesonbuild/backend/vs2010backend.py2
-rw-r--r--mesonbuild/backend/xcodebackend.py2
5 files changed, 6 insertions, 5 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 0db5c79..a45de70 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -287,7 +287,7 @@ class Backend:
# 'vslite_ctx' is only provided when
# we expect this backend setup/generation to make use of previously captured
# compile args (as is the case when using '--genvslite').
- def generate(self, capture: bool = False, vslite_ctx: dict = None) -> T.Optional[dict]:
+ def generate(self, capture: bool = False, vslite_ctx: T.Optional[T.Dict] = None) -> T.Optional[T.Dict]:
raise RuntimeError(f'generate is not implemented in {type(self).__name__}')
def get_target_filename(self, t: T.Union[build.Target, build.CustomTargetIndex], *, warn_multi_output: bool = True) -> str:
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 32a36a9..228312d 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -581,7 +581,7 @@ class NinjaBackend(backends.Backend):
raise MesonException(f'Could not determine vs dep dependency prefix string. output: {stderr} {stdout}')
- def generate(self, capture: bool = False, vslite_ctx: dict = None) -> T.Optional[dict]:
+ def generate(self, capture: bool = False, vslite_ctx: T.Optional[T.Dict] = None) -> T.Optional[T.Dict]:
if vslite_ctx:
# We don't yet have a use case where we'd expect to make use of this,
# so no harm in catching and reporting something unexpected.
diff --git a/mesonbuild/backend/nonebackend.py b/mesonbuild/backend/nonebackend.py
index fa3f553..ab11e8d 100644
--- a/mesonbuild/backend/nonebackend.py
+++ b/mesonbuild/backend/nonebackend.py
@@ -2,6 +2,7 @@
# Copyright 2022 The Meson development team
from __future__ import annotations
+import typing as T
from .backends import Backend
from .. import mlog
@@ -12,7 +13,7 @@ class NoneBackend(Backend):
name = 'none'
- def generate(self, capture: bool = False, vslite_ctx: dict = None) -> None:
+ def generate(self, capture: bool = False, vslite_ctx: T.Optional[T.Dict] = None) -> None:
# Check for (currently) unexpected capture arg use cases -
if capture:
raise MesonBugException('We do not expect the none backend to generate with \'capture = True\'')
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 20ad266..9c23571 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -221,7 +221,7 @@ class Vs2010Backend(backends.Backend):
def generate(self,
capture: bool = False,
- vslite_ctx: dict = None) -> T.Optional[dict]:
+ vslite_ctx: T.Optional[T.Dict] = None) -> T.Optional[T.Dict]:
# Check for (currently) unexpected capture arg use cases -
if capture:
raise MesonBugException('We do not expect any vs backend to generate with \'capture = True\'')
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py
index 467cd1a..c801b5a 100644
--- a/mesonbuild/backend/xcodebackend.py
+++ b/mesonbuild/backend/xcodebackend.py
@@ -255,7 +255,7 @@ class XCodeBackend(backends.Backend):
result.append(os.path.join(self.environment.get_build_dir(), self.get_target_dir(l)))
return result
- def generate(self, capture: bool = False, vslite_ctx: dict = None) -> None:
+ def generate(self, capture: bool = False, vslite_ctx: T.Optional[T.Dict] = None) -> None:
# Check for (currently) unexpected capture arg use cases -
if capture:
raise MesonBugException('We do not expect the xcode backend to generate with \'capture = True\'')