From c82305db0c5216f821e43bfc7ea3c8e314d0dccd Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 17 Jan 2023 18:05:12 -0500 Subject: dependencies: delay often-unused imports We expose detect.py as the mesonbuild.dependencies entrypoint and import it upfront everywhere. But unless the `dependency()` function is actually invoked, we don't need *any* of the private implementations for this. Avoid doing so until, as part of actual dependency lookup, we attempt that specific dependency method. This avoids importing big modules if `method:` is specified, and in most cases hopefully pkg-config works and we can avoid importing the cmake implementation particularly. Actually avoiding most of these imports requires more refactoring. But even so, the garden path no longer needs to import the dub dependency impl. --- test cases/unit/113 empty project/expected_mods.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test cases/unit') diff --git a/test cases/unit/113 empty project/expected_mods.json b/test cases/unit/113 empty project/expected_mods.json index 2e7c2892a..9ad84d482 100644 --- a/test cases/unit/113 empty project/expected_mods.json +++ b/test cases/unit/113 empty project/expected_mods.json @@ -208,7 +208,6 @@ "mesonbuild.dependencies.cuda", "mesonbuild.dependencies.detect", "mesonbuild.dependencies.dev", - "mesonbuild.dependencies.dub", "mesonbuild.dependencies.factory", "mesonbuild.dependencies.framework", "mesonbuild.dependencies.hdf5", @@ -272,6 +271,6 @@ "mesonbuild.wrap", "mesonbuild.wrap.wrap" ], - "count": 98 + "count": 97 } } -- cgit v1.2.3