[magics] 12/63: Add -py3 for python3 support; remove obsolete stuff
Alastair McKinstry
mckinstry at moszumanska.debian.org
Fri Mar 24 10:41:42 UTC 2017
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository magics.
commit e917b1b877ffad394090eca3cb8fb7ff7b42bb2b
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Mon Jun 13 03:53:58 2016 +0100
Add -py3 for python3 support; remove obsolete stuff
---
debian/patches/python3.patch | 307 ++++++++++---------------------------------
1 file changed, 69 insertions(+), 238 deletions(-)
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index 611bb1a..595824a 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -1,7 +1,7 @@
-Index: magics++-2.24.4/tools/axis2doc.py
+Index: magics++-2.28.0/tools/axis2doc.py
===================================================================
---- magics++-2.24.4.orig/tools/axis2doc.py
-+++ magics++-2.24.4/tools/axis2doc.py
+--- magics++-2.28.0.orig/tools/axis2doc.py
++++ magics++-2.28.0/tools/axis2doc.py
@@ -1,4 +1,6 @@
#!/usr/bin/python
+
@@ -137,10 +137,10 @@ Index: magics++-2.24.4/tools/axis2doc.py
defp = self.magics[p]
# internal object
for p in defp["parameters"]:
-Index: magics++-2.24.4/tools/beau.py
+Index: magics++-2.28.0/tools/beau.py
===================================================================
---- magics++-2.24.4.orig/tools/beau.py
-+++ magics++-2.24.4/tools/beau.py
+--- magics++-2.28.0.orig/tools/beau.py
++++ magics++-2.28.0/tools/beau.py
@@ -1,10 +1,10 @@
-
+from __future__ import print_function
@@ -154,10 +154,10 @@ Index: magics++-2.24.4/tools/beau.py
+print (pretty_xml_as_string)
-Index: magics++-2.24.4/tools/xml2doc.py
+Index: magics++-2.28.0/tools/xml2doc.py
===================================================================
---- magics++-2.24.4.orig/tools/xml2doc.py
-+++ magics++-2.24.4/tools/xml2doc.py
+--- magics++-2.28.0.orig/tools/xml2doc.py
++++ magics++-2.28.0/tools/xml2doc.py
@@ -1,4 +1,4 @@
-
+from __future__ import print_function
@@ -173,10 +173,10 @@ Index: magics++-2.24.4/tools/xml2doc.py
object = ObjectHandler()
parser = make_parser()
object.params = []
-Index: magics++-2.24.4/tools/xml2html.py
+Index: magics++-2.28.0/tools/xml2html.py
===================================================================
---- magics++-2.24.4.orig/tools/xml2html.py
-+++ magics++-2.24.4/tools/xml2html.py
+--- magics++-2.28.0.orig/tools/xml2html.py
++++ magics++-2.28.0/tools/xml2html.py
@@ -1,4 +1,5 @@
#!/usr/bin/python
+from __future__ import print_function
@@ -279,10 +279,10 @@ Index: magics++-2.24.4/tools/xml2html.py
param[val] = self.build(param[val], action)
else :
param[val] = []
-Index: magics++-2.24.4/tools/xml2odt.py
+Index: magics++-2.28.0/tools/xml2odt.py
===================================================================
---- magics++-2.24.4.orig/tools/xml2odt.py
-+++ magics++-2.24.4/tools/xml2odt.py
+--- magics++-2.28.0.orig/tools/xml2odt.py
++++ magics++-2.28.0/tools/xml2odt.py
@@ -1,4 +1,5 @@
#!/usr/bin/python
+from __future__ import print_function
@@ -300,10 +300,10 @@ Index: magics++-2.24.4/tools/xml2odt.py
sys.exit()
-Index: magics++-2.24.4/tools/xml2split.py
+Index: magics++-2.28.0/tools/xml2split.py
===================================================================
---- magics++-2.24.4.orig/tools/xml2split.py
-+++ magics++-2.24.4/tools/xml2split.py
+--- magics++-2.28.0.orig/tools/xml2split.py
++++ magics++-2.28.0/tools/xml2split.py
@@ -1,5 +1,5 @@
-
@@ -336,10 +336,10 @@ Index: magics++-2.24.4/tools/xml2split.py
if ( self.open_file == 0):
return
-Index: magics++-2.24.4/tools/xml2mv.py
+Index: magics++-2.28.0/tools/xml2mv.py
===================================================================
---- magics++-2.24.4.orig/tools/xml2mv.py
-+++ magics++-2.24.4/tools/xml2mv.py
+--- magics++-2.28.0.orig/tools/xml2mv.py
++++ magics++-2.28.0/tools/xml2mv.py
@@ -1,4 +1,5 @@
#!/usr/bin/python
+from __future__ import print_function
@@ -357,6 +357,15 @@ Index: magics++-2.24.4/tools/xml2mv.py
sys.exit()
+@@ -73,7 +74,7 @@ class ObjectHandler(ContentHandler):
+
+ def default(self, attrs):
+ val = attrs.get("metview_default");
+- if ( isinstance(val, NoneType) ):
++ if ( isinstance(val, type(None)) ):
+ val = attrs.get("default");
+
+ if (val == "") :
@@ -311,7 +312,7 @@ class ObjectHandler(ContentHandler):
@@ -493,6 +502,15 @@ Index: magics++-2.24.4/tools/xml2mv.py
self.newparam(self.param, f(self, attrs), self.default(attrs))
else:
self.last = self.last + self.options(attrs)
+@@ -605,7 +606,7 @@ class ObjectHandler(ContentHandler):
+ # self.classes[attrs.get("name")]["inherits_reqs_from"].add(self.classname)
+ # print "YClass " + attrs.get("name") + " inherits_reqs_from " + self.classname
+ if attrs.get("docdive") != 'no' and attrs.get("doc_inherits") != 'no' :
+- if ( not(isinstance(attrs.get("xmlfile"), NoneType))):
++ if ( not(isinstance(attrs.get("xmlfile"), type(None)))):
+ fname = "/%s.xml" % attrs.get("xmlfile")
+ else:
+ fname = "%s/%s.xml" % (sys.argv[1], attrs.get("name"))
@@ -614,7 +615,7 @@ class ObjectHandler(ContentHandler):
file = open(fname, "r")
self.filehistory.append(fname)
@@ -528,16 +546,16 @@ Index: magics++-2.24.4/tools/xml2mv.py
saxparser.parse(datasource)
-print "DONE"
+print ("DONE")
-Index: magics++-2.24.4/python/Magics/macro.py
+Index: magics++-2.28.0/python/Magics/macro.py
===================================================================
---- magics++-2.24.4.orig/python/Magics/macro.py
-+++ magics++-2.24.4/python/Magics/macro.py
+--- magics++-2.28.0.orig/python/Magics/macro.py
++++ magics++-2.28.0/python/Magics/macro.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import os
import Magics
import numpy
-@@ -60,7 +61,7 @@ class Action(object):
+@@ -61,7 +62,7 @@ class Action(object):
return x
def inspect(self):
@@ -546,7 +564,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
def quote(self, v):
return "\"" + v + "\""
-@@ -119,12 +120,12 @@ class Action(object):
+@@ -120,12 +121,12 @@ class Action(object):
dim = len(self.args[key].shape)
if isinstance(self.args[key][0], int):
if (dim == 2) :
@@ -562,7 +580,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
else :
vval = ""
vsep = ""
-@@ -137,10 +138,10 @@ class Action(object):
+@@ -138,10 +139,10 @@ class Action(object):
vval += ""
val+= '%s%s = [%s]'%(sep, key, vval)
else :
@@ -575,7 +593,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
def tomv4(self, file):
sep="\t"
-@@ -166,20 +167,20 @@ class Action(object):
+@@ -167,20 +168,20 @@ class Action(object):
vval += "]"
val+= '%s%s = %s'%(sep, key.upper(), vval)
elif isinstance(self.args[key][0], int):
@@ -601,7 +619,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
else :
vval = "["
vsep = ""
-@@ -190,10 +191,10 @@ class Action(object):
+@@ -191,10 +192,10 @@ class Action(object):
val+= '%s%s = %s'%(sep, key.upper(), vval)
else :
@@ -614,7 +632,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
-@@ -201,18 +202,18 @@ class Action(object):
+@@ -202,18 +203,18 @@ class Action(object):
def tofortran(self, f):
if self.action == Magics.new_page :
@@ -637,7 +655,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
elif isinstance(self.args[key], list) :
if isinstance (self.args[key][0], str):
nb = 0
-@@ -229,9 +230,9 @@ class Action(object):
+@@ -230,9 +231,9 @@ class Action(object):
sep = ",&\n\t\t"
newline = newline + 70
val += "/)"
@@ -649,7 +667,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
elif isinstance(self.args[key][0], float):
val = "(/"
sep = ""
-@@ -239,18 +240,18 @@ class Action(object):
+@@ -240,18 +241,18 @@ class Action(object):
val += sep + ("%0.2f" % v)
sep = ", "
val += "/)"
@@ -672,7 +690,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
else :
val = "(/"
sep = ""
-@@ -258,20 +259,20 @@ class Action(object):
+@@ -259,20 +260,20 @@ class Action(object):
val += sep + ("%0.2f" % v)
sep = ", "
val += "/)"
@@ -700,7 +718,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
def clean_object(self, obj):
-@@ -290,8 +291,8 @@ class Action(object):
+@@ -291,8 +292,8 @@ class Action(object):
for i,v in obj.iteritems():
obj[i] = self.clean_object(v)
else:
@@ -711,7 +729,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
obj = str(obj)
return obj
-@@ -331,7 +332,7 @@ class Action(object):
+@@ -332,7 +333,7 @@ class Action(object):
else :
Magics.set1r(key, self.args[key].copy())
else :
@@ -720,7 +738,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
else:
self.args[key].execute(key)
-@@ -439,26 +440,26 @@ def plot(*args):
+@@ -443,26 +444,26 @@ def plot(*args):
def tofortran(file, *args):
@@ -761,7 +779,7 @@ Index: magics++-2.24.4/python/Magics/macro.py
class odb_filter(object):
def __init__(self, _m = None,**kw):
-@@ -472,17 +473,17 @@ class odb_filter(object):
+@@ -476,17 +477,17 @@ class odb_filter(object):
odb = "%s.odb" % file
context.tmp.append(odb)
cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -f newodb -o " + odb
@@ -783,10 +801,10 @@ Index: magics++-2.24.4/python/Magics/macro.py
- print "Error in viewing ODB data... Aborting"
+ print ("Error in viewing ODB data... Aborting")
os.abort();
-Index: magics++-2.24.4/python/Magics/metgram.py
+Index: magics++-2.28.0/python/Magics/metgram.py
===================================================================
---- magics++-2.24.4.orig/python/Magics/metgram.py
-+++ magics++-2.24.4/python/Magics/metgram.py
+--- magics++-2.28.0.orig/python/Magics/metgram.py
++++ magics++-2.28.0/python/Magics/metgram.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
import simplejson
@@ -801,205 +819,18 @@ Index: magics++-2.24.4/python/Magics/metgram.py
f.close
-Index: magics++-2.24.4/CMakeLists.txt
-===================================================================
---- magics++-2.24.4.orig/CMakeLists.txt
-+++ magics++-2.24.4/CMakeLists.txt
-@@ -49,6 +49,7 @@ option( ENABLE_CAIRO "enable ca
- option( ENABLE_GEOTIFF "enable geotiff support [implies cairo]" OFF )
-
- option( ENABLE_PYTHON "enable python interface" ON )
-+option( ENABLE_PYTHON3 "enable python3 interface" ON )
- option( ENABLE_FORTRAN "enable fortran interface" ON )
-
- option( ENABLE_METVIEW "enable Metview interface" OFF )
-@@ -69,6 +70,7 @@ set( MAGICS_HTML_ROOT "${CMAKE_BI
- file(MAKE_DIRECTORY ${MAGICS_HTML_ROOT} )
-
- set( MAG_PYTHON_PATH ${CMAKE_BINARY_DIR}/python )
-+set( MAG_PYTHON3_PATH ${CMAKE_BINARY_DIR}/python3 )
-
- ###############################################################################
- # projects
-@@ -96,6 +98,19 @@ if( ENABLE_PYTHON )
- find_package( SWIG REQUIRED )
- find_package( NumPy REQUIRED )
- endif()
-+
-+if( ENABLE_PYTHON3 )
-+ ecbuild_find_python3( REQUIRED )
-+ debug_var( PYTHON3_INCLUDE_DIRS )
-+ debug_var( PYTHON3_LIBRARIES )
-+
-+ if( NOT PYTHON3_INCLUDE_DIRS OR NOT PYTHON3_LIBRARIES )
-+ message( FATAL_ERROR "Couldn't find Python3 libraries" )
-+ endif()
-+ find_package( SWIG REQUIRED )
-+ find_package( NumPy3 REQUIRED )
-+endif()
-+
- if( SWIG_FOUND )
- include(UseSWIG)
- endif()
-Index: magics++-2.24.4/cmake/ecbuild_find_python3.cmake
-===================================================================
---- /dev/null
-+++ magics++-2.24.4/cmake/ecbuild_find_python3.cmake
-@@ -0,0 +1,132 @@
-+# (C) Copyright 1996-2014 ECMWF.
-+#
-+# This software is licensed under the terms of the Apache Licence Version 2.0
-+# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
-+# In applying this licence, ECMWF does not waive the privileges and immunities
-+# granted to it by virtue of its status as an intergovernmental organisation nor
-+# does it submit to any jurisdiction.
-+
-+############################################################################################
-+# macro to find python3
-+
-+# OUTPUT:
-+# PYTHON3INTERP_FOUND
-+# PYTHON3LIBS_FOUND
-+# PYTHON3_INCLUDE_DIRS
-+# PYTHON3_LIBRARIES
-+# PYTHON3_SITE_PACKAGES
-+
-+macro( ecbuild_find_python3 )
-+
-+ # parse parameters
-+
-+ set( options REQUIRED )
-+ set( single_value_args VERSION )
-+ set( multi_value_args )
-+
-+ cmake_parse_arguments( _p "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
-+
-+ if(_p_UNPARSED_ARGUMENTS)
-+ message(FATAL_ERROR "Unknown keywords given to ecbuild_find_python(): \"${_p_UNPARSED_ARGUMENTS}\"")
-+ endif()
-+
-+ # find python3 executable
-+
-+ set(Python_ADDITIONAL_VERSIONS 3.4)
-+ find_package( PythonInterp )
-+
-+ if( NOT PYTHON3INTERP_FOUND AND _p_REQUIRED )
-+ message( FATAL_ERROR "Failed to find any Python3 interpreter (REQUIRED)" )
-+ endif()
-+
-+ # find python version
-+ # execute_process( COMMAND ${PYTHON_EXECUTABLE} -V ERROR_VARIABLE _version RESULT_VARIABLE _return ERROR_STRIP_TRAILING_WHITESPACE)
-+ # if( NOT _return )
-+ # string(REGEX REPLACE ".*([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1.\\2.\\3" PYTHON_VERSION ${_version} )
-+ # endif()
-+ # endif()
-+
-+ # message( STATUS "Python version ${PYTHON_VERSION_STRING}" )
-+ # debug_var(PYTHON_VERSION_MAJOR)
-+ # debug_var(PYTHON_VERSION_MINOR)
-+ # debug_var(PYTHON_VERSION_PATCH)
-+
-+ if( PYTHON3INTERP_FOUND AND DEFINED _p_VERSION )
-+ if( _p_VERSION VERSION_GREATER "${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}.${PYTHON3_VERSION_PATCH}" )
-+ set( PYTHON3INTERP_FOUND 0 )
-+ set( PYTHON3_EXECUTABLE "PYTHON3_EXECUTABLE-NOTFOUND" )
-+ if( _p_REQUIRED )
-+ message( FATAL_ERROR "Required python3 version at least ${_p_VERSION} but found only ${PYTHON3_VERSION_STRING}" )
-+ else()
-+ message( WARNING "Looking for python3 version at least ${_p_VERSION} but found only ${PYTHON3_VERSION_STRING}\nMarking Python3 as NOTFOUND" )
-+ endif()
-+ endif()
-+ endif()
-+
-+ if( PYTHON3INTERP_FOUND )
-+
-+ # find python3 config
-+
-+ if( PYTHON3_EXECUTABLE AND EXISTS ${PYTHON3_EXECUTABLE}-config )
-+ set(PYTHON3_CONFIG ${PYTHON3_EXECUTABLE}-config CACHE PATH "" FORCE)
-+ else()
-+ find_program( PYTHON3_CONFIG NAMES python3-config python3-config${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR} )
-+ endif()
-+
-+ # find python3 libs
-+
-+ # The OpenBSD python packages have python-config's
-+ # that don't reliably report linking flags that will work.
-+
-+ if( PYTHON3_CONFIG AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" )
-+
-+ execute_process(COMMAND "${PYTHON3_CONFIG}" --ldflags
-+ OUTPUT_VARIABLE PYTHON3_LIBRARIES
-+ OUTPUT_STRIP_TRAILING_WHITESPACE
-+ ERROR_QUIET)
-+
-+ execute_process(COMMAND "${PYTHON3_CONFIG}" --includes
-+ OUTPUT_VARIABLE PYTHON3_INCLUDE_DIR
-+ OUTPUT_STRIP_TRAILING_WHITESPACE
-+ ERROR_QUIET)
-+
-+# debug_var(PYTHON3_LIBRARIES)
-+# debug_var(PYTHON3_INCLUDE_DIR)
-+
-+ string(REGEX REPLACE "^[-I]" "" PYTHON3_INCLUDE_DIR "${PYTHON3_INCLUDE_DIR}")
-+ string(REGEX REPLACE "[ ]-I" " " PYTHON3_INCLUDE_DIR "${PYTHON3_INCLUDE_DIR}")
-+
-+ separate_arguments(PYTHON3_INCLUDE_DIR)
-+
-+ else() # revert to finding pythonlibs the standard way (cmake macro)
-+
-+ find_package(Python3Libs)
-+ if( PYTHON3_INCLUDE_PATH AND NOT PYTHON3_INCLUDE_DIR )
-+ set(PYTHON3_INCLUDE_DIR "${PYTHON3_INCLUDE_PATH}")
-+ endif()
-+
-+ endif()
-+
-+ # set output variables
-+
-+ find_package_handle_standard_args( Python3Libs DEFAULT_MSG PYTHON3_INCLUDE_DIR PYTHON3_LIBRARIES )
-+
-+ set( PYTHON3_INCLUDE_DIRS ${PYTHON3_INCLUDE_DIR} )
-+ set( PYTHON3_INCLUDE_PATH ${PYTHON3_INCLUDE_DIR} )
-+
-+ list( REMOVE_DUPLICATES PYTHON3_INCLUDE_DIRS )
-+
-+ # find where python3 site-packages are ...
-+
-+ execute_process(COMMAND ${PYTHON3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
-+
-+ endif()
-+
-+# debug_var( PYTHON3INTERP_FOUND )
-+# debug_var( PYTHON3_EXECUTABLE )
-+# debug_var( PYTHON3LIBS_FOUND )
-+# debug_var( PYTHON3_INCLUDE_DIRS )
-+# debug_var( PYTHON3_LIBRARIES )
-+# debug_var( PYTHON3_SITE_PACKAGES )
-+
-+endmacro( ecbuild_find_python3 )
-Index: magics++-2.24.4/cmake/ecbuild_system.cmake
-===================================================================
---- magics++-2.24.4.orig/cmake/ecbuild_system.cmake
-+++ magics++-2.24.4/cmake/ecbuild_system.cmake
-@@ -242,6 +242,7 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_
- include( ecbuild_find_omp )
- include( ecbuild_find_perl )
- include( ecbuild_find_python )
-+ include( ecbuild_find_python3 )
- include( ecbuild_find_lexyacc )
- include( ecbuild_find_fortranlibs )
- include( ecbuild_enable_fortran )
-Index: magics++-2.24.4/python/Magics/CMakeLists.txt
+Index: magics++-2.28.0/python/Magics/CMakeLists.txt
===================================================================
---- magics++-2.24.4.orig/python/Magics/CMakeLists.txt
-+++ magics++-2.24.4/python/Magics/CMakeLists.txt
-@@ -2,7 +2,7 @@ if( ENABLE_PYTHON AND NUMPY_FOUND )
+--- magics++-2.28.0.orig/python/Magics/CMakeLists.txt
++++ magics++-2.28.0/python/Magics/CMakeLists.txt
+@@ -28,6 +28,10 @@ if( HAVE_PYTHON )
- ### python destination
+ swig_add_module( Magics python Magics_interface.cc ${CMAKE_CURRENT_BINARY_DIR}/Magics.i )
-- set( PYTHON_SITE "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages" )
-+ set( PYTHON3_DIST "lib/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/site-packages" )
- set( PYTHON_DEST "${PYTHON_SITE}/Magics" )
++ if (${PYTHON_VERSION_MAJOR} EQUAL 3)
++ set_source_files_properties( Magics.i PROPERTIES SWIG_FLAGS "-py3" )
++ endif()
++
+ set_source_files_properties(partio.i PROPERTIES SWIG_FLAGS "-includeall")
- file( RELATIVE_PATH relative_rpath "${CMAKE_INSTALL_PREFIX}/${PYTHON_DEST}" "${${PNAME}_FULL_INSTALL_LIB_DIR}" )
+ swig_link_libraries( Magics MagPlus ${PYTHON_LIBRARIES} )
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/magics.git
More information about the debian-science-commits
mailing list