aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-02-22 09:35:44 -0500
committerXavier Claessens <xclaesse@gmail.com>2022-02-28 09:03:27 -0500
commitad75a2bfec7ca6cb13a3852afc618ee7c38d7baf (patch)
tree207b2522ada8e7f0a4d6fc760389fccab2a885cc /mesonbuild/modules
parent904b47085fdd985175b4b2c3224f65b9d33f04d7 (diff)
downloadmeson-ad75a2bfec7ca6cb13a3852afc618ee7c38d7baf.zip
meson-ad75a2bfec7ca6cb13a3852afc618ee7c38d7baf.tar.gz
meson-ad75a2bfec7ca6cb13a3852afc618ee7c38d7baf.tar.bz2
modules: Make ExtensionModule inherit from NewExtensionModule
It reduces duplicated code.
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/__init__.py29
1 files changed, 7 insertions, 22 deletions
diff --git a/mesonbuild/modules/__init__.py b/mesonbuild/modules/__init__.py
index 85bec0b..a3c6972 100644
--- a/mesonbuild/modules/__init__.py
+++ b/mesonbuild/modules/__init__.py
@@ -126,28 +126,6 @@ class ModuleObject(HoldableObject):
class MutableModuleObject(ModuleObject):
pass
-
-# FIXME: Port all modules to stop using self.interpreter and use API on
-# ModuleState instead. Modules should stop using this class and instead use
-# ModuleObject base class.
-class ExtensionModule(ModuleObject):
- def __init__(self, interpreter: 'Interpreter') -> None:
- super().__init__()
- self.interpreter = interpreter
- self.methods.update({
- 'found': self.found_method,
- })
-
- @noPosargs
- @noKwargs
- def found_method(self, state: 'ModuleState', args: T.List['TYPE_var'], kwargs: 'TYPE_kwargs') -> bool:
- return self.found()
-
- @staticmethod
- def found() -> bool:
- return True
-
-
class NewExtensionModule(ModuleObject):
"""Class for modern modules
@@ -170,6 +148,13 @@ class NewExtensionModule(ModuleObject):
def found() -> bool:
return True
+# FIXME: Port all modules to stop using self.interpreter and use API on
+# ModuleState instead. Modules should stop using this class and instead use
+# ModuleObject base class.
+class ExtensionModule(NewExtensionModule):
+ def __init__(self, interpreter: 'Interpreter') -> None:
+ super().__init__()
+ self.interpreter = interpreter
class NotFoundExtensionModule(NewExtensionModule):