aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/cmake
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-06-14 00:42:26 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-07-03 14:11:31 -0400
commit0703ee0aef68e235c1e22d6448b79dfbbb5c8039 (patch)
tree0f7ba031362d926b726852d2070ecc8377bdb5bd /mesonbuild/cmake
parent46148f923b196e1b1d004e68d43edc2daca4dd25 (diff)
downloadmeson-0703ee0aef68e235c1e22d6448b79dfbbb5c8039.zip
meson-0703ee0aef68e235c1e22d6448b79dfbbb5c8039.tar.gz
meson-0703ee0aef68e235c1e22d6448b79dfbbb5c8039.tar.bz2
move various unused typing-only imports into type-checking blocks
Diffstat (limited to 'mesonbuild/cmake')
-rw-r--r--mesonbuild/cmake/executor.py7
-rw-r--r--mesonbuild/cmake/interpreter.py7
-rw-r--r--mesonbuild/cmake/toolchain.py3
3 files changed, 12 insertions, 5 deletions
diff --git a/mesonbuild/cmake/executor.py b/mesonbuild/cmake/executor.py
index 309b429..526620d 100644
--- a/mesonbuild/cmake/executor.py
+++ b/mesonbuild/cmake/executor.py
@@ -14,20 +14,23 @@
# This class contains the basic functionality needed to run any interpreter
# or an interpreter-based tool.
+from __future__ import annotations
import subprocess as S
-from pathlib import Path
from threading import Thread
import typing as T
import re
import os
from .. import mlog
-from ..mesonlib import PerMachine, Popen_safe, version_compare, MachineChoice, is_windows, OptionKey
+from ..mesonlib import PerMachine, Popen_safe, version_compare, is_windows, OptionKey
from ..programs import find_external_program, NonExistingExternalProgram
if T.TYPE_CHECKING:
+ from pathlib import Path
+
from ..environment import Environment
+ from ..mesonlib import MachineChoice
from ..programs import ExternalProgram
TYPE_result = T.Tuple[int, T.Optional[str], T.Optional[str]]
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py
index 2d88079..88ab13f 100644
--- a/mesonbuild/cmake/interpreter.py
+++ b/mesonbuild/cmake/interpreter.py
@@ -14,6 +14,7 @@
# This class contains the basic functionality needed to run any interpreter
# or an interpreter-based tool.
+from __future__ import annotations
from functools import lru_cache
from os import environ
@@ -21,11 +22,11 @@ from pathlib import Path
import re
import typing as T
-from .common import CMakeException, CMakeTarget, TargetOptions, CMakeConfiguration, language_map, cmake_get_generator_args, check_cmake_args
+from .common import CMakeException, CMakeTarget, language_map, cmake_get_generator_args, check_cmake_args
from .fileapi import CMakeFileAPI
from .executor import CMakeExecutor
from .toolchain import CMakeToolchain, CMakeExecScope
-from .traceparser import CMakeTraceParser, CMakeGeneratorTarget
+from .traceparser import CMakeTraceParser
from .tracetargets import resolve_cmake_trace_targets
from .. import mlog, mesonlib
from ..mesonlib import MachineChoice, OrderedSet, path_is_in_root, relative_to_if_possible, OptionKey
@@ -51,6 +52,8 @@ from ..mparser import (
if T.TYPE_CHECKING:
+ from .common import CMakeConfiguration, TargetOptions
+ from .traceparser import CMakeGeneratorTarget
from .._typing import ImmutableListProtocol
from ..build import Build
from ..backend.backends import Backend
diff --git a/mesonbuild/cmake/toolchain.py b/mesonbuild/cmake/toolchain.py
index e30f642..b70a5bc 100644
--- a/mesonbuild/cmake/toolchain.py
+++ b/mesonbuild/cmake/toolchain.py
@@ -11,11 +11,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
from pathlib import Path
from .traceparser import CMakeTraceParser
from ..envconfig import CMakeSkipCompilerTest
-from ..mesonlib import MachineChoice
from ..compilers import VisualStudioLikeCompiler
from .common import language_map, cmake_get_generator_args
from .. import mlog
@@ -29,6 +29,7 @@ if T.TYPE_CHECKING:
from .executor import CMakeExecutor
from ..environment import Environment
from ..compilers import Compiler
+ from ..mesonlib import MachineChoice
class CMakeExecScope(Enum):
SUBPROJECT = 'subproject'