[magics] 55/63: Update python3 patch. Closes: #847193
Alastair McKinstry
mckinstry at moszumanska.debian.org
Fri Mar 24 10:41:54 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 0de3ef5f43fb1ce305aa7a8da09091dac2d13c0a
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Wed Dec 7 15:13:18 2016 +0000
Update python3 patch. Closes: #847193
---
debian/changelog | 6 +
debian/patches/python3.patch | 356 +++++++++++++++++++++++++++++++++++++++++--
2 files changed, 350 insertions(+), 12 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 968edd5..1e7eec3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+magics++ (2.30.0-4) unstable; urgency=medium
+
+ * Update python3 patch. Closes: #847193
+
+ -- Alastair McKinstry <mckinstry at debian.org> Wed, 07 Dec 2016 15:13:17 +0000
+
magics++ (2.30.0-3) unstable; urgency=medium
* Ensure dep. on libopenjp2-7-dev present. Closes: #846920
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index 6d1ab39..95af15b 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -1,6 +1,6 @@
Author: Alastair McKinstry <mckinstry at debian.org>
Description: python2,3 compatability code
-Last-Updated: 2016-10-29
+Last-Updated: 2016-12-07
Forwarded: no
Index: magics++-2.30.0/tools/axis2doc.py
@@ -980,7 +980,12 @@ Index: magics++-2.30.0/python/Magics/macro.py
===================================================================
--- magics++-2.30.0.orig/python/Magics/macro.py
+++ magics++-2.30.0/python/Magics/macro.py
-@@ -6,6 +6,9 @@
+@@ -1,3 +1,4 @@
++
+ # (C) Copyright 1996-2016 ECMWF.
+ #
+ # This software is licensed under the terms of the Apache Licence Version 2.0
+@@ -6,10 +7,19 @@
# granted to it by virtue of its status as an intergovernmental organisation nor
# does it submit to any jurisdiction.
@@ -990,7 +995,23 @@ Index: magics++-2.30.0/python/Magics/macro.py
import os
import Magics
import numpy
-@@ -69,7 +72,7 @@ class Action(object):
+
++try:
++ type(unicode)
++except:
++ # python3
++ unicode = str
++
+ class Context(object):
+ def __init__(self):
+ self.tmp = []
+@@ -64,12 +74,12 @@ class Action(object):
+
+ def __repr__(self):
+ x = ""
+- for key in self.args.keys():
++ for key in list(self.args.keys()):
+ x = x + " %s = '%s'\n" % (key, self.args[key])
return x
def inspect(self):
@@ -999,7 +1020,16 @@ Index: magics++-2.30.0/python/Magics/macro.py
def quote(self, v):
return "\"" + v + "\""
-@@ -128,12 +131,12 @@ class Action(object):
+@@ -78,7 +88,7 @@ class Action(object):
+ sep=""
+ val="%s("%self.html
+
+- for key in self.args.keys():
++ for key in list(self.args.keys()):
+ if isinstance(self.args[key], str):
+ if key == 'odb_data':
+ Magics.setc('odb_filename', self.args[key])
+@@ -128,12 +138,12 @@ class Action(object):
dim = len(self.args[key].shape)
if isinstance(self.args[key][0], int):
if (dim == 2) :
@@ -1015,7 +1045,7 @@ Index: magics++-2.30.0/python/Magics/macro.py
else :
vval = ""
vsep = ""
-@@ -146,10 +149,10 @@ class Action(object):
+@@ -146,16 +156,16 @@ class Action(object):
vval += ""
val+= '%s%s = [%s]'%(sep, key, vval)
else :
@@ -1024,11 +1054,18 @@ Index: magics++-2.30.0/python/Magics/macro.py
sep=",\n\t"
- print >>file, val + ")\n"
-+ print (val + ")\n" (file=file)
++ print (val + ")\n",file=file)
def tomv4(self, file):
sep="\t"
-@@ -175,20 +178,20 @@ class Action(object):
+ val="%s,\n"%self.verb.upper()
+
+- for key in self.args.keys():
++ for key in list(self.args.keys()):
+ if isinstance(self.args[key], str):
+ if key == 'odb_data':
+ Magics.setc('odb_filename', self.args[key])
+@@ -175,20 +185,20 @@ class Action(object):
vval += "]"
val+= '%s%s = %s'%(sep, key.upper(), vval)
elif isinstance(self.args[key][0], int):
@@ -1054,7 +1091,7 @@ Index: magics++-2.30.0/python/Magics/macro.py
else :
vval = "["
vsep = ""
-@@ -199,10 +202,10 @@ class Action(object):
+@@ -199,10 +209,10 @@ class Action(object):
val+= '%s%s = %s'%(sep, key.upper(), vval)
else :
@@ -1067,16 +1104,115 @@ Index: magics++-2.30.0/python/Magics/macro.py
-@@ -210,7 +213,7 @@ class Action(object):
+@@ -210,9 +220,9 @@ class Action(object):
def tofortran(self, f):
if self.action == Magics.new_page :
- print >> f, '\tcall pnew("page")'
+- return
+- for key in self.args.keys():
+ print ('\tcall pnew("page")', file=f)
- return
- for key in self.args.keys():
++ return
++ for key in list(self.args.keys()):
if isinstance(self.args[key], str):
-@@ -385,7 +388,7 @@ mmapgen = make_action("mmapgen", Magics.
+ if key == 'odb_data':
+ Magics.setc('odb_filename', self.args[key])
+@@ -240,7 +250,7 @@ class Action(object):
+ val += "/)"
+ print >>f, '\tcall pset1c("%s", %s, %d)'%(key, val, len(self.args[key]))
+ elif isinstance(self.args[key][0], int):
+- print "pset1i"
++ print ("pset1i")
+ elif isinstance(self.args[key][0], float):
+ val = "(/"
+ sep = ""
+@@ -248,18 +258,18 @@ class Action(object):
+ val += sep + ("%0.2f" % v)
+ sep = ", "
+ val += "/)"
+- print >>f, '\tcall pset1r("%s", %s, %d)'%(key, val, len(self.args[key]))
++ print ('\tcall pset1r("%s", %s, %d)'%(key, val, len(self.args[key])), file=f)
+ elif isinstance(self.args[key], numpy.ndarray) :
+ type = self.args[key].dtype
+ dim = len(self.args[key].shape)
+ if isinstance(self.args[key][0], int):
+ if (dim == 2) :
+- print "pset2i"
++ print ("pset2i" )
+ else :
+- print "pset1i"
++ print ("pset1i" )
+ elif ( type == 'float64' or type == 'float32') :
+ if (dim == 2) :
+- print "pset2r"
++ print ("pset2r" )
+ else :
+ val = "(/"
+ sep = ""
+@@ -269,18 +279,18 @@ class Action(object):
+ val += "/)"
+ print >>f, '\tcall pset1r("%s", %s, %d)'%(key, val, len(self.args[key]))
+ elif isinstance(self.args[key][0], int):
+- print "pset1r"
++ print ("pset1r" )
+ else :
+- print "type???->", key
++ print ("type???->", key)
+
+ if self.action != None and actions[self.verb] != "" and actions[self.verb] != "pinput":
+ print >>f, "\tcall %s\n"%actions[self.verb]
+- for key in self.args.keys():
+- print >>f, "\tcall preset('%s')"%key
+- print >>f, ""
++ for key in list(self.args.keys()):
++ print ("\tcall preset('%s')"%key , file=f)
++ print ("", file=f)
+
+ else:
+- print >>f, ""
++ print ("", file=f)
+
+
+ def clean_object(self, obj):
+@@ -299,8 +309,8 @@ class Action(object):
+ for i,v in obj.iteritems():
+ obj[i] = self.clean_object(v)
+ else:
+- print "Invalid object in data, converting to string: "
+- print type(obj)
++ print ("Invalid object in data, converting to string: " )
++ print ( type(obj))
+ obj = str(obj)
+ return obj
+
+@@ -309,7 +319,7 @@ class Action(object):
+
+ if ( self.action != Magics.odb) :
+ self.args = self.clean_object(self.args)
+- for key in self.args.keys():
++ for key in list(self.args.keys()):
+ if isinstance(self.args[key], str):
+ if key == 'odb_data':
+ Magics.setc('odb_filename', self.args[key])
+@@ -340,7 +350,7 @@ class Action(object):
+ else :
+ Magics.set1r(key, self.args[key].copy())
+ else :
+- print "type???->", key
++ print ("type???->", key)
+
+ else:
+ self.args[key].execute(key)
+@@ -351,7 +361,7 @@ class Action(object):
+ Magics.setc("legend", "on")
+ self.action()
+ if self.action != Magics.obs and self.action != Magics.minput:
+- for key in self.args.keys():
++ for key in list(self.args.keys()):
+ Magics.reset(key)
+ else:
+ self.action("page")
+@@ -385,7 +395,7 @@ mmapgen = make_action("mmapgen", Magics.
pnetcdf = make_action("pnetcdf", Magics.netcdf)
mnetcdf = make_action("mnetcdf", Magics.netcdf)
odb_geopoints = make_action("odb_geopoints", Magics.odb, "Odbviewer")
@@ -1085,6 +1221,57 @@ Index: magics++-2.30.0/python/Magics/macro.py
odb_xypoints = make_action("odb_xypoints", Magics.odb, "Odbviewer")
odb_xyvectors = make_action("odb_xyvectors", Magics.odb, "Odbviewer")
pmap = make_action("pmap", None, "Subpage")
+@@ -458,20 +468,20 @@ def _plot(*args):
+
+ def tofortran(file, *args):
+ f = open(file+".f90",'w')
+- print >>f, "\tprogram magics\n"
+- print >>f, "\tcall popen\n"
++ print ("\tprogram magics\n", file=f)
++ print ("\tcall popen\n", file=f)
+ for n in args:
+ n.tofortran(f)
+- print >>f, "\tcall pclose\n"
+- print >>f, "\tend"
++ print ("\tcall pclose\n", file=f)
++ print ("\tend", file=f)
+
+
+ def tohtml(file, *args):
+ f = open(file+".html",'w')
+- print >>f, "<html>"
++ print ("<html>", file=f)
+ for n in args:
+ n.tohtml(f)
+- print >>f, "</html>"
++ print ("</html>", file=f)
+
+ def tomv4(file, *args):
+ f = open(file+".mv4",'w')
+@@ -490,19 +500,19 @@ 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
+- print cmd
++ print (cmd )
+ if (os.system(cmd)) :
+- print "Error in filtering ODB data... Aborting"
++ print ("Error in filtering ODB data... Aborting")
+ os.abort();
+ Magics.setc('odb_filename', odb)
+ def inspect(self):
+ cmd = "odbsql -q \"" + self.args["query"] + "\" -i " + self.args["path"] + " -o data.ascii"
+ if (os.system(cmd)) :
+- print "Error in filtering ODB data... Aborting"
++ print ("Error in filtering ODB data... Aborting")
+ os.abort();
+ cmd = os.environ['ODB_REPORTER'] + " %s" % "data.ascii"
+ if (os.system(cmd)) :
+- print "Error in viewing ODB data... Aborting"
++ print ("Error in viewing ODB data... Aborting")
+ os.abort();
+
+
Index: magics++-2.30.0/python/Magics/metgram.py
===================================================================
--- magics++-2.30.0.orig/python/Magics/metgram.py
@@ -1636,3 +1823,148 @@ Index: magics++-2.30.0/python/Magics.i.in
$1[i] = 0;
}
else
+Index: magics++-2.30.0/python/Magics/toolbox.py
+===================================================================
+--- magics++-2.30.0.orig/python/Magics/toolbox.py
++++ magics++-2.30.0/python/Magics/toolbox.py
+@@ -1,3 +1,4 @@
++from __future__ import print_function
+
+ import macro
+
+@@ -7,7 +8,7 @@ def substitute(default, user):
+ for key in user:
+ out[key] = user[key]
+
+- print out
++ print (out)
+
+ return out
+
+@@ -159,7 +160,7 @@ defaults = { "eps" :
+
+ def epsgram(parameter, input, **args):
+
+- print parameter, input, "ARGS--->", args
++ print (parameter, input, "ARGS--->", args)
+
+ actions = []
+
+@@ -185,10 +186,10 @@ def epsgram(parameter, input, **args):
+ actions.append(vertical)
+ actions.append(horizontal)
+
+- print "DATA", input
++ print ("DATA", input)
+
+ if "clim" in args :
+- print "FILE--->", data
++ print ("FILE--->", data)
+ clim = macro.mwrepjson(
+ wrepjson_family = "eps",
+ wrepjson_keyword = "clim",
+Index: magics++-2.30.0/utils/epsgrams.py
+===================================================================
+--- magics++-2.30.0.orig/utils/epsgrams.py
++++ magics++-2.30.0/utils/epsgrams.py
+@@ -6,6 +6,7 @@
+ # granted to it by virtue of its status as an intergovernmental organisation nor
+ # does it submit to any jurisdiction.
+
++from __future__ import print_function
+ import traceback
+ import sys
+
+@@ -146,7 +147,7 @@ def data(stations, param, path):
+
+ for i in out:
+ f = open("%s.data" % (param, ), 'w')
+- print >> f, json.dumps(i, indent=4, separators=(',', ': ') )
++ print (json.dumps(i, indent=4, separators=(',', ': ') ), file=f)
+
+
+
+@@ -406,7 +407,7 @@ def epsgrams(location):
+ def main():
+
+ if len(sys.argv) != 2 :
+- print "No station list given"
++ print ("No station list given")
+ return 1
+
+ try:
+@@ -420,11 +421,11 @@ def main():
+ return 0
+
+
+- except GribInternalError,err:
++ except GribInternalError as err:
+ if VERBOSE:
+ traceback.print_exc(file=sys.stderr)
+ else:
+- print >>sys.stderr,err.msg
++ print (err.msg, file=sys.stderr)
+
+ return 1
+
+Index: magics++-2.30.0/utils/plumes.py
+===================================================================
+--- magics++-2.30.0.orig/utils/plumes.py
++++ magics++-2.30.0/utils/plumes.py
+@@ -6,6 +6,7 @@
+ # granted to it by virtue of its status as an intergovernmental organisation nor
+ # does it submit to any jurisdiction.
+
++from __future__ import print_function
+ import traceback
+ import sys
+
+@@ -98,7 +99,7 @@ def ensemble(files, index, out):
+ f.close()
+
+ base = datetime.datetime.strptime(date+time, '%Y%m%d%H%M')
+- print base
++ print (base)
+
+ for l in range(len(index)):
+ mean = {}
+@@ -239,7 +240,7 @@ def data(stations, files):
+ previous(files, "d-2", index, out)
+ for i in out:
+ f = open(i["output"], 'w')
+- print >> f, json.dumps(i, indent=4, separators=(',', ': ') )
++ print (json.dumps(i, indent=4, separators=(',', ': ') ), file=f)
+
+
+
+@@ -657,7 +658,7 @@ def main():
+
+
+ if len(sys.argv) != 2 :
+- print "No station list given"
++ print ("No station list given")
+ return 1
+
+ try:
+@@ -665,18 +666,18 @@ def main():
+ params = ["t850", "precip", "z500"]
+
+ for param in params :
+- print "get", param
++ print ("get", param)
+ data(stations["stations"], configuration[param])
+ for station in stations["stations"]:
+ plumes(station)
+ return 0
+
+
+- except GribInternalError,err:
++ except GribInternalError as err:
+ if VERBOSE:
+ traceback.print_exc(file=sys.stderr)
+ else:
+- print >>sys.stderr,err.msg
++ print (err.msg, file=sys.stderr)
+
+ return 1
+
--
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