From de48e887b8db039db6e921377b9c34fd6613ad7b Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 3 Apr 2019 09:11:07 -0700 Subject: modules/python: Do disabler check after validating inputs This will help developers not introduce bugs (say putting 3 instead of "python3"), and will be useful for the next patch. --- mesonbuild/modules/python.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'mesonbuild/modules/python.py') diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 693621b57..027d0f773 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -498,9 +498,6 @@ class PythonModule(ExtensionModule): def find_installation(self, interpreter, state, args, kwargs): 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()) if len(args) > 1: raise InvalidArguments('find_installation takes zero or one positional argument.') @@ -511,6 +508,10 @@ class PythonModule(ExtensionModule): if not isinstance(name_or_path, str): raise InvalidArguments('find_installation argument must be a string.') + if disabled: + mlog.log('find_installation skipped: feature', mlog.bold(feature), 'disabled') + return ExternalProgramHolder(NonExistingExternalProgram()) + if not name_or_path: python = ExternalProgram('python3', mesonlib.python_command) else: -- cgit v1.2.3