aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-01-29 21:28:12 -0500
committerEli Schwartz <eschwartz@archlinux.org>2023-06-26 13:10:33 -0400
commit5849979afaed8c8abd95cbe0226fe7bb97d6e62e (patch)
treefcff5ad9513d88649a80d23c78720c08c97db778
parentb8b2d87567af8e7f556e290c3585e7ac462679b6 (diff)
downloadmeson-5849979afaed8c8abd95cbe0226fe7bb97d6e62e.zip
meson-5849979afaed8c8abd95cbe0226fe7bb97d6e62e.tar.gz
meson-5849979afaed8c8abd95cbe0226fe7bb97d6e62e.tar.bz2
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.
-rw-r--r--mesonbuild/interpreter/interpreter.py2
-rw-r--r--test cases/unit/113 empty project/expected_mods.json19
-rw-r--r--unittests/platformagnostictests.py2
3 files changed, 4 insertions, 19 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index c5e25d3..dd2cabf 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -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
diff --git a/test cases/unit/113 empty project/expected_mods.json b/test cases/unit/113 empty project/expected_mods.json
index e4c699c..05f4cb6 100644
--- a/test cases/unit/113 empty project/expected_mods.json
+++ b/test cases/unit/113 empty project/expected_mods.json
@@ -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
}
}
diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py
index 94ddec0..2647684 100644
--- a/unittests/platformagnostictests.py
+++ b/unittests/platformagnostictests.py
@@ -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)