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 thevtk
Python package. We now make it consistent. These are not built under thevtk
Python package itself. - CMake variables
VTK_INSTALL_PYTHON_MODULE_DIR
andVTK_BUILD_PYTHON_MODULE_DIR
are 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_SUFFIX
is initialized toLib/site-packages
on Windows, andpython-${python-version}/site-packages
on *nixes. Thus the Python packages ultimately end up in<prefix>/bin/Lib/site-packages
on Windows and<prefix>/lib/python-${python-version}/site-packages
on *nixes, where<prefix>
is the install prefix for installs andVTK_BINARY_DIR
for 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,
vtkPythonInterpreter
would end up picking incorrect standard Python library modules unless PYTHONHOME was explicitly set. To avoid that, vtkPythonInterpreter now callPy_SetProgramName
with a executable location derived from the python library VTK links against. (thanks to @chuck.atkins). -
vtkPythonInterpreter
now 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 thevtkPythonInterpreter
find VTK package. - vtkpython and pvtkpython now support standard python command line arguments
-v
and-vv
to print information about paths looked up when trying to locate VTK Python modules -
vtk
Python package is now built and installed using rules similar to other Python-only modules in VTK.
Edited by Utkarsh Ayachit