Python environment improvements
This MR has multiple fixes.
- Each VTK module generates a Python module library named
${vtk-module}Python.[pyd|so|dylib]. This was built in the same location as the other libraries, but installed in thevtkPython package. We now make it consistent. These are not built under thevtkPython package itself. - CMake variables
VTK_INSTALL_PYTHON_MODULE_DIRandVTK_BUILD_PYTHON_MODULE_DIRare no longer supported. Instead, folks can setVTK_PYTHON_SITE_PACKAGES_SUFFIX, if needed to customize where the vtk Python package (and other Python packages) are built.VTK_PYTHON_SITE_PACKAGES_SUFFIXis initialized toLib/site-packageson Windows, andpython-${python-version}/site-packageson *nixes. Thus the Python packages ultimately end up in<prefix>/bin/Lib/site-packageson Windows and<prefix>/lib/python-${python-version}/site-packageson *nixes, where<prefix>is the install prefix for installs andVTK_BINARY_DIRfor builds. - vtkpython/pvtkpython use
vtkPythonInterpreter. This avoids duplicating logic for locating VTK Python modules between VTK executables and other applications using VTK. - For HPC use-cases with non-standard Python,
vtkPythonInterpreterwould end up picking incorrect standard Python library modules unless PYTHONHOME was explicitly set. To avoid that, vtkPythonInterpreter now callPy_SetProgramNamewith a executable location derived from the python library VTK links against. (thanks to @chuck.atkins). -
vtkPythonInterpreternow locates vtk Python package paths relative to the VTK libs. This makes it more robust for other apps using VTK since they don't need any extra logic to help thevtkPythonInterpreterfind VTK package. - vtkpython and pvtkpython now support standard python command line arguments
-vand-vvto print information about paths looked up when trying to locate VTK Python modules -
vtkPython package is now built and installed using rules similar to other Python-only modules in VTK.
Edited by Utkarsh Ayachit