From fbabe8ad85725762e46b7c4c2f2c680c3351ec80 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 8 Jan 2017 22:47:57 +0200 Subject: There are two different kinds of extensions: modules that create new objects directly and snippets that just call into interpreter methods. --- mesonbuild/modules/python3.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'mesonbuild/modules/python3.py') diff --git a/mesonbuild/modules/python3.py b/mesonbuild/modules/python3.py index 370e92540..9b6e71ec3 100644 --- a/mesonbuild/modules/python3.py +++ b/mesonbuild/modules/python3.py @@ -12,13 +12,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .. import coredata, build from .. import mesonlib -import os -class Python3Module: +from . import ExtensionModule - def extension_module(self, state, args, kwargs): +class Python3Module(ExtensionModule): + def __init__(self): + super().__init__() + self.snippets.add('extension_module') + + def extension_module(self, interpreter, state, args, kwargs): if 'name_prefix' in kwargs: raise mesonlib.MesonException('Name_prefix is set automatically, specifying it is forbidden.') if 'name_suffix' in kwargs: @@ -34,7 +37,7 @@ class Python3Module: suffix = [] kwargs['name_prefix'] = '' kwargs['name_suffix'] = suffix - return state.interpreter.func_shared_module(None, args, kwargs) + return interpreter.func_shared_module(None, args, kwargs) def initialize(): return Python3Module() -- cgit v1.2.3