aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-05-04 00:50:34 -0400
committerEli Schwartz <eschwartz@archlinux.org>2023-06-26 13:10:33 -0400
commita71846d7494f3035677bee5f38b3fc94fb18938b (patch)
treef195949ff9183f7ca4e5e64685cab36f06b83f19
parenta1ef957e349583f9affdce5b5a4f094860e91037 (diff)
downloadmeson-a71846d7494f3035677bee5f38b3fc94fb18938b.zip
meson-a71846d7494f3035677bee5f38b3fc94fb18938b.tar.gz
meson-a71846d7494f3035677bee5f38b3fc94fb18938b.tar.bz2
Revert "modules: move gnome targets into gnome module"
This reverts commit a2def550c586aeba4269588e79a1a308467f2582. This results in a 2k line file being unconditionally imported at startup, and transitively loading two more (for a total cost of 2759 lines of code), and it's not clear it was ever needed to begin with...
-rw-r--r--mesonbuild/backend/ninjabackend.py3
-rw-r--r--mesonbuild/modules/__init__.py18
-rw-r--r--mesonbuild/modules/gnome.py21
-rw-r--r--test cases/unit/113 empty project/expected_mods.json5
-rw-r--r--unittests/platformagnostictests.py2
5 files changed, 23 insertions, 26 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index c918304..b36e125 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -30,7 +30,6 @@ import typing as T
from . import backends
from .. import modules
-from ..modules import gnome
from .. import environment, mesonlib
from .. import build
from .. import mlog
@@ -1687,7 +1686,7 @@ class NinjaBackend(backends.Backend):
target.install_dir[3] = os.path.join(self.environment.get_datadir(), 'gir-1.0')
# Detect gresources and add --gresources arguments for each
for gensrc in other_src[1].values():
- if isinstance(gensrc, gnome.GResourceTarget):
+ if isinstance(gensrc, modules.GResourceTarget):
gres_xml, = self.get_custom_target_sources(gensrc)
args += ['--gresources=' + gres_xml]
extra_args = []
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py
index 98ac18a..daac9ed 100644
--- a/mesonbuild/modules/__init__.py
+++ b/mesonbuild/modules/__init__.py
@@ -18,14 +18,13 @@ from __future__ import annotations
import dataclasses
import typing as T
-from .. import mesonlib
+from .. import build, mesonlib
from ..build import IncludeDirs
from ..interpreterbase.decorators import noKwargs, noPosargs
from ..mesonlib import relpath, HoldableObject, MachineChoice
from ..programs import ExternalProgram
if T.TYPE_CHECKING:
- from .. import build
from ..interpreter import Interpreter
from ..interpreter.interpreterobjects import MachineHolder
from ..interpreterbase import TYPE_var, TYPE_kwargs
@@ -261,3 +260,18 @@ class ModuleReturnValue:
self.return_value = return_value
assert isinstance(new_objects, list)
self.new_objects: T.List[T.Union['TYPE_var', 'build.ExecutableSerialisation']] = new_objects
+
+class GResourceTarget(build.CustomTarget):
+ pass
+
+class GResourceHeaderTarget(build.CustomTarget):
+ pass
+
+class GirTarget(build.CustomTarget):
+ pass
+
+class TypelibTarget(build.CustomTarget):
+ pass
+
+class VapiTarget(build.CustomTarget):
+ pass
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index c538a14..7a9acea 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -24,8 +24,10 @@ import subprocess
import textwrap
import typing as T
-from . import ExtensionModule, ModuleInfo
-from . import ModuleReturnValue
+from . import (
+ ExtensionModule, GirTarget, GResourceHeaderTarget, GResourceTarget, ModuleInfo,
+ ModuleReturnValue, TypelibTarget, VapiTarget,
+)
from .. import build
from .. import interpreter
from .. import mesonlib
@@ -249,21 +251,6 @@ def annotations_validator(annotations: T.List[T.Union[str, T.List[str]]]) -> T.O
return f'element {c+1} {badlist}'
return None
-class GResourceTarget(build.CustomTarget):
- pass
-
-class GResourceHeaderTarget(build.CustomTarget):
- pass
-
-class GirTarget(build.CustomTarget):
- pass
-
-class TypelibTarget(build.CustomTarget):
- pass
-
-class VapiTarget(build.CustomTarget):
- pass
-
# gresource compilation is broken due to the way
# the resource compiler and Ninja clash about it
#
diff --git a/test cases/unit/113 empty project/expected_mods.json b/test cases/unit/113 empty project/expected_mods.json
index 1a0e8a1..7463bcb 100644
--- a/test cases/unit/113 empty project/expected_mods.json
+++ b/test cases/unit/113 empty project/expected_mods.json
@@ -188,7 +188,6 @@
"mesonbuild.dependencies",
"mesonbuild.dependencies.base",
"mesonbuild.dependencies.detect",
- "mesonbuild.dependencies.pkgconfig",
"mesonbuild.depfile",
"mesonbuild.envconfig",
"mesonbuild.environment",
@@ -223,13 +222,11 @@
"mesonbuild.mintro",
"mesonbuild.mlog",
"mesonbuild.modules",
- "mesonbuild.modules.gnome",
"mesonbuild.mparser",
"mesonbuild.msetup",
"mesonbuild.optinterpreter",
"mesonbuild.programs",
"mesonbuild.scripts",
- "mesonbuild.scripts.gettext",
"mesonbuild.scripts.meson_exe",
"mesonbuild.utils",
"mesonbuild.utils.core",
@@ -240,6 +237,6 @@
"mesonbuild.wrap",
"mesonbuild.wrap.wrap"
],
- "count": 71
+ "count": 68
}
}
diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py
index 2647684..976656e 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'], 71)
+ self.assertEqual(data['count'], 68)