aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/wrap
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-02-10 21:39:50 -0500
committerEli Schwartz <eschwartz@archlinux.org>2022-02-14 20:40:41 -0500
commitc0b8e02d9fb1b58551b18e68ae188263dd90eb4c (patch)
treeac67d9907a21c04308b33f9a6889b88dad735de7 /mesonbuild/wrap
parentbab651a7a03b48ff909a49eabe2dbcef0e821496 (diff)
downloadmeson-c0b8e02d9fb1b58551b18e68ae188263dd90eb4c.zip
meson-c0b8e02d9fb1b58551b18e68ae188263dd90eb4c.tar.gz
meson-c0b8e02d9fb1b58551b18e68ae188263dd90eb4c.tar.bz2
FeatureNew: add mypy type annotations for subproject arg
Use a derived type when passing `subproject` around, so that mypy knows it's actually a SubProject, not a str. This means that passing anything other than a handle to the interpreter state's subproject attribute becomes a type violation, specifically when the order of the *four* different str arguments is typoed.
Diffstat (limited to 'mesonbuild/wrap')
-rw-r--r--mesonbuild/wrap/wrap.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index 21eb9d6..51632fd 100644
--- a/mesonbuild/wrap/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -35,6 +35,7 @@ from . import WrapMode
from .. import coredata
from ..mesonlib import quiet_git, GIT, ProgressBar, MesonException, windows_proof_rmtree
from ..interpreterbase import FeatureNew
+from ..interpreterbase import SubProject
from .. import mesonlib
if T.TYPE_CHECKING:
@@ -95,7 +96,7 @@ class WrapNotFoundException(WrapException):
class PackageDefinition:
def __init__(self, fname: str, subproject: str = ''):
self.filename = fname
- self.subproject = subproject
+ self.subproject = SubProject(subproject)
self.type = None # type: T.Optional[str]
self.values = {} # type: T.Dict[str, str]
self.provided_deps = {} # type: T.Dict[str, T.Optional[str]]