- Python isn't an external project anymore but it is handled like one with hard-coded exceptions
- The find_package() call is split into multiple calls which is explicitly discouraged in the CMake documentation
- It's still MITK_USE_Python but as MITK_USE_ variables are handled specially, it should match the actual name Python3
- A PackageDepends Config file is missing
- Package dependencies in modules are still using the old PythonLibs
- Python Wrapping is still based on PythonLibs
Description
Related Objects
- Mentioned In
- T27486: Prepare changelog and migration guide for upcoming master merge
rMITKDIFF691fef7dfe94: Merge branch 'T26559-Python3'
T26566: Migrate to improved Python 3 integration
rMITK310714436033: Merge branch 'T26559-ImprovePython3Integration'
T26556: Python 3.7 does not work on macOS - Mentioned Here
- T26566: Migrate to improved Python 3 integration
Event Timeline
Bug(s) in CTK:
find_package(PythonLibs) is called multiple times without checking for PYTHONLIBS_FOUND first. If it was already found, PYTHON_LIBRARY potentially is a list of the form "optimized;python3.lib;debug;python3d.lib" instead of just "python3.lib". The FindPythonLibs module can't handle this list and produces something like "optimized;optimized;optimized;python3.lib;debug;debug;debug;python3d.lib". The list (doesn't matter if corrupted or not) is then passed down to PythonQt as PYTHON_LIBRARY. However, providing PYTHON_LIBRARY as a hint to the FindPythonLibs module should be in non-list format of the release library.
In ctkMacroCompilePythonScript.cmake there's a call like get_filename_component(PYTHON_LIBRARY_PATH ${PYTHON_LIBRARY} PATH). ${PYTHON_LIBRARY} should be quoted to support white spaces in the path and it also cannot handle the list format.
Just a comment. Python wrapping is handled independently. We should talk to Michel about this.
Prepared fix for CTK: https://github.com/commontk/CTK/compare/master...kislinsk:fix-pythonlibs-handling
Will test with Linux and macOS before creating a pull request.
It's MITK_USE_Python3 now instead of MITK_USE_Python. On macOS CMAKE_FRAMEWORK_PATH can be used to hint our CMake script to find a specific version of Python as Python 3.7 does not work at the moment.
Missed it. "improve python 3 integration", "migrate to improved python 3 integration". Potato, Potahto