Provide support for both python2 and python3 interfaces
+Index: mathgl-2.4.2.1/lang/python2/CMakeLists.txt
+===================================================================
--- /dev/null
-+++ b/lang/python2/CMakeLists.txt
++++ mathgl-2.4.2.1/lang/python2/CMakeLists.txt
@@ -0,0 +1,60 @@
+set(src_imp_dep
+../../include/mgl2/type.h
+endif(enable-python)
+
+set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${mgl_clean_files}")
+Index: mathgl-2.4.2.1/lang/python3/CMakeLists.txt
+===================================================================
--- /dev/null
-+++ b/lang/python3/CMakeLists.txt
++++ mathgl-2.4.2.1/lang/python3/CMakeLists.txt
@@ -0,0 +1,70 @@
+set(src_imp_dep
+../../include/mgl2/type.h
+SET_SOURCE_FILES_PROPERTIES(../mathgl.i ../numpy.i PROPERTIES CPLUSPLUS ON)
+
+if(enable-python)
-+ set(Python_ADDITIONAL_VERSIONS 3.6)
++ set(Python_ADDITIONAL_VERSIONS ${PY3VERSION_DOTTED})
+ unset(PYTHONINTERP_FOUND)
+ unset(PYTHON_EXECUTABLE CACHE)
-+ FIND_PACKAGE(PythonInterp 3.6 REQUIRED)
++ FIND_PACKAGE(PythonInterp ${PY3VERSION_DOTTED} REQUIRED)
+ if(NOT PYTHONINTERP_FOUND)
+ message(SEND_ERROR "Couldn't find python interpreter.")
+ endif(NOT PYTHONINTERP_FOUND)
+ unset(PYTHONLIBS_VERSION_STRING CACHE)
+ unset(PYTHON_LIBRARY CACHE)
+ unset(PYTHON_INCLUDE_DIR CACHE)
-+ FIND_PACKAGE(PythonLibs 3.6 REQUIRED)
++ FIND_PACKAGE(PythonLibs ${PY3VERSION_DOTTED} REQUIRED)
+ if(NOT PYTHONLIBS_FOUND)
+ message(SEND_ERROR "Couldn't find python development libraries.")
+ endif(NOT PYTHONLIBS_FOUND)
+ )
+ 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-36.pyc DESTINATION ${MGL_PYTHON_SITE_PACKAGES}/__pycache__)
++ 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
+Index: mathgl-2.4.2.1/lang/numpy.i
+===================================================================
+--- mathgl-2.4.2.1.orig/lang/numpy.i
++++ mathgl-2.4.2.1/lang/numpy.i
@@ -107,11 +107,12 @@
if (PyDict_Check( py_obj)) return "dict" ;
if (PyList_Check( py_obj)) return "list" ;
}
/* Given a NumPy typecode, return a string describing the type.
---- a/lang/CMakeLists.txt
-+++ b/lang/CMakeLists.txt
-@@ -17,52 +17,6 @@
+Index: mathgl-2.4.2.1/lang/CMakeLists.txt
+===================================================================
+--- mathgl-2.4.2.1.orig/lang/CMakeLists.txt
++++ mathgl-2.4.2.1/lang/CMakeLists.txt
+@@ -17,52 +17,6 @@ if(NOT SWIG_FOUND)
endif(NOT SWIG_FOUND)
INCLUDE(${SWIG_USE_FILE})
if(enable-lua)
INCLUDE(FindLua51)
if(NOT LUA51_FOUND)
-@@ -145,4 +99,8 @@
+@@ -145,4 +99,8 @@ message(STATUS "${oct_prog} ${oct_host}
endif(enable-octave-install)
set(mgl_clean_files ${mgl_clean_files} mathgl)
endif(enable-octave)
+add_subdirectory( python3 )
+
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${mgl_clean_files}")
+Index: mathgl-2.4.2.1/CMakeLists.txt
+===================================================================
+--- mathgl-2.4.2.1.orig/CMakeLists.txt
++++ mathgl-2.4.2.1/CMakeLists.txt
+@@ -9,6 +9,10 @@ set(mgl_clean_files )
+ 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)
+