Commit e88e1a4c authored by Utkarsh Ayachit's avatar Utkarsh Ayachit
Browse files

Support Python with frozen modules.

When using frozen python, vtkPythonInterpreter now skips updating paths
using landmarks. Since frozen python is used in scenarios where we don't
want to avoid disk accesses, this address that issue. Users are required
to setup PYTHONHOME, PYTHONPATH explicitly, if needed when using frozen
Python modules.
parent 72c582aa
......@@ -533,6 +533,14 @@ void vtkPythonInterpreter::SetupPythonPrefix()
{
using systools = vtksys::SystemTools;
// Check Py_FrozenFlag global variable defined by Python to see if we're using
// frozen Python.
if (Py_FrozenFlag)
{
VTKPY_DEBUG_MESSAGE("`Py_FrozenFlag` is set. Skipping setting up of program path.");
return;
}
if (Py_GetPythonHome() != nullptr)
{
// if PYTHONHOME is set, we do nothing. Don't override an already
......@@ -583,6 +591,14 @@ void vtkPythonInterpreter::SetupPythonPrefix()
//----------------------------------------------------------------------------
void vtkPythonInterpreter::SetupVTKPythonPaths()
{
// Check Py_FrozenFlag global variable defined by Python to see if we're using
// frozen Python.
if (Py_FrozenFlag)
{
VTKPY_DEBUG_MESSAGE("`Py_FrozenFlag` is set. Skipping locating of `vtk` package.");
return;
}
using systools = vtksys::SystemTools;
std::string vtklib = vtkGetLibraryPathForSymbol(GetVTKVersion);
if (vtklib.empty())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment