diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-05-17 20:04:42 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-05-17 20:04:42 +0300 |
commit | 4748fee06ab100fa84150194485e0ff7aa9bc6c3 (patch) | |
tree | 05d8dc3e2c0933dceb55693c3aed0237a230986b /mesonbuild/environment.py | |
parent | 42abae2e07717f1aad286f40166b13fcccc0d878 (diff) | |
download | meson-overrides.tar.gz |
Prohibit the use of override_file and subproject options in machine files.overrides
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 3a198e969..cb05b1d99 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -783,6 +783,21 @@ class Environment: self.wrap_resolver = None self.overrides = OptionOverrides() self.init_overrides() + self.check_dual_overrides() + + def has_per_subproject_options(self): + for o in self.options: + if o.subproject: + return True + return False + + def check_dual_overrides(self): + if self.has_per_subproject_options() and self.coredata.options[mesonlib.OptionKey('override_file')].value: + raise MesonException('''Tried to define a per-subproject option in a machine file when override_file was defined. +This is not supported. All per-subproject options should be transitioned to +use the override file. Machine file overrides are deprecatd and will be +removed in a future Meson release.''') + def _load_machine_file_options(self, config: 'ConfigParser', properties: Properties, machine: MachineChoice) -> None: """Read the contents of a Machine file and put it in the options store.""" @@ -814,6 +829,8 @@ class Environment: subproject, section = section.split(':') else: subproject = '' + if subproject != '': + mlog.deprecation('Per-subproject option values in machine files are deprecated, transition to using an override_file instead.') if section == 'built-in options': for k, v in values.items(): key = OptionKey.from_string(k) |