Fix version check when passing feature option to find_installation()

This commit is contained in:
Xavier Claessens 2018-09-17 09:18:10 -04:00 committed by Xavier Claessens
parent f5bb3005a2
commit 6112e6a815
2 changed files with 6 additions and 3 deletions

View File

@ -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():

View File

@ -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())