]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
python, meson: Assert that deps are present for -Dpython=true
authorMartin Belanger <martin.belanger@dell.com>
Wed, 1 Mar 2023 19:21:03 +0000 (14:21 -0500)
committerDaniel Wagner <wagi@monom.org>
Thu, 2 Mar 2023 09:54:27 +0000 (10:54 +0100)
The -Dpython option takes 3 values: auto, true, or false. For
"auto", the Python bindings will be built if all the dependencies
are met and will be skipped in not. For "true", the Python bindings
MUST be built and therefore missing dependencies need to be treated
as an error. For "false", the Python bindings won't be built whether
the dependencies are met or not.

Currently, with -Dpython=true, if a dependency required to build the
Python bindings is missing, meson silently skips it (i.e. it behaves
like "-Dpython=auto").

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
libnvme/meson.build

index f83393f42f306f2e03e2ee95bab501e7759d6cd5..6a9be2ea5886b023a98804f960bfc1e50608a3ae 100644 (file)
@@ -10,7 +10,7 @@ if want_python != 'false'
     python3 = import('python').find_installation('python3')
     py3_dep = python3.dependency(required: want_python == 'true')
     swig = find_program('swig', required: want_python == 'true')
-    header_found = cc.has_header('Python.h', dependencies: py3_dep)
+    header_found = cc.has_header('Python.h', dependencies: py3_dep, required: want_python == 'true')
     have_python_support = py3_dep.found() and swig.found() and header_found
 else
     have_python_support = false