aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/compilers/detect.py18
-rw-r--r--mesonbuild/dependencies/factory.py5
-rw-r--r--mesonbuild/interpreter/primitives/boolean.py5
-rw-r--r--mesonbuild/interpreterbase/_unholder.py8
-rw-r--r--mesonbuild/modules/cmake.py3
-rw-r--r--mesonbuild/rewriter.py6
6 files changed, 29 insertions, 16 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index 74f2f17..05ae86f 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -11,9 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
from ..mesonlib import (
- MachineChoice, MesonException, EnvironmentException,
+ MesonException, EnvironmentException,
search_version, is_windows, Popen_safe, windows_proof_rm,
)
from ..envconfig import BinaryTable
@@ -40,7 +41,6 @@ from ..linkers import (
NvidiaHPC_DynamicLinker,
PGIDynamicLinker,
PGIStaticLinker,
- StaticLinker,
Xc16Linker,
Xc16DynamicLinker,
XilinkDynamicLinker,
@@ -50,9 +50,7 @@ from ..linkers import (
VisualStudioLikeLinkerMixin,
WASMDynamicLinker,
)
-from .compilers import Compiler
from .c import (
- CCompiler,
AppleClangCCompiler,
ArmCCompiler,
ArmclangCCompiler,
@@ -74,7 +72,6 @@ from .c import (
VisualStudioCCompiler,
)
from .cpp import (
- CPPCompiler,
AppleClangCPPCompiler,
ArmCPPCompiler,
ArmclangCPPCompiler,
@@ -102,7 +99,6 @@ from .d import (
)
from .cuda import CudaCompiler
from .fortran import (
- FortranCompiler,
ArmLtdFlangFortranCompiler,
G95FortranCompiler,
GnuFortranCompiler,
@@ -119,13 +115,11 @@ from .fortran import (
)
from .java import JavaCompiler
from .objc import (
- ObjCCompiler,
AppleClangObjCCompiler,
ClangObjCCompiler,
GnuObjCCompiler,
)
from .objcpp import (
- ObjCPPCompiler,
AppleClangObjCPPCompiler,
ClangObjCPPCompiler,
GnuObjCPPCompiler,
@@ -147,7 +141,15 @@ import os
import typing as T
if T.TYPE_CHECKING:
+ from .compilers import Compiler
+ from .c import CCompiler
+ from .cpp import CPPCompiler
+ from .fortran import FortranCompiler
+ from .objc import ObjCCompiler
+ from .objcpp import ObjCPPCompiler
+ from ..linkers import StaticLinker
from ..environment import Environment
+ from ..mesonlib import MachineChoice
from ..programs import ExternalProgram
diff --git a/mesonbuild/dependencies/factory.py b/mesonbuild/dependencies/factory.py
index 2844cf4..48cd5ab 100644
--- a/mesonbuild/dependencies/factory.py
+++ b/mesonbuild/dependencies/factory.py
@@ -12,11 +12,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
import functools
import typing as T
-from ..mesonlib import MachineChoice
from .base import DependencyException, DependencyMethods
from .base import ExternalDependency
from .base import process_method_kw
@@ -26,8 +26,9 @@ from .framework import ExtraFrameworkDependency
from .pkgconfig import PkgConfigDependency
if T.TYPE_CHECKING:
- from ..environment import Environment
from .configtool import ConfigToolDependency
+ from ..environment import Environment
+ from ..mesonlib import MachineChoice
DependencyGenerator = T.Callable[[], ExternalDependency]
FactoryFunc = T.Callable[
diff --git a/mesonbuild/interpreter/primitives/boolean.py b/mesonbuild/interpreter/primitives/boolean.py
index 0a434af..4b49caf 100644
--- a/mesonbuild/interpreter/primitives/boolean.py
+++ b/mesonbuild/interpreter/primitives/boolean.py
@@ -1,5 +1,6 @@
# Copyright 2021 The Meson development team
# SPDX-license-identifier: Apache-2.0
+from __future__ import annotations
from ...interpreterbase import (
ObjectHolder,
@@ -8,9 +9,6 @@ from ...interpreterbase import (
noKwargs,
noPosargs,
- TYPE_var,
- TYPE_kwargs,
-
InvalidArguments
)
@@ -19,6 +17,7 @@ import typing as T
if T.TYPE_CHECKING:
# Object holders need the actual interpreter
from ...interpreter import Interpreter
+ from ...interpreterbase import TYPE_var, TYPE_kwargs
class BooleanHolder(ObjectHolder[bool]):
def __init__(self, obj: bool, interpreter: 'Interpreter') -> None:
diff --git a/mesonbuild/interpreterbase/_unholder.py b/mesonbuild/interpreterbase/_unholder.py
index 7157d17..4f1edc1 100644
--- a/mesonbuild/interpreterbase/_unholder.py
+++ b/mesonbuild/interpreterbase/_unholder.py
@@ -11,11 +11,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import annotations
-from .baseobjects import InterpreterObject, MesonInterpreterObject, ObjectHolder, TYPE_var, HoldableTypes
+import typing as T
+
+from .baseobjects import InterpreterObject, MesonInterpreterObject, ObjectHolder, HoldableTypes
from .exceptions import InvalidArguments
from ..mesonlib import HoldableObject, MesonBugException
+if T.TYPE_CHECKING:
+ from .baseobjects import TYPE_var
+
def _unholder(obj: InterpreterObject) -> TYPE_var:
if isinstance(obj, ObjectHolder):
assert isinstance(obj.held_object, HoldableTypes)
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py
index a263e52..a219268 100644
--- a/mesonbuild/modules/cmake.py
+++ b/mesonbuild/modules/cmake.py
@@ -21,7 +21,7 @@ import typing as T
from . import ExtensionModule, ModuleReturnValue, ModuleObject
from .. import build, mesonlib, mlog, dependencies
-from ..cmake import SingleTargetOptions, TargetOptions, cmake_defines_to_args
+from ..cmake import TargetOptions, cmake_defines_to_args
from ..interpreter import SubprojectHolder
from ..interpreter.type_checking import REQUIRED_KW, NoneType, in_set_validator
from ..interpreterbase import (
@@ -46,6 +46,7 @@ if T.TYPE_CHECKING:
from typing_extensions import TypedDict
from . import ModuleState
+ from ..cmake import SingleTargetOptions
from ..interpreter import kwargs
class WriteBasicPackageVersionFile(TypedDict):
diff --git a/mesonbuild/rewriter.py b/mesonbuild/rewriter.py
index d816cce..7c8e414 100644
--- a/mesonbuild/rewriter.py
+++ b/mesonbuild/rewriter.py
@@ -22,15 +22,19 @@
# - remove files from a target
# - move targets
# - reindent?
+from __future__ import annotations
from .ast import IntrospectionInterpreter, build_target_functions, AstConditionLevel, AstIDGenerator, AstIndentationGenerator, AstPrinter
from mesonbuild.mesonlib import MesonException
from . import mlog, environment
from functools import wraps
-from .mparser import Token, ArrayNode, ArgumentNode, AssignmentNode, BaseNode, BooleanNode, ElementaryNode, IdNode, FunctionNode, StringNode
+from .mparser import Token, ArrayNode, ArgumentNode, AssignmentNode, BooleanNode, ElementaryNode, IdNode, FunctionNode, StringNode
import json, os, re, sys
import typing as T
+if T.TYPE_CHECKING:
+ from .mparser import BaseNode
+
class RewriterException(MesonException):
pass