aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/python.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-09-12 13:38:36 -0400
committerJussi Pakkanen <jpakkane@gmail.com>2018-09-16 15:07:43 +0300
commit3cf03ec6d603d2c4699cefb9fabdbd8de321a3f2 (patch)
treea7124115d8363911e16dc71e576d164bbda14d22 /mesonbuild/modules/python.py
parent43268bfb79eca55d5d2bd6ff73abcadf9a77c60b (diff)
downloadmeson-3cf03ec6d603d2c4699cefb9fabdbd8de321a3f2.zip
meson-3cf03ec6d603d2c4699cefb9fabdbd8de321a3f2.tar.gz
meson-3cf03ec6d603d2c4699cefb9fabdbd8de321a3f2.tar.bz2
find_installation: Add support for feature option in required kwarg
Closes: #4165.
Diffstat (limited to 'mesonbuild/modules/python.py')
-rw-r--r--mesonbuild/modules/python.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index d9ec562..0ba086b 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -25,7 +25,7 @@ from ..interpreterbase import (
InterpreterObject, InvalidArguments,
FeatureNew
)
-from ..interpreter import ExternalProgramHolder
+from ..interpreter import ExternalProgramHolder, extract_required_kwarg
from ..interpreterbase import flatten
from ..build import known_shmod_kwargs
from .. import mlog
@@ -477,9 +477,10 @@ class PythonModule(ExtensionModule):
@permittedKwargs(['required'])
def find_installation(self, interpreter, state, args, kwargs):
- required = kwargs.get('required', True)
- if not isinstance(required, bool):
- raise InvalidArguments('"required" argument must be a boolean.')
+ disabled, required, feature = extract_required_kwarg(kwargs, state.subproject)
+ 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.')