DunePythonFindPackage¶
Helpers for checking whether Python packages are available for a given interpreter.
- dune_python_find_package¶
Check whether a Python package can be imported and optionally whether it satisfies a version constraint.
dune_python_find_package( PACKAGE <package> [RESULT <var>] [REQUIRED] [VERSION <version>] [EXACT] [INTERPRETER <python>] )
PACKAGEName of the Python package to look for.
RESULTVariable that receives the result in the calling scope. If omitted, the default is
DUNE_PYTHON_<package>_FOUND. The package name is case sensitive and is typically lowercase.REQUIREDIf given, configuration fails when the package cannot be found.
VERSIONMinimum version required for the package.
EXACTRequire the version given by
VERSIONto match exactly.INTERPRETERPython interpreter whose search path is used. The default is
Python3::Interpreter. This can differ from the system interpreter when using DUNE’s configure-time virtual environment.
The package check is performed by importing the module with the selected interpreter. If the import succeeds, the package version is queried through the dune-common helper script
pyversion.py.