stop importing cmake when it isn't used

We don't need a CMakeInterpreter until and unless we actually attempt to
use a cmake subproject via the cmake module.

Minus 10 files and 3679 lines of code imported at startup.
This commit is contained in:
Eli Schwartz 2023-01-29 21:28:12 -05:00
parent b8b2d87567
commit 5849979afa
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
3 changed files with 4 additions and 19 deletions

View File

@ -36,7 +36,6 @@ from ..interpreterbase import Disabler, disablerIfNotFound
from ..interpreterbase import FeatureNew, FeatureDeprecated, FeatureBroken, FeatureNewKwargs, FeatureDeprecatedKwargs
from ..interpreterbase import ObjectHolder, ContextManagerObject
from ..modules import ExtensionModule, ModuleObject, MutableModuleObject, NewExtensionModule, NotFoundExtensionModule
from ..cmake import CMakeInterpreter
from ..backend.backends import ExecutableSerialisation
from . import interpreterobjects as OBJ
@ -1011,6 +1010,7 @@ class Interpreter(InterpreterBase, HoldableObject):
def _do_subproject_cmake(self, subp_name: str, subdir: str, subdir_abs: str,
default_options: T.Dict[OptionKey, str],
kwargs: kwtypes.DoSubproject) -> SubprojectHolder:
from ..cmake import CMakeInterpreter
with mlog.nested(subp_name):
new_build = self.build.copy()
prefix = self.coredata.options[OptionKey('prefix')].value

View File

@ -94,14 +94,9 @@
"http",
"http.client",
"importlib",
"importlib._abc",
"importlib._adapters",
"importlib._bootstrap",
"importlib._bootstrap_external",
"importlib._common",
"importlib.abc",
"importlib.machinery",
"importlib.resources",
"inspect",
"io",
"itertools",
@ -169,7 +164,7 @@
"zipimport",
"zlib"
],
"count": 167
"count": 162
},
"meson": {
"modules": [
@ -186,15 +181,6 @@
"mesonbuild.backend.backends",
"mesonbuild.backend.ninjabackend",
"mesonbuild.build",
"mesonbuild.cmake",
"mesonbuild.cmake.common",
"mesonbuild.cmake.executor",
"mesonbuild.cmake.fileapi",
"mesonbuild.cmake.generator",
"mesonbuild.cmake.interpreter",
"mesonbuild.cmake.toolchain",
"mesonbuild.cmake.traceparser",
"mesonbuild.cmake.tracetargets",
"mesonbuild.compilers",
"mesonbuild.compilers.compilers",
"mesonbuild.compilers.detect",
@ -232,7 +218,6 @@
"mesonbuild.linkers",
"mesonbuild.linkers.detect",
"mesonbuild.linkers.linkers",
"mesonbuild.mesondata",
"mesonbuild.mesonlib",
"mesonbuild.mesonmain",
"mesonbuild.mintro",
@ -255,6 +240,6 @@
"mesonbuild.wrap",
"mesonbuild.wrap.wrap"
],
"count": 81
"count": 71
}
}

View File

@ -253,4 +253,4 @@ class PlatformAgnosticTests(BasePlatformTests):
expected = json.load(f)['meson']['modules']
self.assertEqual(data['modules'], expected)
self.assertEqual(data['count'], 81)
self.assertEqual(data['count'], 71)