Hi Alan,

On 29.08.2017 19:48, Alan W. Irwin wrote:
> To summarize, I think you should do multiple builds for python 2.7,
> 3.5, and 3.6 (with relatively small extra build cost), but I agree you
> should stick strictly to Qt5 for our Qt-related components because Qt4
> is about to be removed from Debian.

in the last days, I managed to create the Debian package for the new
plplot version. Since there are changes in the Debian package structure
(new and renamed packages), it has to be approved by our ftp-masters,
and therefore I uploaded a pre-release to our "experimental" branch
(also to prepare the required recompilation of the dependent packages).
As long as the new package is not accepted, you will find the metadata here:

https://ftp-master.debian.org/new/plplot_5.13.0%2Bdfsg-1~exp1.html

For the Python stuff, I finally used a patch that builds for all
available Python versions. The patch is Debian specific and
straightforward, and I intend to maintain it together with the Debian
package. For curiosity, I however attach it.

The current upload is not the final version; I intend to still add f.e.
Continuous Integration tests. So if you feel that we should still change
things, we can.

Best regards,

and already thank you for your help so far!

Ole



From: Ole Streicher <oleb...@debian.org>
Date: Wed, 6 Sep 2017 20:53:52 +0200
Subject: Build bindings for all Python versions

---
 CMakeLists.txt                       | 19 +++++++++++++++++
 bindings/CMakeLists.txt              |  6 +++++-
 bindings/python/CMakeLists.txt       | 40 +++++++++++++++++++++++-------------
 bindings/qt_gui/CMakeLists.txt       |  6 +++++-
 bindings/qt_gui/pyqt5/CMakeLists.txt | 24 +++++++++++-----------
 examples/CMakeLists.txt              | 20 +++++++++---------
 examples/python/CMakeLists.txt       | 10 ++++-----
 7 files changed, 82 insertions(+), 43 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 27f738d..403c1f3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -272,6 +272,25 @@ endif(USE_DLL_SUBDIRECTORY)
 # between targets and also by file dependencies that are established
 # by the cmake configuration files.
 
+execute_process(
+  COMMAND py3versions -i -v
+  COMMAND tr \  \;
+  OUTPUT_STRIP_TRAILING_WHITESPACE
+  OUTPUT_VARIABLE PY3_VERSIONS)
+
+execute_process(
+  COMMAND pyversions -i -v
+  COMMAND tr \  \;
+  OUTPUT_STRIP_TRAILING_WHITESPACE
+  OUTPUT_VARIABLE PY_VERSIONS)
+
+set(PY_VERSIONS ${PY_VERSIONS} ${PY3_VERSIONS})
+
+execute_process(
+  COMMAND py3versions -d -v
+  OUTPUT_STRIP_TRAILING_WHITESPACE
+  OUTPUT_VARIABLE PY_VERSION)
+
 add_subdirectory(fonts)
 add_subdirectory(lib)
 add_subdirectory(include)
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
index 7e92da4..fe96bd2 100644
--- a/bindings/CMakeLists.txt
+++ b/bindings/CMakeLists.txt
@@ -31,7 +31,11 @@ endif(PL_DEPRECATED_fortran)
 add_subdirectory(${TCL_TK_SRC_PREFIX}tcl tcl)
 add_subdirectory(${TCL_TK_SRC_PREFIX}tk tk)
 add_subdirectory(${TCL_TK_SRC_PREFIX}tk-x-plat tk-x-plat)
-add_subdirectory(python)
+foreach(PY_VERSION ${PY_VERSIONS})
+  set(PYTHON_INCLUDE_PATH /usr/include/python${PY_VERSION})
+  set(PYTHON_INSTDIR /usr/lib/python${PY_VERSION}/dist-packages)
+  add_subdirectory(python python${PY_VERSION})
+endforeach()
 add_subdirectory(octave)
 add_subdirectory(java)
 add_subdirectory(wxwidgets)
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 153b819..5c67bba 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -63,9 +63,9 @@ if(ENABLE_python)
   # libplplot if ENABLE_DYNDRIVERS is OFF.
   if(ENABLE_tkX AND (ENABLE_DYNDRIVERS OR PLD_tk))
     # Build _Pltk_init extension module with swig.
