diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py index 15d279350..5edd9b3d9 100644 --- a/mesonbuild/ast/interpreter.py +++ b/mesonbuild/ast/interpreter.py @@ -43,7 +43,6 @@ from ..mparser import ( NotNode, PlusAssignmentNode, TernaryNode, - TestCaseClauseNode, ) if T.TYPE_CHECKING: @@ -57,6 +56,7 @@ if T.TYPE_CHECKING: IfClauseNode, IndexNode, OrNode, + TestCaseClauseNode, UMinusNode, ) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 7057fc2a2..e4e5b6f34 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -12,7 +12,6 @@ import typing as T from dataclasses import dataclass from functools import lru_cache -from .. import coredata from .. import mlog from .. import mesonlib from .. import options @@ -27,7 +26,7 @@ from ..options import OptionKey from ..arglist import CompilerArgs if T.TYPE_CHECKING: - from typing import Any + from .. import coredata from ..build import BuildTarget, DFeatures from ..coredata import MutableKeyedOptionDictType, KeyedOptionDictType from ..envconfig import MachineInfo @@ -1360,7 +1359,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): def get_global_options(lang: str, comp: T.Type[Compiler], for_machine: MachineChoice, - env: 'Environment') -> 'dict[OptionKey, options.UserOption[Any]]': + env: 'Environment') -> dict[OptionKey, options.UserOption[T.Any]]: """Retrieve options that apply to all compilers for a given language.""" description = f'Extra arguments passed to the {lang}' argkey = OptionKey(f'{lang}_args', machine=for_machine) @@ -1390,6 +1389,6 @@ def get_global_options(lang: str, # autotools compatibility. largs.extend_value(comp_options) - opts: 'dict[OptionKey, options.UserOption[Any]]' = {argkey: cargs, largkey: largs} + opts: dict[OptionKey, options.UserOption[T.Any]] = {argkey: cargs, largkey: largs} return opts diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index d8b252a94..8ee6ebf65 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -16,7 +16,6 @@ from ..mesonlib import ( ) from ..options import OptionKey -from . import compilers from .compilers import ( clike_debug_args, Compiler, @@ -26,6 +25,7 @@ from .mixins.gnu import GnuCompiler from .mixins.gnu import gnu_common_warning_args if T.TYPE_CHECKING: + from . import compilers from ..build import DFeatures from ..dependencies import Dependency from ..envconfig import MachineInfo diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py index 33b6134a3..64315ae96 100644 --- a/mesonbuild/compilers/mixins/emscripten.py +++ b/mesonbuild/compilers/mixins/emscripten.py @@ -8,7 +8,6 @@ from __future__ import annotations import os.path import typing as T -from ... import coredata from ... import options from ... import mesonlib from ...options import OptionKey @@ -16,6 +15,7 @@ from ...mesonlib import LibType from mesonbuild.compilers.compilers import CompileCheckMode if T.TYPE_CHECKING: + from ... import coredata from ...environment import Environment from ...compilers.compilers import Compiler from ...dependencies import Dependency diff --git a/mesonbuild/compilers/objc.py b/mesonbuild/compilers/objc.py index 37958d8a0..97550c2ea 100644 --- a/mesonbuild/compilers/objc.py +++ b/mesonbuild/compilers/objc.py @@ -5,7 +5,6 @@ from __future__ import annotations import typing as T -from .. import coredata from .. import options from ..options import OptionKey @@ -15,6 +14,7 @@ from .mixins.gnu import GnuCompiler, gnu_common_warning_args, gnu_objc_warning_a from .mixins.clang import ClangCompiler if T.TYPE_CHECKING: + from .. import coredata from ..envconfig import MachineInfo from ..environment import Environment from ..linkers.linkers import DynamicLinker diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py index 6388d41c3..973d7bb0c 100644 --- a/mesonbuild/compilers/objcpp.py +++ b/mesonbuild/compilers/objcpp.py @@ -5,7 +5,6 @@ from __future__ import annotations import typing as T -from .. import coredata from .. import options from ..options import OptionKey @@ -15,6 +14,7 @@ from .mixins.gnu import GnuCompiler, gnu_common_warning_args, gnu_objc_warning_a from .mixins.clang import ClangCompiler if T.TYPE_CHECKING: + from .. import coredata from ..envconfig import MachineInfo from ..environment import Environment from ..linkers.linkers import DynamicLinker diff --git a/mesonbuild/compilers/vala.py b/mesonbuild/compilers/vala.py index f890ea815..a1d57b38c 100644 --- a/mesonbuild/compilers/vala.py +++ b/mesonbuild/compilers/vala.py @@ -11,9 +11,9 @@ from .. import mesonlib from ..mesonlib import EnvironmentException, version_compare, LibType from ..options import OptionKey from .compilers import CompileCheckMode, Compiler -from ..arglist import CompilerArgs if T.TYPE_CHECKING: + from ..arglist import CompilerArgs from ..coredata import KeyedOptionDictType from ..envconfig import MachineInfo from ..environment import Environment diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 83e83e728..276c3a678 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -27,12 +27,12 @@ from .options import OptionKey from .machinefile import CmdLineFileParser import ast -import argparse import enum import shlex import typing as T if T.TYPE_CHECKING: + import argparse from typing_extensions import Protocol from typing import Any diff --git a/mesonbuild/mformat.py b/mesonbuild/mformat.py index 42f562e7f..33ee69d3c 100644 --- a/mesonbuild/mformat.py +++ b/mesonbuild/mformat.py @@ -3,7 +3,6 @@ from __future__ import annotations -import argparse import re import typing as T from configparser import ConfigParser, MissingSectionHeaderError, ParsingError @@ -19,6 +18,7 @@ from .ast.visitor import FullAstVisitor from .environment import build_filename if T.TYPE_CHECKING: + import argparse from typing_extensions import Literal diff --git a/mesonbuild/modules/python3.py b/mesonbuild/modules/python3.py index 45ad850aa..2e6779ab2 100644 --- a/mesonbuild/modules/python3.py +++ b/mesonbuild/modules/python3.py @@ -7,7 +7,7 @@ import sysconfig import typing as T from .. import mesonlib -from . import ExtensionModule, ModuleInfo, ModuleState +from . import ExtensionModule, ModuleInfo from ..build import ( BuildTarget, CustomTarget, CustomTargetIndex, ExtractedObjects, GeneratedList, SharedModule, StructuredSources, known_shmod_kwargs @@ -17,6 +17,7 @@ from ..interpreterbase import typed_kwargs, typed_pos_args, noPosargs, noKwargs, from ..programs import ExternalProgram if T.TYPE_CHECKING: + from . import ModuleState from ..interpreter.interpreter import BuildTargetSource from ..interpreter.kwargs import SharedModule as SharedModuleKW diff --git a/mesonbuild/optinterpreter.py b/mesonbuild/optinterpreter.py index a22152829..4688ee4c4 100644 --- a/mesonbuild/optinterpreter.py +++ b/mesonbuild/optinterpreter.py @@ -6,7 +6,6 @@ from __future__ import annotations import re import typing as T -from . import coredata from . import options from . import mesonlib from .options import OptionKey @@ -16,6 +15,7 @@ from .interpreterbase import FeatureNew, FeatureDeprecated, typed_pos_args, type from .interpreter.type_checking import NoneType, in_set_validator if T.TYPE_CHECKING: + from . import coredata from .interpreterbase import TYPE_var, TYPE_kwargs from .interpreterbase import SubProject from typing_extensions import TypedDict, Literal