diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-03-03 09:02:49 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-05-28 15:17:10 -0400 |
commit | 723c5227a471aff3a1a5a3bc481984c99bf592aa (patch) | |
tree | 647154c14f8a8de4f58da4b1bd272a5dfaf30efa /mesonbuild/modules/cmake.py | |
parent | 495e76d10a65df9e19e96e5470d64644da0e8099 (diff) | |
download | meson-723c5227a471aff3a1a5a3bc481984c99bf592aa.zip meson-723c5227a471aff3a1a5a3bc481984c99bf592aa.tar.gz meson-723c5227a471aff3a1a5a3bc481984c99bf592aa.tar.bz2 |
modules: Remove snippet methods
The only advantage they have is they have the interpreter in arguments,
but it's already available as self.interpreter. We should discourage
usage of the interpreter API and rely on ModuleState object instead in
the future.
This also lift the restriction that a module method cannot add build
targets, but that was not enforced for snippet methods anyway (and some
modules were doing it) and it's really loose restriction as it should
check for many other things if we wanted to make it consistent.
Diffstat (limited to 'mesonbuild/modules/cmake.py')
-rw-r--r-- | mesonbuild/modules/cmake.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/mesonbuild/modules/cmake.py b/mesonbuild/modules/cmake.py index ee09359..bef7a00 100644 --- a/mesonbuild/modules/cmake.py +++ b/mesonbuild/modules/cmake.py @@ -216,8 +216,6 @@ class CmakeModule(ExtensionModule): def __init__(self, interpreter): super().__init__(interpreter) - self.snippets.add('configure_package_config_file') - self.snippets.add('subproject') def detect_voidp_size(self, env): compilers = env.coredata.compilers.host @@ -318,7 +316,7 @@ class CmakeModule(ExtensionModule): mesonlib.replace_if_different(outfile, outfile_tmp) @permittedKwargs({'input', 'name', 'install_dir', 'configuration'}) - def configure_package_config_file(self, interpreter, state, args, kwargs): + def configure_package_config_file(self, state, args, kwargs): if args: raise mesonlib.MesonException('configure_package_config_file takes only keyword arguments.') @@ -369,11 +367,11 @@ class CmakeModule(ExtensionModule): conf.mark_used() conffile = os.path.normpath(inputfile.relative_name()) - if conffile not in interpreter.build_def_files: - interpreter.build_def_files.append(conffile) + if conffile not in self.interpreter.build_def_files: + self.interpreter.build_def_files.append(conffile) res = build.Data([mesonlib.File(True, ofile_path, ofile_fname)], install_dir, None, state.subproject) - interpreter.build.data.append(res) + self.interpreter.build.data.append(res) return res @@ -382,13 +380,13 @@ class CmakeModule(ExtensionModule): @FeatureDeprecatedKwargs('subproject', '0.55.0', ['cmake_options']) @permittedKwargs({'cmake_options', 'required', 'options'}) @stringArgs - def subproject(self, interpreter, state, args, kwargs): + def subproject(self, state, args, kwargs): if len(args) != 1: raise InterpreterException('Subproject takes exactly one argument') if 'cmake_options' in kwargs and 'options' in kwargs: raise InterpreterException('"options" cannot be used together with "cmake_options"') dirname = args[0] - subp = interpreter.do_subproject(dirname, 'cmake', kwargs) + subp = self.interpreter.do_subproject(dirname, 'cmake', kwargs) if not subp.held_object: return subp return CMakeSubprojectHolder(subp, dirname) |