Disable buiding of python2 module
authorDimitrios Eftaxiopoulos <eftaxi12@otenet.gr>
Sun, 8 Dec 2019 08:53:10 +0000 (10:53 +0200)
committerDimitrios Eftaxiopoulos <eftaxi12@otenet.gr>
Sun, 8 Dec 2019 08:53:10 +0000 (10:53 +0200)
debian/patches/CMakeLists.patch
debian/patches/python2_and_python3.patch [deleted file]
debian/patches/python3.patch [new file with mode: 0644]
debian/patches/series

index 303aa2edeceff34abda954cf63951adefeebb112..f75ebae5954fc16cb564179df6955c3d53d8766d 100644 (file)
@@ -1,6 +1,6 @@
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -161,7 +161,7 @@
+@@ -157,7 +157,7 @@
  endif(WIN32)
  
  option(enable-double "Enable double precision in MathGL library" ON)
@@ -9,7 +9,7 @@
  option(enable-opengl "Enable OpenGL support" ON)
  option(enable-all-docs "Enable all documentation building")
  #option(enable-doc "Enable documentation building")
-@@ -184,7 +184,7 @@
+@@ -180,7 +180,7 @@
  
  option(enable-lgpl "Enable only LGPL part of MathGL")
  option(enable-mgl2 "Use names 'libmgl2-*' instead of 'libmgl-*'")
@@ -18,7 +18,7 @@
  option(enable-doc-site "Enable HTML documentation for website")
  #CMAKE_DEPENDENT_OPTION(enable-doc-site "Enable HTML documentation for website" OFF "NOT enable-all-docs" ON)
  CMAKE_DEPENDENT_OPTION(enable-doc-html "Enable HTML documentation" OFF "NOT enable-all-docs" ON)
-@@ -198,19 +198,19 @@
+@@ -194,19 +194,19 @@
  
  CMAKE_DEPENDENT_OPTION(enable-zlib "Enable zlib support" ON "NOT enable-all" ON)
  CMAKE_DEPENDENT_OPTION(enable-png "Enable png support" ON "NOT enable-all" ON)
@@ -49,7 +49,7 @@
  
  # msvc fwprintf print char* for the specifier of "%s" format
  if(MSVC AND MSVC_VERSION GREATER 1899)
-@@ -247,11 +247,11 @@
+@@ -243,11 +243,11 @@
  #     endif(NOT enable-opengl)
  endif(enable-qt4 OR enable-qt5)
  
