[vtk-developers] VTK, Python 3 and the six module - install error on six.pyc

Aron Helser aron.helser at kitware.com
Tue May 16 22:15:28 EDT 2017


I had to add a file glob to get the .pyc files, since they now include the
interpreter and python version in the filename.
Here's a working fix to vtk/CMake/vtkModuleMacrosPython.cmake. I'll submit
a MR tomorrow.

       # add install rules.
       if (NOT _no_install AND NOT VTK_INSTALL_NO_RUNTIME)
-        install(FILES "${VTK_BUILD_PYTHON_MODULE_DIR}/${_name}"
-                      "${VTK_BUILD_PYTHON_MODULE_DIR}/${_name_we}.pyc"
-                      "${VTK_BUILD_PYTHON_MODULE_DIR}/${_name_we}.pyo"
-                DESTINATION "${VTK_INSTALL_PYTHON_MODULE_DIR}"
-                COMPONENT "Runtime")
+        if(VTK_PYTHON_VERSION VERSION_LESS 3)
+          install(FILES "${VTK_BUILD_PYTHON_MODULE_DIR}/${_name}"
+                        "${VTK_BUILD_PYTHON_MODULE_DIR}/${_name_we}.pyc"
+                        "${VTK_BUILD_PYTHON_MODULE_DIR}/${_name_we}.pyo"
+                  DESTINATION "${VTK_INSTALL_PYTHON_MODULE_DIR}"
+                  COMPONENT "Runtime")
+        else()
+          # python 3 uses a different directory for .pyc files, and .pyo
files are gone.
+          install(FILES "${VTK_BUILD_PYTHON_MODULE_DIR}/${_name}"
+                  DESTINATION "${VTK_INSTALL_PYTHON_MODULE_DIR}"
+                  COMPONENT "Runtime")
+          file(GLOB file_matches
"${VTK_BUILD_PYTHON_MODULE_DIR}/__pycache__/${_name_we}.*.pyc")
+          install(FILES ${file_matches}
+                  DESTINATION
"${VTK_INSTALL_PYTHON_MODULE_DIR}/__pycache__"
+                  COMPONENT "Runtime")
+        endif()
       endif()

Aron

On Tue, May 16, 2017 at 1:58 PM, Ben Boeckel <ben.boeckel at kitware.com>
wrote:

> On Tue, May 16, 2017 at 11:43:25 -0400, Marcus D. Hanwell wrote:
> > I originally discovered this issue when doing a make install from
> > ParaView with the web stuff turned on using Python 3. Perhaps this
> > combination is not tested?
>
> Ah, that is true. The superbuild is Python2-only right now.
>
> > Yes, and the third party appears to be missing this. I found it in
> > building an updated ParaView dependency for Tomviz where we need
> > ParaView built against Python 3 and using the web flags in order to do
> > the export to a web viewer. If this isn't tested it would be nice to
> > get a test added.
> >
> > I am out on travel right now, but can supply the flags for VTK and/or
> > ParaView. It is a VTK issue that ParaView seems to inherit when
> > turning on these modules recently ported to Python 3 (aside from the
> > make install step).
>
> Aron and I had some off-list messages and have found the culprit
> (vtk_module_python_module). I believe he is working on a fix.
>
> --Ben
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170516/1b67ccef/attachment.html>


More information about the vtk-developers mailing list