Fix version check when passing feature option to find_installation()

pull/4193/head
Xavier Claessens 6 years ago committed by Xavier Claessens
parent f5bb3005a2
commit 6112e6a815
  1. 6
      mesonbuild/interpreter.py
  2. 3
      mesonbuild/modules/python.py

@ -92,13 +92,15 @@ class FeatureOptionHolder(InterpreterObject, ObjectHolder):
def auto_method(self, args, kwargs):
return self.held_object.is_auto()
def extract_required_kwarg(kwargs, subproject):
def extract_required_kwarg(kwargs, subproject, feature_check=None):
val = kwargs.get('required', True)
disabled = False
required = False
feature = None
if isinstance(val, FeatureOptionHolder):
FeatureNew('User option "feature"', '0.47.0').use(subproject)
if not feature_check:
feature_check = FeatureNew('User option "feature"', '0.47.0')
feature_check.use(subproject)
option = val.held_object
feature = val.name
if option.is_disabled():

@ -477,7 +477,8 @@ class PythonModule(ExtensionModule):
@permittedKwargs(['required'])
def find_installation(self, interpreter, state, args, kwargs):
disabled, required, feature = extract_required_kwarg(kwargs, state.subproject)
feature_check = FeatureNew('Passing "feature" option to find_installation', '0.48.0')
disabled, required, feature = extract_required_kwarg(kwargs, state.subproject, feature_check)
if disabled:
mlog.log('find_installation skipped: feature', mlog.bold(feature), 'disabled')
return ExternalProgramHolder(NonExistingExternalProgram())

Loading…
Cancel
Save