-    swig_add_library(Pltk_init LANGUAGE python TYPE MODULE SOURCES Pltk_init.i)
+    swig_add_library(Pltk_init${PY_VERSION} LANGUAGE python TYPE MODULE SOURCES Pltk_init.i)
     if(ENABLE_DYNDRIVERS)
-      swig_link_libraries( Pltk_init
+      swig_link_libraries( Pltk_init${PY_VERSION}
 	plplot
 	plplottcltk
 	${PYTHON_LIBRARIES}
@@ -74,21 +74,27 @@ if(ENABLE_python)
       # Don't link to plplottcltk if ENABLE_tkX is false since all of
       # the plplottcltk code is already in plplot.  Therefore this
       # rule avoids redundant linking.
-      swig_link_libraries( Pltk_init
+      swig_link_libraries( Pltk_init${PY_VERSION}
 	plplot
 	${PYTHON_LIBRARIES}
 	)
     endif(ENABLE_DYNDRIVERS)
 
+    set_target_properties(
+      _Pltk_init${PY_VERSION}
+      PROPERTIES
+      OUTPUT_NAME "_Pltk_init"
+      )
+
     if(USE_RPATH)
       set_target_properties(
-	_Pltk_init
+	_Pltk_init${PY_VERSION}
 	PROPERTIES
 	INSTALL_RPATH "${LIB_INSTALL_RPATH}"
 	)
     else(USE_RPATH)
       set_target_properties(
-	_Pltk_init
+	_Pltk_init${PY_VERSION}
 	PROPERTIES
 	INSTALL_NAME_DIR "${PYTHON_INSTDIR}"
 	)
@@ -96,7 +102,7 @@ if(ENABLE_python)
 
     if(WIN32_AND_NOT_CYGWIN)
       set_target_properties(
-	_Pltk_init
+	_Pltk_init${PY_VERSION}
 	PROPERTIES
 	SUFFIX ".pyd"
 	OUTPUT_NAME "_Pltk_init"
@@ -111,7 +117,7 @@ if(ENABLE_python)
     endif(WIN32_AND_NOT_CYGWIN)
 
     install(
-      TARGETS _Pltk_init
+      TARGETS _Pltk_init${PY_VERSION}
       EXPORT export_plplot
       LIBRARY
       DESTINATION ${PYTHON_INSTDIR}
@@ -143,13 +149,19 @@ if(ENABLE_python)
 
   # Set up swig + c wrapper.
   # N.B. the python target has an underscore prepended automatically.
-  swig_add_library(plplotc LANGUAGE python TYPE MODULE SOURCES plplotc.i)
+  swig_add_library(plplotc${PY_VERSION} LANGUAGE python TYPE MODULE SOURCES plplotc.i)
 
-  swig_link_libraries(plplotc plplot ${PYTHON_LIBRARIES})
+  swig_link_libraries(plplotc${PY_VERSION} plplot ${PYTHON_LIBRARIES})
+
+  set_target_properties(
+    _plplotc${PY_VERSION}
+    PROPERTIES
+    OUTPUT_NAME "_plplotc"
+    )
 
   if(USE_RPATH)
     set_target_properties(
-      _plplotc
+      _plplotc${PY_VERSION}
       PROPERTIES
       INSTALL_RPATH "${LIB_INSTALL_RPATH}"
       )
@@ -187,20 +199,20 @@ if(ENABLE_python)
     ${CMAKE_CURRENT_BINARY_DIR}/plplotc_fixed.py
     COMMAND ${SED_EXECUTABLE} -e "1s?^\\(.*\\)\$?\\1  It uses coding: utf-8?" < ${CMAKE_CURRENT_BINARY_DIR}/plplotc.py > ${CMAKE_CURRENT_BINARY_DIR}/plplotc_fixed.py
     COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/plplotc_fixed.py ${CMAKE_CURRENT_BINARY_DIR}/plplotc.py
-    DEPENDS _plplotc
+    DEPENDS _plplotc${PY_VERSION}
     VERBATIM
     )
 
   # Note the ALL means the install below must be for the fixed version of plplotc.py
   add_custom_target(
-    _plplotc_fixed ALL
+    _plplotc${PY_VERSION}_fixed ALL
     DEPENDS
     ${CMAKE_CURRENT_BINARY_DIR}/plplotc_fixed.py
     )
-  add_dependencies(_plplotc_fixed _plplotc)
+  add_dependencies(_plplotc${PY_VERSION}_fixed _plplotc${PY_VERSION})
 
   install(
-    TARGETS _plplotc
+    TARGETS _plplotc${PY_VERSION}
     EXPORT export_plplot
     LIBRARY
     DESTINATION ${PYTHON_INSTDIR}
diff --git a/bindings/qt_gui/CMakeLists.txt b/bindings/qt_gui/CMakeLists.txt
index f97c456..32b99d6 100644
--- a/bindings/qt_gui/CMakeLists.txt
+++ b/bindings/qt_gui/CMakeLists.txt
@@ -115,7 +115,11 @@ if(ENABLE_qt)
     pkg_config_file("qt" "Qt" " Qt binding" "plplotqt" "${pc_qt_COMPILE_FLAGS}" "-lplplot;${pc_qt_LIBRARIES_LIST};${MATH_LIB}")
 
     add_subdirectory(pyqt4)
-    add_subdirectory(pyqt5)
+    foreach(PY_VERSION ${PY_VERSIONS})
+      set(PYTHON_INCLUDE_PATH /usr/include/python${PY_VERSION})
+      set(PYTHON_INSTDIR /usr/lib/python${PY_VERSION}/dist-packages)
+      add_subdirectory(pyqt5 pyqt5_${PY_VERSION})
+    endforeach()
     add_subdirectory(smoke)
   else(ANY_QT_DEVICE)
     message(FATAL_ERROR "Internal build system inconsistency between ENABLE_qt true and ANY_QT_DEVICE false.")
diff --git a/bindings/qt_gui/pyqt5/CMakeLists.txt b/bindings/qt_gui/pyqt5/CMakeLists.txt
index a063764..edf0ade 100644
--- a/bindings/qt_gui/pyqt5/CMakeLists.txt
+++ b/bindings/qt_gui/pyqt5/CMakeLists.txt
@@ -49,7 +49,7 @@ if(ENABLE_pyqt5)
     COMMAND ${SIP_EXECUTABLE} -c . -b plplot_pyqt5.sbf -I${PYQT_SIP_DIR} ${PYQT_SIP_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/plplot_pyqt5.sip
     DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/plplot_pyqt5.sip
     )
-  add_custom_target(generate_pyqt5_source
+  add_custom_target(generate_pyqt5_${PY_VERSION}_source
     DEPENDS ${plplot_pyqt5_HDR} ${plplot_pyqt5_SRC}
     )
 
@@ -62,9 +62,9 @@ if(ENABLE_pyqt5)
     ${PYTHON_INCLUDE_PATH}
     )
 
-  add_library(plplot_pyqt5 MODULE ${plplot_pyqt5_SRC})
+  add_library(plplot_pyqt5_${PY_VERSION} MODULE ${plplot_pyqt5_SRC})
   if(BUILD_SHARED_LIBS)
-    set_target_properties(plplot_pyqt5 PROPERTIES
+    set_target_properties(plplot_pyqt5_${PY_VERSION} PROPERTIES
       COMPILE_DEFINITIONS "USINGDLL"
       )
   endif(BUILD_SHARED_LIBS)
@@ -79,23 +79,23 @@ if(ENABLE_pyqt5)
     # all python 3 cases (although it is not clear if this bug has
     # been fixed for python 3 versions higher than 3.4). This
     # visibility bug does not occur for Python 2.
-    target_compile_options(plplot_pyqt5 PRIVATE "-fvisibility=default")
+    target_compile_options(plplot_pyqt5_${PY_VERSION} PRIVATE "-fvisibility=default")
   endif(NOT ${PYTHON_VERSION} VERSION_LESS "3.0.0" AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
 
   if(WIN32_OR_CYGWIN)
     set_target_properties(
-      plplot_pyqt5
+      plplot_pyqt5_${PY_VERSION}
       PROPERTIES
       PREFIX ""
       SUFFIX ".pyd"
       )
   else(WIN32_OR_CYGWIN)
-    set_target_properties(plplot_pyqt5 PROPERTIES PREFIX "")
+    set_target_properties(plplot_pyqt5_${PY_VERSION} PROPERTIES PREFIX "")
   endif(WIN32_OR_CYGWIN)
 
   if(ENABLE_DYNDRIVERS)
     target_link_libraries(
-      plplot_pyqt5
+      plplot_pyqt5_${PY_VERSION}
       plplotqt
       plplot
       ${PYTHON_LIBRARIES}
@@ -105,13 +105,13 @@ if(ENABLE_pyqt5)
     # With static device drivers, all the plplotqt code is
     # in the plplot library so plplotqt becomes redundant.
     target_link_libraries(
-      plplot_pyqt5
+      plplot_pyqt5_${PY_VERSION}
       plplot
       ${PYTHON_LIBRARIES}
       Qt5::Svg Qt5::Gui Qt5::PrintSupport
       )
   endif(ENABLE_DYNDRIVERS)
-  add_dependencies(plplot_pyqt5 generate_pyqt5_source)
+  add_dependencies(plplot_pyqt5_${PY_VERSION} generate_pyqt5_${PY_VERSION}_source)
 
   # FIXME: Does this do anything important? It did not work so I
   #        just commented it out without any apparent side effects.
@@ -120,20 +120,20 @@ if(ENABLE_pyqt5)
 
   if(USE_RPATH)
     set_target_properties(
-      plplot_pyqt5
+      plplot_pyqt5_${PY_VERSION}
       PROPERTIES
       INSTALL_RPATH "${LIB_INSTALL_RPATH}"
       )
   else(USE_RPATH)
     set_target_properties(
-      plplot_pyqt5
+      plplot_pyqt5_${PY_VERSION}
       PROPERTIES
       INSTALL_NAME_DIR "${PYTHON_INSTDIR}"
       )
   endif(USE_RPATH)
 
   install(
-    TARGETS plplot_pyqt5
+    TARGETS plplot_pyqt5_${PY_VERSION}
     EXPORT export_plplot
     LIBRARY DESTINATION ${PYTHON_INSTDIR}
     )
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 4210687..91ca424 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -956,7 +956,7 @@ if(BUILD_TEST)
       add_dependencies(test_pyqt4_example
 	plplot_pyqt4
 	python_examples
-	_plplotc_fixed
+	_plplotc${PY_VERSION}_fixed
 	${qt_targets}
 	)
     else(CORE_BUILD)
@@ -966,7 +966,7 @@ if(BUILD_TEST)
 	)
       add_dependencies(test_pyqt4_example
 	plplot_pyqt4
-	_plplotc
+	_plplotc${PY_VERSION}
 	${qt_targets}
 	)
     endif(CORE_BUILD)
@@ -982,9 +982,9 @@ if(BUILD_TEST)
 	WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
 	)
       add_dependencies(test_pyqt5_example
-	plplot_pyqt5
+	plplot_pyqt5_${PY_VERSION}
 	python_examples
-	_plplotc_fixed
+	_plplotc${PY_VERSION}_fixed
 	${qt_targets}
 	)
     else(CORE_BUILD)
@@ -993,8 +993,8 @@ if(BUILD_TEST)
 	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python
 	)
       add_dependencies(test_pyqt5_example
-	plplot_pyqt5
-	_plplotc
+	plplot_pyqt5_${PY_VERSION}
+	_plplotc${PY_VERSION}
 	${qt_targets}
 	)
     endif(CORE_BUILD)
@@ -1121,8 +1121,8 @@ if(BUILD_TEST)
 	  VERBATIM
 	  )
 	add_dependencies(test_pytkdemo
-	  _plplotc_fixed
-	  _Pltk_init
+	  _plplotc${PY_VERSION}_fixed
+	  _Pltk_init${PY_VERSION}
 	  python_examples
 	  ${TARGET_tclIndex_tcl}
 	  ${xwin_targets}
@@ -1134,8 +1134,8 @@ if(BUILD_TEST)
 	  VERBATIM
 	  )
 	add_dependencies(test_pytkdemo
-	  _plplotc
-	  _Pltk_init
+	  _plplotc${PY_VERSION}
+	  _Pltk_init${PY_VERSION}
 	  ${TARGET_tclIndex_tcl}
 	  ${xwin_targets}
 	  )
diff --git a/examples/python/CMakeLists.txt b/examples/python/CMakeLists.txt
index 575d237..dbc9c38 100644
--- a/examples/python/CMakeLists.txt
+++ b/examples/python/CMakeLists.txt
@@ -147,10 +147,10 @@ if(CORE_BUILD)
     endforeach(file ${python_SCRIPTS} ${python_DATA})
     add_custom_target(python_examples ALL DEPENDS ${command_DEPENDS})
     set_property(GLOBAL PROPERTY TARGETS_examples_python python_examples
-      _plplotc_fixed)
+      _plplotc${PY_VERSION}_fixed)
     if(ENABLE_tkX AND (ENABLE_DYNDRIVERS OR PLD_tk))
       set_property(GLOBAL APPEND PROPERTY TARGETS_examples_python python_examples
-      _Pltk_init)
+      _Pltk_init${PY_VERSION})
     endif(ENABLE_tkX AND (ENABLE_DYNDRIVERS OR PLD_tk))
     set_property(GLOBAL PROPERTY FILES_examples_python ${command_DEPENDS})
   endif(BUILD_TEST)
@@ -200,7 +200,7 @@ if(CORE_BUILD)
     )
 
   set(python_location1 ${CMAKE_SOURCE_DIR}/bindings/python)
-  set(python_location2 ${CMAKE_BINARY_DIR}/bindings/python)
+  set(python_location2 ${CMAKE_BINARY_DIR}/bindings/python${PY_VERSION})
   set(python_location3 ${CMAKE_BINARY_DIR}/examples/python)
   if(USE_DLL_SUBDIRECTORY)
     set(python_location4 ${CMAKE_BINARY_DIR}/dll)
@@ -222,7 +222,7 @@ if(CORE_BUILD)
     @ONLY
     )
 
-  set(python_location1 ${PYTHON_INSTDIR})
+  set(python_location1)
   set(python_location2)
   set(python_location3)
   set(python_location4)
@@ -278,7 +278,7 @@ if(BUILD_TEST)
     ${CMAKE_CURRENT_BINARY_DIR}/plplot_logo.jpg
     )
   if(CORE_BUILD)
-    add_dependencies(plplot_logo python_examples _plplotc_fixed)
+    add_dependencies(plplot_logo python_examples _plplotc${PY_VERSION}_fixed)
   else(CORE_BUILD)
     add_dependencies(plplot_logo _plplotc)
   endif(CORE_BUILD)
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to