summaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2023-11-26 01:03:08 -0500
committerXavier Claessens <xclaesse@gmail.com>2023-11-26 17:12:52 -0500
commitcaa38dad453905c968ecf1c021e2867f7f4a17e3 (patch)
treebd87db11f3b38ff02a005537a033ff4578744b4e /mesonbuild
parent319b41b4c9c9d6d776828519b141fea1427fe89e (diff)
downloadmeson-caa38dad453905c968ecf1c021e2867f7f4a17e3.tar.gz
fix broken type annotation imports being ignored
If an annotation could not be resolved, it's classified as a "missing import" and our configuration ignored it: ``` Skipping analyzing "mesonbuild.backends": module is installed, but missing library stubs or py.typed marker ``` As far as mypy is concerned, this library may or may not exist, but it doesn't have any typing information at all (may need to be installed first). We ignored this because of our docs/ and tools/ thirdparty dependencies, but we really should not. It is trivial to install them, and then enforce that this "just works". By enforcing it, we also make sure typos get caught.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/mixins/compcert.py2
-rw-r--r--mesonbuild/interpreter/compiler.py5
-rw-r--r--mesonbuild/mdevenv.py5
3 files changed, 7 insertions, 5 deletions
diff --git a/mesonbuild/compilers/mixins/compcert.py b/mesonbuild/compilers/mixins/compcert.py
index ac4d5aaa0..a40f635fa 100644
--- a/mesonbuild/compilers/mixins/compcert.py
+++ b/mesonbuild/compilers/mixins/compcert.py
@@ -20,7 +20,7 @@ import re
import typing as T
if T.TYPE_CHECKING:
- from envconfig import MachineInfo
+ from ...envconfig import MachineInfo
from ...environment import Environment
from ...compilers.compilers import Compiler
else:
diff --git a/mesonbuild/interpreter/compiler.py b/mesonbuild/interpreter/compiler.py
index 5528abe7a..ad6eb4b89 100644
--- a/mesonbuild/interpreter/compiler.py
+++ b/mesonbuild/interpreter/compiler.py
@@ -30,7 +30,7 @@ if T.TYPE_CHECKING:
from ..compilers import Compiler, RunResult
from ..interpreterbase import TYPE_var, TYPE_kwargs
from .kwargs import ExtractRequired, ExtractSearchDirs
- from .interpreter.interpreter import SourceOutputs
+ from .interpreter import SourceOutputs
from ..mlog import TV_LoggableList
from typing_extensions import TypedDict, Literal
@@ -856,7 +856,8 @@ class CompilerHolder(ObjectHolder['Compiler']):
)
def preprocess_method(self, args: T.Tuple[T.List['mesonlib.FileOrString']], kwargs: 'PreprocessKW') -> T.List[build.CustomTargetIndex]:
compiler = self.compiler.get_preprocessor()
- sources: 'SourceOutputs' = self.interpreter.source_strings_to_files(args[0])
+ _sources: T.List[mesonlib.File] = self.interpreter.source_strings_to_files(args[0])
+ sources = T.cast('T.List[SourceOutputs]', _sources)
if any(isinstance(s, (build.CustomTarget, build.CustomTargetIndex, build.GeneratedList)) for s in sources):
FeatureNew.single_use('compiler.preprocess with generated sources', '1.1.0', self.subproject,
location=self.current_node)
diff --git a/mesonbuild/mdevenv.py b/mesonbuild/mdevenv.py
index 9f3d1b973..c8d0144c5 100644
--- a/mesonbuild/mdevenv.py
+++ b/mesonbuild/mdevenv.py
@@ -5,6 +5,7 @@ import argparse
import tempfile
import shutil
import itertools
+import typing as T
from pathlib import Path
from . import build, minstall
@@ -12,9 +13,9 @@ from .mesonlib import (EnvironmentVariables, MesonException, is_windows, setup_v
get_wine_shortpath, MachineChoice)
from . import mlog
-import typing as T
+
if T.TYPE_CHECKING:
- from .backends import InstallData
+ from .backend.backends import InstallData
POWERSHELL_EXES = {'pwsh.exe', 'powershell.exe'}