Commit 9e0168d6 authored by Ben Boeckel's avatar Ben Boeckel
Browse files

cmake: drop support for Python2

parent b63f72d7
......@@ -169,24 +169,28 @@ mark_as_advanced(PARAVIEW_BUILD_CATALYST_ADAPTORS)
if (PARAVIEW_USE_PYTHON)
set(PARAVIEW_PYTHON_VERSION "3"
CACHE STRING "")
set_property(CACHE PARAVIEW_PYTHON_VERSION
PROPERTY
STRINGS "2;3")
if (NOT PARAVIEW_PYTHON_VERSION STREQUAL "2" AND
NOT PARAVIEW_PYTHON_VERSION STREQUAL "3")
message(FATAL_ERROR
"`PARAVIEW_PYTHON_VERSION` must either be 2 or 3.")
if (DEFINED PARAVIEW_PYTHON_VERSION)
if (PARAVIEW_PYTHON_VERSION STREQUAL "3")
message(DEPRECATION
"Python 2 is no longer supported. Ignoring the explicit "
"`PARAVIEW_PYTHON_VERSION=3` request as it is the only valid value "
"now.")
else ()
message(FATAL_ERROR
"Python 2 is no longer supported. Please either set "
"`PARAVIEW_PYTHON_VERSION=3` or remove the option completely.")
endif ()
unset(PARAVIEW_PYTHON_VERSION)
unset(PARAVIEW_PYTHON_VERSION CACHE)
endif ()
set(VTK_PYTHON_VERSION "${PARAVIEW_PYTHON_VERSION}")
set(VTK_PYTHON_VERSION 3)
endif ()
if (PARAVIEW_USE_PYTHON AND PARAVIEW_BUILD_TESTING)
# testing needs Python interpreter i.e. `PYTHON_EXECUTABLE` without which
# our `find_python_module` checks to determine which tests to add or exclude
# will fail. We find it here.
find_package(PythonInterp "${PARAVIEW_PYTHON_VERSION}" QUIET)
find_package(PythonInterp 3.3 QUIET)
mark_as_advanced(PYTHON_EXECUTABLE)
include(FindPythonModules)
endif()
......@@ -363,9 +367,9 @@ if (PARAVIEW_USE_EXTERNAL_VTK)
endif ()
if (PARAVIEW_USE_PYTHON)
find_package("Python${PARAVIEW_PYTHON_VERSION}" QUIET REQUIRED COMPONENTS Interpreter)
set(PYTHON_VERSION_MAJOR "${Python${PARAVIEW_PYTHON_VERSION}_VERSION_MAJOR}")
set(PYTHON_VERSION_MINOR "${Python${PARAVIEW_PYTHON_VERSION}_VERSION_MINOR}")
find_package(Python3 3.3 QUIET REQUIRED COMPONENTS Interpreter)
set(PYTHON_VERSION_MAJOR "${Python3_VERSION_MAJOR}")
set(PYTHON_VERSION_MINOR "${Python3_VERSION_MINOR}")
if (NOT PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX)
vtk_module_python_default_destination(PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX)
endif ()
......@@ -452,9 +456,9 @@ else ()
endif ()
if (PARAVIEW_USE_PYTHON)
find_package("Python${PARAVIEW_PYTHON_VERSION}" QUIET REQUIRED COMPONENTS Interpreter)
set(PYTHON_VERSION_MAJOR "${Python${PARAVIEW_PYTHON_VERSION}_VERSION_MAJOR}")
set(PYTHON_VERSION_MINOR "${Python${PARAVIEW_PYTHON_VERSION}_VERSION_MINOR}")
find_package("Python3" 3.3 QUIET REQUIRED COMPONENTS Interpreter)
set(PYTHON_VERSION_MAJOR "${Python3_VERSION_MAJOR}")
set(PYTHON_VERSION_MINOR "${Python3_VERSION_MINOR}")
if (NOT PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX)
vtk_module_python_default_destination(PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX)
endif ()
......
......@@ -171,8 +171,7 @@ Required:
Optional dependencies:
* [Python][python]
- When using Python 2, at least 2.7 is required
- When using Python 3, at least 3.3 is required
- At least 3.3 is required
* [Qt5][qt]
- Version 5.9 or newer
......@@ -215,8 +214,8 @@ Linux/Mac, we suggest either [OpenMPI][openmpi] or [MPICH][mpich]. On Windows,
##### Python
In order to use scripting, [Python][python] is required (versions 2.7 and 3.3).
Python is also required in order to build ParaViewWeb support.
In order to use scripting, [Python][python] is required (version 3.3). Python
is also required in order to build ParaViewWeb support.
##### OSMesa
......
find_package("Python${PARAVIEW_PYTHON_VERSION}" QUIET REQUIRED COMPONENTS Interpreter)
find_package(Python3 QUIET REQUIRED COMPONENTS Interpreter)
set(decorator_file "${CMAKE_CURRENT_BINARY_DIR}/pqPluginDecorators.h")
add_custom_command(
OUTPUT ${decorator_file}
COMMAND "Python${PARAVIEW_PYTHON_VERSION}::Interpreter"
COMMAND Python3::Interpreter
"${CMAKE_CURRENT_SOURCE_DIR}/WrapPythonQt.py"
-i "${CMAKE_CURRENT_SOURCE_DIR}/wrapped_methods.txt"
-o "${decorator_file}"
......
......@@ -3,7 +3,7 @@ NAME
LIBRARY_NAME
vtkPVWebPython
CONDITION
PARAVIEW_USE_PYTHON AND PARAVIEW_ENABLE_WEB AND NOT (PARAVIEW_PYTHON_VERSION STREQUAL "2")
PARAVIEW_USE_PYTHON AND PARAVIEW_ENABLE_WEB
GROUPS
PARAVIEW_CANONICAL
TEST_LABELS
......
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