[plplot] 02/05: Added Build-bindings-for-all-Python-versions.patch

Ole Streicher olebole at moszumanska.debian.org
Sat Sep 9 11:50:27 UTC 2017


This is an automated email from the git hooks/post-receive script.

olebole pushed a commit to branch master
in repository plplot.

commit de9a76efa34c3fc6df81c65a8a76b7022184ad23
Author: Ole Streicher <olebole at debian.org>
Date:   Fri Sep 8 20:51:06 2017 +0200

    Added Build-bindings-for-all-Python-versions.patch
---
 .../Build-bindings-for-all-Python-versions.patch   | 395 +++++++++++++++++++++
 debian/patches/Unset-python-path.patch             |  23 --
 debian/patches/series                              |   2 +-
 3 files changed, 396 insertions(+), 24 deletions(-)

diff --git a/debian/patches/Build-bindings-for-all-Python-versions.patch b/debian/patches/Build-bindings-for-all-Python-versions.patch
new file mode 100644
index 0000000..2c95507
--- /dev/null
+++ b/debian/patches/Build-bindings-for-all-Python-versions.patch
@@ -0,0 +1,395 @@
+From: Ole Streicher <olebole at 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)
diff --git a/debian/patches/Unset-python-path.patch b/debian/patches/Unset-python-path.patch
deleted file mode 100644
index aaba72c..0000000
--- a/debian/patches/Unset-python-path.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From: Andrew Ross <andrewross at users.sourceforge.net>
-Date: Mon, 2 Apr 2012 15:30:25 +0100
-Subject: Unset python path
-
-No need to explicitly set python path with debian since the default path is
-correct. This ensure the examples work with multiple version of python.
----
- examples/python/CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/examples/python/CMakeLists.txt b/examples/python/CMakeLists.txt
-index 575d237..4e45eca 100644
---- a/examples/python/CMakeLists.txt
-+++ b/examples/python/CMakeLists.txt
-@@ -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)
diff --git a/debian/patches/series b/debian/patches/series
index df46e6b..0ca1b03 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,4 @@
-Unset-python-path.patch
 Proper-use-of-the-rmpath-function.patch
 Remove-nondfsg-dirs.patch
 Disable-octave-UTF-8-tests.patch
+Build-bindings-for-all-Python-versions.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/plplot.git



More information about the debian-science-commits mailing list