diff --git a/debian/patches/python2_and_python3.patch b/debian/patches/python2_and_python3.patch
deleted file mode 100644 (file)
index a026891..0000000
+++ /dev/null
@@ -1,233 +0,0 @@
-Provide support for both python2 and python3 interfaces
---- /dev/null
-+++ b/lang/python2/CMakeLists.txt
-@@ -0,0 +1,60 @@
-+set(src_imp_dep
-+../../include/mgl2/type.h
-+../../include/mgl2/data.h
-+../../include/mgl2/mgl.h
-+../mgl.i
-+../data.i
-+../type.i
-+)
-+
-+set(mgl_clean_files "")
-+
-+SET_SOURCE_FILES_PROPERTIES(../mathgl.i ../numpy.i PROPERTIES CPLUSPLUS ON)
-+
-+if(enable-python)
-+      set(Python_ADDITIONAL_VERSIONS 2.7)
-+      FIND_PACKAGE(PythonInterp)
-+      if(NOT PYTHONINTERP_FOUND)
-+              message(SEND_ERROR "Couldn't find python interpreter.")
-+      endif(NOT PYTHONINTERP_FOUND)
-+      FIND_PACKAGE(PythonLibs)
-+      if(NOT PYTHONLIBS_FOUND)
-+              message(SEND_ERROR "Couldn't find python development libraries.")
-+      endif(NOT PYTHONLIBS_FOUND)
-+      execute_process(
-+              COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.get_include()"
-+              OUTPUT_VARIABLE NUMPY_INCLUDE_PATH
-+              RESULT_VARIABLE NUMPY_ERR
-+              OUTPUT_STRIP_TRAILING_WHITESPACE
-+      )
-+      if(NOT NUMPY_INCLUDE_PATH)
-+              message(SEND_ERROR "Couldn't find numpy.")
-+      endif(NOT NUMPY_INCLUDE_PATH)
-+
-+      include_directories(${PYTHON_INCLUDE_DIR}  ${NUMPY_INCLUDE_PATH})
-+      execute_process(
-+              COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}')"
-+              OUTPUT_VARIABLE MGL_PYTHON_SITE_PACKAGES
-+              OUTPUT_STRIP_TRAILING_WHITESPACE)
-+      set(SWIG_MODULE_mathgl_EXTRA_DEPS ../numpy.i ${src_imp_dep})
-+      if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
-+              SWIG_ADD_MODULE(mathgl python ../mathgl.i)
-+      else(${CMAKE_VERSION} VERSION_LESS "3.8.0")
-+              SWIG_ADD_LIBRARY(mathgl LANGUAGE python SOURCES ../mathgl.i)
-+      endif(${CMAKE_VERSION} VERSION_LESS "3.8.0")
-+      SWIG_LINK_LIBRARIES(mathgl mgl ${PYTHON_LIBRARIES})
-+      set_target_properties(_mathgl PROPERTIES BUILD_WITH_INSTALL_RPATH ON)
-+      add_custom_command(OUTPUT mathgl.pyc
-+              COMMAND ${PYTHON_EXECUTABLE}
-+              ARGS -c \"from py_compile import compile\; compile('mathgl.py') \"
-+              WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lang/python2
-+              DEPENDS _mathgl
-+      )
-+      add_custom_target(mgl_python_module ALL DEPENDS _mathgl mathgl.pyc)
-+
-+      install(FILES ${MathGL2_BINARY_DIR}/lang/python2/mathgl.py ${MathGL2_BINARY_DIR}/lang/python2/mathgl.pyc DESTINATION ${MGL_PYTHON_SITE_PACKAGES})
-+      install (TARGETS _mathgl LIBRARY DESTINATION ${MGL_PYTHON_SITE_PACKAGES})
-+      set(mgl_clean_files ${mgl_clean_files} mathgl.py)
-+endif(enable-python)
-+
-+set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${mgl_clean_files}")
---- /dev/null
-+++ b/lang/python3/CMakeLists.txt
-@@ -0,0 +1,70 @@
-+set(src_imp_dep
-+../../include/mgl2/type.h
-+../../include/mgl2/data.h
-+../../include/mgl2/mgl.h
-+../mgl.i
-+../data.i
-+../type.i
-+)
-+
-+set(mgl_clean_files "")
-+
-+SET_SOURCE_FILES_PROPERTIES(../mathgl.i ../numpy.i PROPERTIES CPLUSPLUS ON)
-+
-+if(enable-python)
-+      set(Python_ADDITIONAL_VERSIONS ${PY3VERSION_DOTTED})
-+      unset(PYTHONINTERP_FOUND)
-+      unset(PYTHON_EXECUTABLE CACHE)
-+      FIND_PACKAGE(PythonInterp ${PY3VERSION_DOTTED} REQUIRED)
-+      if(NOT PYTHONINTERP_FOUND)
-+              message(SEND_ERROR "Couldn't find python interpreter.")
-+      endif(NOT PYTHONINTERP_FOUND)
-+      unset(PYTHONLIBS_FOUND)
-+      unset(PYTHON_LIBRARIES CACHE)
-+      unset(PYTHON_INCLUDE_PATH CACHE)
-+      unset(PYTHON_INCLUDE_DIRS CACHE)
-+      unset(PYTHON_DEBUG_LIBRARIES CACHE)
-+      unset(PYTHONLIBS_VERSION_STRING CACHE)
-+      unset(PYTHON_LIBRARY CACHE)
-+      unset(PYTHON_INCLUDE_DIR CACHE)
-+      FIND_PACKAGE(PythonLibs ${PY3VERSION_DOTTED} REQUIRED)
-+      if(NOT PYTHONLIBS_FOUND)
-+              message(SEND_ERROR "Couldn't find python development libraries.")
-+      endif(NOT PYTHONLIBS_FOUND)
-+      execute_process(
-+              COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print (numpy.get_include())"
-+              OUTPUT_VARIABLE NUMPY_INCLUDE_PATH
-+              RESULT_VARIABLE NUMPY_ERR
-+              OUTPUT_STRIP_TRAILING_WHITESPACE
-+      )
-+      if(NOT NUMPY_INCLUDE_PATH)
-+              message(SEND_ERROR "Couldn't find numpy.")
-+      endif(NOT NUMPY_INCLUDE_PATH)
-+
-+      include_directories(${PYTHON_INCLUDE_DIR}  ${NUMPY_INCLUDE_PATH})
-+      execute_process(
-+              COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}'))"
-+              OUTPUT_VARIABLE MGL_PYTHON_SITE_PACKAGES
-+              OUTPUT_STRIP_TRAILING_WHITESPACE)
-+      set(SWIG_MODULE_mathglp3_EXTRA_DEPS ../numpy.i ${src_imp_dep})
-+      if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
-+              SWIG_ADD_MODULE(mathglp3 python ../mathgl.i)
-+      else(${CMAKE_VERSION} VERSION_LESS "3.8.0")
-+              SWIG_ADD_LIBRARY(mathglp3 LANGUAGE python SOURCES ../mathgl.i)
-+      endif(${CMAKE_VERSION} VERSION_LESS "3.8.0")
-+      SWIG_LINK_LIBRARIES(mathglp3 mgl ${PYTHON_LIBRARIES})
-+      set_target_properties(_mathglp3 PROPERTIES BUILD_WITH_INSTALL_RPATH ON)
-+      add_custom_command(OUTPUT mathgl.pyc
-+              COMMAND ${PYTHON_EXECUTABLE}
-+              ARGS -c \"from py_compile import compile\; compile('mathgl.py') \"
-+              WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lang/python3
-+              DEPENDS _mathglp3
-+      )
-+      add_custom_target(mglp3_python_module ALL DEPENDS _mathglp3 mathgl.pyc)
-+
-+      install(FILES ${MathGL2_BINARY_DIR}/lang/python3/mathgl.py ${MathGL2_BINARY_DIR}/lang/python3/__pycache__/mathgl.cpython-${PY3VERSION_NODOT}.pyc DESTINATION ${MGL_PYTHON_SITE_PACKAGES}/__pycache__)
-+      install (TARGETS _mathglp3 LIBRARY DESTINATION ${MGL_PYTHON_SITE_PACKAGES})
-+      set(mgl_clean_files ${mgl_clean_files} mathgl.py)
-+endif(enable-python)
-+
-+set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${mgl_clean_files}")
---- a/lang/numpy.i
-+++ b/lang/numpy.i
-@@ -107,11 +107,12 @@
-     if (PyDict_Check(    py_obj)) return "dict"        ;
-     if (PyList_Check(    py_obj)) return "list"        ;
-     if (PyTuple_Check(   py_obj)) return "tuple"       ;
--    if (PyFile_Check(    py_obj)) return "file"        ;
-     if (PyModule_Check(  py_obj)) return "module"      ;
--    if (PyInstance_Check(py_obj)) return "instance"    ;
--
--    return "unknow type";
-+    %# if PY_MAJOR_VERSION < 3
-+        if (PyFile_Check(    py_obj)) return "file"        ;
-+        if (PyInstance_Check(py_obj)) return "instance"    ;
-+    %# endif
-+    return "unknown type";
-   }
-   /* Given a NumPy typecode, return a string describing the type.
---- a/lang/CMakeLists.txt
-+++ b/lang/CMakeLists.txt
-@@ -17,52 +17,6 @@
- endif(NOT SWIG_FOUND)
- INCLUDE(${SWIG_USE_FILE})
--if(enable-python)
--      set(Python_ADDITIONAL_VERSIONS 2.7)
--      FIND_PACKAGE(PythonInterp)
--      if(NOT PYTHONINTERP_FOUND)
--              message(SEND_ERROR "Couldn't find python interpreter.")
--      endif(NOT PYTHONINTERP_FOUND)
--      FIND_PACKAGE(PythonLibs)
--      if(NOT PYTHONLIBS_FOUND)
--              message(SEND_ERROR "Couldn't find python development libraries.")
--      endif(NOT PYTHONLIBS_FOUND)
--      execute_process(
--              COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.get_include()"
--              OUTPUT_VARIABLE NUMPY_INCLUDE_PATH
--              RESULT_VARIABLE NUMPY_ERR
--              OUTPUT_STRIP_TRAILING_WHITESPACE
--      )
--      if(NOT NUMPY_INCLUDE_PATH)
--              message(SEND_ERROR "Couldn't find numpy.")
--      endif(NOT NUMPY_INCLUDE_PATH)
--
--      include_directories(${PYTHON_INCLUDE_DIR}  ${NUMPY_INCLUDE_PATH})
--      execute_process(
--              COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}')"
--              OUTPUT_VARIABLE MGL_PYTHON_SITE_PACKAGES
--              OUTPUT_STRIP_TRAILING_WHITESPACE)
--      set(SWIG_MODULE_mathgl_EXTRA_DEPS numpy.i ${src_imp_dep})
--      if(${CMAKE_VERSION} VERSION_LESS "3.8.0") 
--              SWIG_ADD_MODULE(mathgl python mathgl.i)
--      else(${CMAKE_VERSION} VERSION_LESS "3.8.0")
--              SWIG_ADD_LIBRARY(mathgl LANGUAGE python SOURCES mathgl.i)
--      endif(${CMAKE_VERSION} VERSION_LESS "3.8.0")
--      SWIG_LINK_LIBRARIES(mathgl mgl ${PYTHON_LIBRARIES})
--      set_target_properties(_mathgl PROPERTIES BUILD_WITH_INSTALL_RPATH ON)
--      add_custom_command(OUTPUT mathgl.pyc
--              COMMAND ${PYTHON_EXECUTABLE}
--              ARGS -c \"from py_compile import compile\; compile('mathgl.py') \"
--              WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lang
--              DEPENDS _mathgl
--      )
--      add_custom_target(mgl_python_module ALL DEPENDS _mathgl mathgl.pyc)
--
--      install(FILES ${MathGL2_BINARY_DIR}/lang/mathgl.py ${MathGL2_BINARY_DIR}/lang/mathgl.pyc DESTINATION ${MGL_PYTHON_SITE_PACKAGES})
--      install (TARGETS _mathgl LIBRARY DESTINATION ${MGL_PYTHON_SITE_PACKAGES})
--      set(mgl_clean_files ${mgl_clean_files} mathgl.py)
--endif(enable-python)
--
- if(enable-lua)
-       INCLUDE(FindLua51)
-       if(NOT LUA51_FOUND)
-@@ -145,4 +99,8 @@
-       endif(enable-octave-install)
-       set(mgl_clean_files ${mgl_clean_files} mathgl)
- endif(enable-octave)
-+
-+add_subdirectory( python2 )
-+add_subdirectory( python3 )
-+
- set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${mgl_clean_files}")
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -6,6 +6,10 @@
- set(MGL_DEP_LIBS)
- add_definitions(-DMGL_SRC)
-+# Set these on command-line
-+# set(PY3VERSION_DOTTED 3.6)
-+# set(PY3VERSION_NODOT  36)
-+
- #add_definitions(-DZLIB_WINAPI)
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${MathGL2_SOURCE_DIR}/scripts)
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
new file mode 100644 (file)
index 0000000..efa9a70
--- /dev/null
@@ -0,0 +1,88 @@
+--- a/lang/CMakeLists.txt
++++ b/lang/CMakeLists.txt
+@@ -18,17 +18,27 @@
+ INCLUDE(${SWIG_USE_FILE})
+ if(enable-python)
+-      set(Python_ADDITIONAL_VERSIONS 2.7)
+-      FIND_PACKAGE(PythonInterp)
++      set(Python_ADDITIONAL_VERSIONS ${PY3VERSION_DOTTED})
++      unset(PYTHONINTERP_FOUND)
++      unset(PYTHON_EXECUTABLE CACHE)
++      FIND_PACKAGE(PythonInterp ${PY3VERSION_DOTTED} REQUIRED)
+       if(NOT PYTHONINTERP_FOUND)
+               message(SEND_ERROR "Couldn't find python interpreter.")
+       endif(NOT PYTHONINTERP_FOUND)
+-      FIND_PACKAGE(PythonLibs)
++      unset(PYTHONLIBS_FOUND)
++      unset(PYTHON_LIBRARIES CACHE)
++      unset(PYTHON_INCLUDE_PATH CACHE)
++      unset(PYTHON_INCLUDE_DIRS CACHE)
++      unset(PYTHON_DEBUG_LIBRARIES CACHE)
++      unset(PYTHONLIBS_VERSION_STRING CACHE)
++      unset(PYTHON_LIBRARY CACHE)
++      unset(PYTHON_INCLUDE_DIR CACHE)
++      FIND_PACKAGE(PythonLibs ${PY3VERSION_DOTTED} REQUIRED)
+       if(NOT PYTHONLIBS_FOUND)
+               message(SEND_ERROR "Couldn't find python development libraries.")
+       endif(NOT PYTHONLIBS_FOUND)
+       execute_process(
+-              COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print numpy.get_include()"
++              COMMAND ${PYTHON_EXECUTABLE} -c "import numpy; print (numpy.get_include())"
+               OUTPUT_VARIABLE NUMPY_INCLUDE_PATH
+               RESULT_VARIABLE NUMPY_ERR
+               OUTPUT_STRIP_TRAILING_WHITESPACE
+@@ -39,27 +49,27 @@
+       include_directories(${PYTHON_INCLUDE_DIR}  ${NUMPY_INCLUDE_PATH})
+       execute_process(
+-              COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}')"
++              COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib(prefix='${CMAKE_INSTALL_PREFIX}'))"
+               OUTPUT_VARIABLE MGL_PYTHON_SITE_PACKAGES
+               OUTPUT_STRIP_TRAILING_WHITESPACE)
+-      set(SWIG_MODULE_mathgl_EXTRA_DEPS numpy.i ${src_imp_dep})
+-      if(${CMAKE_VERSION} VERSION_LESS "3.8.0") 
+-              SWIG_ADD_MODULE(mathgl python mathgl.i)
++      set(SWIG_MODULE_mathglp3_EXTRA_DEPS numpy.i ${src_imp_dep})
++      if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
++              SWIG_ADD_MODULE(mathglp3 python mathgl.i)
+       else(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+-              SWIG_ADD_LIBRARY(mathgl LANGUAGE python SOURCES mathgl.i)
++              SWIG_ADD_LIBRARY(mathglp3 LANGUAGE python SOURCES mathgl.i)
+       endif(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+-      SWIG_LINK_LIBRARIES(mathgl mgl ${PYTHON_LIBRARIES})
+-      set_target_properties(_mathgl PROPERTIES BUILD_WITH_INSTALL_RPATH ON)
++      SWIG_LINK_LIBRARIES(mathglp3 mgl ${PYTHON_LIBRARIES})
++      set_target_properties(_mathglp3 PROPERTIES BUILD_WITH_INSTALL_RPATH ON)
+       add_custom_command(OUTPUT mathgl.pyc
+               COMMAND ${PYTHON_EXECUTABLE}
+               ARGS -c \"from py_compile import compile\; compile('mathgl.py') \"
+               WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lang
+-              DEPENDS _mathgl
++              DEPENDS _mathglp3
+       )
+-      add_custom_target(mgl_python_module ALL DEPENDS _mathgl mathgl.pyc)
++      add_custom_target(mglp3_python_module ALL DEPENDS _mathglp3 mathgl.pyc)
+-      install(FILES ${MathGL2_BINARY_DIR}/lang/mathgl.py ${MathGL2_BINARY_DIR}/lang/mathgl.pyc DESTINATION ${MGL_PYTHON_SITE_PACKAGES})
+-      install (TARGETS _mathgl LIBRARY DESTINATION ${MGL_PYTHON_SITE_PACKAGES})
++      install(FILES ${MathGL2_BINARY_DIR}/lang/mathgl.py ${MathGL2_BINARY_DIR}/lang/__pycache__/mathgl.cpython-${PY3VERSION_NODOT}.pyc DESTINATION ${MGL_PYTHON_SITE_PACKAGES}/__pycache__)
++      install (TARGETS _mathglp3 LIBRARY DESTINATION ${MGL_PYTHON_SITE_PACKAGES})
+       set(mgl_clean_files ${mgl_clean_files} mathgl.py)
+ endif(enable-python)
+--- a/lang/numpy.i
++++ b/lang/numpy.i
+@@ -107,11 +107,9 @@
+     if (PyDict_Check(    py_obj)) return "dict"        ;
+     if (PyList_Check(    py_obj)) return "list"        ;
+     if (PyTuple_Check(   py_obj)) return "tuple"       ;
+-    if (PyFile_Check(    py_obj)) return "file"        ;
+     if (PyModule_Check(  py_obj)) return "module"      ;
+-    if (PyInstance_Check(py_obj)) return "instance"    ;
+-    return "unknow type";
++    return "unknown type";
+   }
+   /* Given a NumPy typecode, return a string describing the type.
index c8e77bce83ac1f7cb9f5bcc37bf12242358ad5bf..25c7c1c29657c70ffd460533dcdbcfe3a7423f26 100644 (file)
@@ -1,2 +1,2 @@
-python2_and_python3.patch
+python3.patch
 CMakeLists.patch