[eccodes] 102/106: undo python3 patch damage

Alastair McKinstry mckinstry at moszumanska.debian.org
Fri Jul 28 09:05:49 UTC 2017


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

mckinstry pushed a commit to branch debian/master
in repository eccodes.

commit 18a8370b117681f05f8f8e98209d0634437cb696
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Fri Jul 21 14:21:48 2017 +0100

    undo python3 patch damage
---
 debian/patches/python3.patch | 717 +++++++++++++++++++++++++------------------
 1 file changed, 417 insertions(+), 300 deletions(-)

diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index 2682e03..dc03c23 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -1,316 +1,433 @@
-Index: ecflow-4.6.1/Pyext/script.py
+Author: Alastair McKinstry <mckinstry at debian.org>
+Description: Support for Python3
+Forwarded: no
+Last-Updated: 2016-12-05
+
+Index: eccodes-2.3.0/python/test_iterator.py
 ===================================================================
---- ecflow-4.6.1.orig/Pyext/script.py
-+++ ecflow-4.6.1/Pyext/script.py
-@@ -7,5 +7,7 @@
+--- eccodes-2.3.0.orig/python/test_iterator.py
++++ eccodes-2.3.0/python/test_iterator.py
+@@ -1,7 +1,8 @@
+ #!/usr/bin/env python
  
- #
- #
--print 'Hello World !'
 +from __future__ import print_function
+ import sys
+-from gribapi import *
++from .gribapi import *
+ import profile
+ 
+ def main():
+@@ -26,12 +27,12 @@ def main():
+             sys.stdout.write("- %d - lat=%.6f lon=%.6f value=" % (i,lat,lon))
+ 
+             if value == missingValue:
+-                print "missing"
++                print("missing")
+             else:
+-                print "%.6f" % value
++                print("%.6f" % value)
+ 
+             i += 1
+-            
 +
-+print ('Hello World !')
- number = 42
-Index: ecflow-4.6.1/tools/ecflow_fuse.py
+         grib_iterator_delete(iterid)
+         grib_release(gid)
+ 
+Index: eccodes-2.3.0/python/test_index.py
 ===================================================================
---- ecflow-4.6.1.orig/tools/ecflow_fuse.py
-+++ ecflow-4.6.1/tools/ecflow_fuse.py
-@@ -1,4 +1,5 @@
+--- eccodes-2.3.0.orig/python/test_index.py
++++ eccodes-2.3.0/python/test_index.py
+@@ -1,7 +1,8 @@
  #!/usr/bin/env python
+ 
 +from __future__ import print_function
- import os
  import sys
- import time
-@@ -63,7 +64,7 @@ cmds = { # "log": "--log=get",
- 
- ECF_EXTN = "sms"
- ECF_EXTN = "ecf"
--exts = { key: None for key in cmds.keys() }
-+exts = { key: None for key in list(cmds.keys()) }
- task_exts = {
-     ECF_EXTN: "script", "man": "manual", "out": "jobout", "job": "job",  
-     # "nop": None,         
-@@ -90,7 +91,7 @@ def list_dir(node):
-     item = node
-     res = []
-     if isinstance(item, ecflow.Task):
--        res.extend([ ".%s" % key for key in task_exts.keys() ])
-+        res.extend([ ".%s" % key for key in list(task_exts.keys()) ])
-     else: res = [ ".att", ]
- 
-     name = item.name()
-@@ -111,7 +112,7 @@ def list_dir(node):
-         # res.extend([ name + state[:4] + sus])
-         
-         # if isinstance(item, ecflow.Task):
--        #     res.extend([ name + ".%s" % key for key in task_exts.keys() ])
-+        #     res.extend([ name + ".%s" % key for key in list(task_exts.keys()) ])
-         # else: res.extend([ name, name + ".att"])
- 
-     return res
-@@ -129,7 +130,7 @@ def list_att(node):
-                   ecflow.Alias: "alias", }
- 
-         try: attr['kind'] = kinds[type(node)]
--        except: print "what?", type(node); attr['kind'] = "unknown"
-+        except: print ("what?", type(node)); attr['kind'] = "unknown"
- 
-         if isinstance(node, ecflow.Defs):
-             attr['gvar'] = []
-@@ -212,21 +213,21 @@ def list_att(node):
-         return pp.pformat(attr) + "\n"
- 
- def set_att(fpath, dct, att=('st_size', ), dft=FILESIZE, ext="job"):
--    print "set_att", fpath
-+    print ("set_att", fpath)
-     # if ext == "out": fpath = fpath.replace(".job", ".")
-     if os.path.exists(fpath):
--        print "'FOUND", fpath, "\n", os.lstat(fpath)
-+        print ("'FOUND", fpath, "\n", os.lstat(fpath))
-         for key in att: 
-             if "uid" in att or "gid" in att: continue
-             dct[key] = getattr(os.lstat(fpath), key)
--            print fpath, key, dct[key]
-+            print (fpath, key, dct[key])
-     else: dct['st_size'] = FILESIZE
- 
- def remote_file(node, fname, gvar, res):
--    print "####### REMOTE"
-+    print ("####### REMOTE")
-     # gvar = ecflow.VariableList()
-     for item in gvar:
--        print item
-+        print (item)
-         if item.name() == "ECF_JOBOUT":
-             fname = item.value()
-             break
-@@ -245,9 +246,9 @@ def remote_file(node, fname, gvar, res):
-     cmd = "ls %s.running && tail -20 %s.running || " % (
-         fname, fname) + "tail -20 %s" % fname
-     stdin, stdout, stderr = ssh.exec_command(cmd)
--    print "#MSG: live output: ", HOST, cmd
-+    print ("#MSG: live output: ", HOST, cmd)
-     for line in stdout:
--        print line,
-+        print (line,)
-         res += "%s" % line
-     return res
- 
-@@ -261,15 +262,15 @@ def addit(array, cont, name):
-             elif name in ("limit",): 
-                 if item.value() > 0:
-                     load += " # value:%s" % item.value()
--                    print item.node_paths
-+                    print (item.node_paths)
-                     for idx, val in enumerate(item.node_paths):
--                        print idx, val
-+                        print (idx, val)
-                         load += " %s " % val # ???
-             rc.append(load)
-         if len(rc) > 0: cont[name] = rc
- 
- def trunc(res, size, offset):
--    print "offset", offset, size
-+    print ("offset", offset, size)
-     if len(res) > size: 
-         return "#TRUNCATED\n" + res[offset:offset+size-30] + "\n"
-     return res + "\n"
-@@ -287,10 +288,10 @@ class FuseEcflow(LoggingMixIn, Operation
-         self.update = int(time.strftime("%H%M"))
-         self.defs = self.client.get_defs()
-         self.root = path
--        print "#MSG: connected to %s " % host + port
-+        print ("#MSG: connected to %s " % host + port)
-         if 0: 
--            for s in self.defs.suites: print s.name(),
--            print
-+            for s in self.defs.suites: print (s.name(),)
-+            print ()
- 
-     def chmod(self, path, mode):
-         raise FuseOSError(ENOENT)
-@@ -305,8 +306,8 @@ class FuseEcflow(LoggingMixIn, Operation
- 
-     def server_cmd(self, ext, run=1):
-         if not ext: return ""
--        if not ext in cmds.keys():
--            print "server cmd: what?", ext
-+        if not ext in list(cmds.keys()):
-+            print ("server cmd: what?", ext)
-             return ""
-         cmd = ECFLOW_CLIENT + " --port %s --host %s " % (self.port, self.host
-           ) + cmds[ext]
-@@ -315,7 +316,7 @@ class FuseEcflow(LoggingMixIn, Operation
-             cmd += "=%s.%s.png; " % (self.host, self.port)
- 
-         import commands
--        print cmd
-+        print (cmd)
-         (rc, res) = commands.getstatusoutput( cmd )
- 
-         if ext == "png": 
-@@ -325,10 +326,10 @@ class FuseEcflow(LoggingMixIn, Operation
- 
-     def getattr(self, path, fh=None):
-         uid, gid, pid = fuse_get_context()
--        print "getattr", path, fh
-+        print ("getattr", path, fh)
- 
-         cur = os.lstat(".")
--        # print "cur", cur
-+        # print ("cur", cur)
-         st = dict((key, getattr(cur, key)) for key in (
-             'st_size', 'st_gid', 'st_uid',
-             'st_mode', 'st_mtime', 'st_atime', 'st_ctime',        ))
-@@ -345,18 +346,18 @@ class FuseEcflow(LoggingMixIn, Operation
-             st['st_mtime'] = 0      # (time of most recent content modification)
-             st['st_ctime'] = 0      # (time of most recent metadata change)
- 
--            st['st_mode'] = (S_IFDIR | 0755)
-+            st['st_mode'] = (S_IFDIR | 0o755)
-             st['st_nlink']=2
-             return st
- 
-         if '.' in path: 
--            st['st_mode'] = (S_IFREG | 0444)
-+            st['st_mode'] = (S_IFREG | 0o444)
-             ext = ""
-             try:
-                 path, ext = path.split(".")
-                 if "@" in path: node = self.client.get_defs()
-                 else: node = self.client.get_defs().find_abs_node(str(path))
--            except Exception as e: print e; node = None; return st
-+            except Exception as e: print (e); node = None; return st
- 
-             if ext == "att":        
-                 st['st_size'] = len(list_att(node))
-@@ -380,7 +381,7 @@ class FuseEcflow(LoggingMixIn, Operation
-                                 ext=ext)
- 
-         elif 1:
--            st['st_mode'] = (S_IFDIR | 0444)
-+            st['st_mode'] = (S_IFDIR | 0o444)
-             st['st_size'] = 1
- 
+-from gribapi import *
++from .gribapi import *
+ from array import array
+ import random
+ import traceback
+@@ -17,7 +18,7 @@ class Usage(Exception):
+ def product(*args, **kwds):
+     # product('ABCD', 'xy') --> Ax Ay Bx By Cx Cy Dx Dy
+     # product(range(2), repeat=3) --> 000 001 010 011 100 101 110 111
+-    pools = map(tuple, args) * kwds.get('repeat', 1)
++    pools = list(map(tuple, args)) * kwds.get('repeat', 1)
+     result = [[]]
+     for pool in pools:
+         result = [x+[y] for x in result for y in pool]
+@@ -34,20 +35,20 @@ def test():
+     infile = sys.argv[1]
+     index_keys = ["shortName","level","number","step"]
+ 
+-    print "indexing..."
++    print ("indexing...")
+     iid = grib_index_new_from_file(infile,index_keys)
+-    print "end indexing..."
++    print ("end indexing...")
+ 
+     index_vals = []
+ 
+     for key in index_keys:
+-        print "%sSize=%d" % (
++        print ("%sSize=%d" % (
+             key,
+             grib_index_get_size(iid,key)
+-        )
++        ))
+ 
+         key_vals = grib_index_get_string(iid,key)
+-        print " ".join(key_vals)
++        print (" ".join(key_vals))
+ 
+         index_vals.append(key_vals)
+ 
+@@ -58,7 +59,7 @@ def test():
+         while 1:
+             gid = grib_new_from_index(iid)
+             if gid is None: break
+-            print " ".join(["%s=%s" % (key,grib_get_string(gid,key)) for key in index_keys])
++            print (" ".join(["%s=%s" % (key,grib_get_string(gid,key)) for key in index_keys]))
+             grib_release(gid)
+ 
+     grib_index_release(iid)
+@@ -67,17 +68,17 @@ def test():
+ def main():
+     try:
+         test()
+-    except GribInternalError,err:
++    except GribInternalError as err:
+         if VERBOSE:
+             traceback.print_exc(file=sys.stderr)
          else:
-@@ -404,7 +405,7 @@ class FuseEcflow(LoggingMixIn, Operation
- 
-         self.refresh()
- 
--        print "read", path, size, offset, fh, ext
-+        print ("read", path, size, offset, fh, ext)
-         if "@" in path and ext != "att":
-             res = self.server_cmd(ext)
-             return trunc(res, size, offset)
-@@ -416,8 +417,8 @@ class FuseEcflow(LoggingMixIn, Operation
-             return "node %s state is %s%s\n" % (node.get_abs_node_path(), 
-                                                 node.get_state(), suspended)
-         elif ext in ignore: return "-ignored-"
--        elif ext and not ext in exts.keys(): 
--            print "what?", ext; return "-empty-"
-+        elif ext and not ext in list(exts.keys()): 
-+            print ("what?", ext); return "-empty-"
- 
-         elif ext in ("job", "out"):
-             node = self.client.get_defs().find_abs_node(str(path))
-@@ -441,7 +442,7 @@ class FuseEcflow(LoggingMixIn, Operation
-                     if jobtime > outtime:
-                         res += "output older than jobfile, %s\n" % item.value()
-                         try: res += remote_file(node, fname, gvar, res)
--                        except Exception as e: print e
-+                        except Exception as e: print (e)
-                         return trunc(res, size, offset)
- 
-                 f = open(fname)
-@@ -451,25 +452,25 @@ class FuseEcflow(LoggingMixIn, Operation
-                 return buf
-             else: 
-                 try: res += remote_file(node, fname, gvar, res)
--                except Exception as e: print e
-+                except Exception as e: print (e)
-                 return trunc(res, size, offset)
-                 
-             try: res = "%s" % self.client.get_file(str(path), exts[ext])
--            except  Exception as e: print e; res = "%s" % e 
-+            except  Exception as e: print (e); res = "%s" % e 
-             return trunc(res, size, offset)
- 
-         elif ext in ("why", ):
--            print "##############", ext
-+            print ("##############", ext)
-             cmd = ECFLOW_CLIENT + " --port %s --host %s " % (self.port, self.host
-             ) + cmds[ext] % path
- 
-             import commands
--            print cmd
-+            print (cmd)
-             (rc, res) = commands.getstatusoutput( cmd )
-             return trunc(res, size, offset)
- 
-         elif ext in (ECF_EXTN, "man"):
--            print "##############", ext
-+            print ("##############", ext)
-             res = "%s" % self.client.get_file(str(path), exts[ext])
-             return trunc(res, size, offset)
- 
-@@ -503,11 +504,11 @@ class FuseEcflow(LoggingMixIn, Operation
-         ext = None
-         if "." in path: 
-             path, ext = path.split(".")
--        if ext and not ext in exts.keys(): 
--            print "readdir: what?", ext; 
-+        if ext and not ext in list(exts.keys()): 
-+            print ("readdir: what?", ext )
-             return [ "/" ]
- 
--        print "readdir", path, fh, path, ext
-+        print ("readdir", path, fh, path, ext)
- 
-         self.refresh()
- 
-@@ -522,7 +523,7 @@ class FuseEcflow(LoggingMixIn, Operation
-             node = self.client.get_defs()
-             nick = '%s@%s' % (self.host, self.port)
-             res = ['.', '..', nick + "." + 'att' ]
--            res += [ nick + ".%s" % key for key in cmds.keys() 
-+            res += [ nick + ".%s" % key for key in list(cmds.keys()) 
-                      if key != "why" ]
-             res += [ nick + '.%s' % ( node.get_server_state()) ]
-             for s in node.suites:
-@@ -533,7 +534,7 @@ class FuseEcflow(LoggingMixIn, Operation
-             return res
- 
-         elif node is None: 
--            print "#ERR: not found", path 
-+            print ("#ERR: not found", path )
-             return [ "..", "." ]
-             # raise BaseException()
-             # return ["-empty-%s" % path.replace("/", "_") ]
-Index: ecflow-4.6.1/Pyext/unicode.py
+-            print >>sys.stderr,err.msg
++            print (err.msg, file=sys.stderr)
+ 
+         return 1
+     except Usage:
+-        print "Usage: %s infile" % sys.argv[0]
++        print ("Usage: %s infile" % sys.argv[0])
+         sys.exit(2)
+ 
+ if __name__ == "__main__":
+     main()
+-    #print "------------------------------------"
++    #print ("------------------------------------")
+Index: eccodes-2.3.0/python/test_keysiterator.py
 ===================================================================
---- ecflow-4.6.1.orig/Pyext/unicode.py
-+++ ecflow-4.6.1/Pyext/unicode.py
-@@ -1,7 +1,7 @@
- # Determine the python unicode
+--- eccodes-2.3.0.orig/python/test_keysiterator.py
++++ eccodes-2.3.0/python/test_keysiterator.py
+@@ -1,7 +1,8 @@
+ #!/usr/bin/env python
+ 
++from __future__ import print_function
+ import sys
+-from gribapi import *
++from .gribapi import *
+ 
+ infile = sys.argv[1]
+ fid = open(infile,"r")
+@@ -22,11 +23,9 @@ for i in range(count):
+         keyname = grib_keys_iterator_get_name(iterid)
+         keyval = grib_get_string(iterid,keyname)
+         keytype = grib_get_native_type(gid,keyname)
+-        print "%s = %s (%s)" % (keyname,keyval,str(keytype))
++        print ("%s = %s (%s)" % (keyname,keyval,str(keytype)))
+ 
+     grib_keys_iterator_delete(iterid)
+     grib_release(gid)
+ 
+ fid.close()
+-
 -
+Index: eccodes-2.3.0/python/test_general.py
+===================================================================
+--- eccodes-2.3.0.orig/python/test_general.py
++++ eccodes-2.3.0/python/test_general.py
+@@ -1,7 +1,8 @@
+ #!/usr/bin/env python
+ 
++from __future__ import print_function
+ import sys
+-from gribapi import *
++from .gribapi import *
+ import random
+ import traceback
+ 
+@@ -44,25 +45,25 @@ def test():
+     #grib_write_file(binstr_fid,x)
+     #grib_close_file(binstr_fid)
+ 
+-    print "Operating on file '%s'" % infile
++    print ("Operating on file '%s'" % infile)
+ 
+     n = grib_count_in_file(fid)
+-    print "Message count ",n
++    print ("Message count ",n)
+ 
+     # multi support test
+     grib_multi_support_on()
+     ismulti = "no" if (n == grib_count_in_file(fid)) else "yes"
+-    print "Is multi field - %s" % ismulti
++    print ("Is multi field - %s" % ismulti)
+     grib_multi_support_off()
+     # end multi support test
+ 
+     # gribex support test on/off
+-    print "Gribex support on/off"
++    print ("Gribex support on/off")
+     grib_gribex_mode_on()
+     grib_gribex_mode_off
+     # end gribex support test
+ 
+-    print "Browsing through messages "
++    print ("Browsing through messages ")
+     for i in range(n):
+         gid = grib_new_from_file(fid)
+ 
+@@ -70,71 +71,71 @@ def test():
+         #grib_print(gid,"centre")
+ 
+         if i == 0:
+-            print "Message size: ",grib_get_message_size(gid)
++            print ("Message size: ",grib_get_message_size(gid))
+             nval = grib_get_size(gid,"values")
+-            print "Number of values in message %d is %d" % (i,nval)
++            print ("Number of values in message %d is %d" % (i,nval))
+ 
+-            print "== %s %s %s %d ==" % \
++            print ("== %s %s %s %d ==" % \
+                 ( \
+                 grib_get_string(gid,"shortName"), \
+                 grib_get_string(gid,"name"), \
+                 grib_get_string(gid,"typeOfLevel"), \
+                 grib_get_long(gid,"level"), \
+-                )
++                ))
+ 
+-            print "Nearest point to 10,10: "
+-            print grib_find_nearest(gid,10,10)
++            print ("Nearest point to 10,10: ")
++            print (grib_find_nearest(gid,10,10))
+ 
+-            print grib_find_nearest(gid,10,10,npoints=4)
++            print (grib_find_nearest(gid,10,10,npoints=4))
+ 
+             rand_list = []
+             for i in range(0,5):
+                 rand_index = random.randint(1,nval)
+                 rand_list.append(rand_index)
+                 myval = grib_get_double_element(gid,"values",rand_index)
+-                print "Random index value[%d] = %.8f" % (rand_index,myval)
++                print ("Random index value[%d] = %.8f" % (rand_index,myval))
+ 
+             all4rand = grib_get_double_elements(gid,"values",rand_list)
+-            print "All at once index values: ",all4rand
++            print ("All at once index values: ",all4rand)
+ 
+             centre = grib_get_string(gid,"centre")
+             grib_set_string(gid,"centre","ecmf")
+             new_centre = grib_get_string(gid,"centre")
+-            print "Before/after string centre: %s/%s" % (centre,new_centre)
++            print ("Before/after string centre: %s/%s" % (centre,new_centre))
+ 
+             centre = grib_get_long(gid,"centre")
+             grib_set_long(gid,"centre",99)
+             new_centre = grib_get_long(gid,"centre")
+-            print "Before/after numeric centre: %d/%d" % (centre,new_centre)
++            print ("Before/after numeric centre: %d/%d" % (centre,new_centre))
+ 
+             centre = grib_get_double(gid,"centre")
+             grib_set_double(gid,"centre",9)
+             new_centre = grib_get_double(gid,"centre")
+-            print "Before/after numeric floating point centre: %f/%f" % (centre,new_centre)
++            print ("Before/after numeric floating point centre: %f/%f" % (centre,new_centre))
+ 
+             vals = grib_get_double_array(gid,"values")
+-            print "Values before: ",vals[:10]
++            print ("Values before: ",vals[:10])
+             grib_set_double_array(gid,"values",(1.0, 2.0, 3.14))
+             vals = grib_get_double_array(gid,"values")
+-            print "Values after: ",vals[:10]
++            print ("Values after: ",vals[:10])
+ 
+-            print "Saving modified message to %s" % outfile
++            print ("Saving modified message to %s" % outfile)
+             if WRITE: grib_write(gid,out)
+ 
+-            print "Creating and saving a clone to %s" % clonefile
++            print ("Creating and saving a clone to %s" % clonefile)
+             clone_gid = grib_clone(gid)
+             if WRITE: grib_write(clone_gid,clone_fid)
+             grib_release(clone_gid)
+ 
+             Ni = grib_get(gid,"Ni")
+-            print "Setting Ni to missing from --> ",Ni
++            print ("Setting Ni to missing from --> ",Ni)
+             grib_set_missing(gid,"Ni")
+             assert grib_is_missing(gid,"Ni")
+             miss_Ni = grib_get(gid,"Ni")
+-            print "Ni is now --> ",miss_Ni
++            print ("Ni is now --> ",miss_Ni)
+             grib_set(gid,"Ni",Ni)
+             new_Ni = grib_get(gid,"Ni")
+-            print "Set Ni back to its original value --> ",new_Ni
++            print ("Set Ni back to its original value --> ",new_Ni)
+             assert Ni == new_Ni
+ 
+             #grib_multi_write(gid,multi)
+@@ -145,23 +146,23 @@ def test():
+     fid.close()
+     out.close()
+     clone_fid.close()
+-    print "Closed file"
++    print ("Closed file")
+ 
+ 
+ def main():
+     try:
+         test()
+-    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
+     except Usage:
+-        print "Usage: %s infile" % sys.argv[0]
++        print ("Usage: %s infile" % sys.argv[0])
+         sys.exit(2)
+ 
+ if __name__ == "__main__":
+     main()
+-    print "------------------------------------"
++    print ("------------------------------------")
+Index: eccodes-2.3.0/python/test_extra.py
+===================================================================
+--- eccodes-2.3.0.orig/python/test_extra.py
++++ eccodes-2.3.0/python/test_extra.py
+@@ -1,6 +1,7 @@
+ #!/usr/bin/env python
+ 
+-from gribapi import *
++from __future__ import print_function
++from .gribapi import *
+ import sys
+ 
+ input=sys.argv[1]
+@@ -12,31 +13,31 @@ while 1:
+     gid = grib_new_from_file(fid)
+     if gid is None: break
+ 
+-    print grib_get(gid,"centre")
+-    print grib_get(gid,"centre",int)
+-    print grib_get(gid,"centre",float)
+-    print grib_get(gid,"centre",str)
++    print (grib_get(gid,"centre"))
++    print (grib_get(gid,"centre",int))
++    print (grib_get(gid,"centre",float))
++    print (grib_get(gid,"centre",str))
+ 
+-    print "Nvalues = ",grib_get_size(gid,"values")
++    print ("Nvalues = ",grib_get_size(gid,"values"))
+ 
+     values = grib_get_array(gid,"values")
+-    print values[:10]
++    print (values[:10])
+     values = values * 2
+ 
+     grib_set_double_array(gid,"values",values)
+ 
+     values = grib_get_array(gid,"values")
+-    print values[:10]
++    print (values[:10])
+     values = values / 2
+ 
+     grib_set_double_array(gid,"values",[1])
+ 
+     values = grib_get_values(gid)
+-    print values[:10]
++    print (values[:10])
+ 
+-    print grib_get(gid,"bitsPerValue")
++    print (grib_get(gid,"bitsPerValue"))
+     grib_set(gid,"bitsPerValue",10)
+-    print grib_get(gid,"bitsPerValue")
++    print (grib_get(gid,"bitsPerValue"))
+ 
+     grib_write(gid,oid)
+ 
+Index: eccodes-2.3.0/examples/python/keys_iterator_gts.py
+===================================================================
+--- eccodes-2.3.0.orig/examples/python/keys_iterator_gts.py
++++ eccodes-2.3.0/examples/python/keys_iterator_gts.py
+@@ -9,6 +9,7 @@
+ # nor does it submit to any jurisdiction.
+ #
+ 
 +from __future__ import print_function
+ import traceback
  import sys
- if sys.maxunicode > 65535:
--    print 'UCS4 build'
-+    print ('UCS4 build')
- else:
--    print 'UCS2 build'
-\ No newline at end of file
-+    print ('UCS2 build')
-Index: ecflow-4.6.1/Pyext/migrate/ecflow_migrate.py
+ 
+@@ -36,7 +37,7 @@ def example():
+         while codes_keys_iterator_next(iterid):
+             keyname = codes_keys_iterator_get_name(iterid)
+             keyval = codes_get_string(iterid, keyname)
+-            print "%s = %s" % (keyname, keyval)
++            print ("%s = %s" % (keyname, keyval))
+ 
+         codes_keys_iterator_delete(iterid)
+         codes_release(bid)
+@@ -51,7 +52,8 @@ def main():
+         if VERBOSE:
+             traceback.print_exc(file=sys.stderr)
+         else:
+-            print >> sys.stderr, err.msg
++            print(err.msg, file=sys.stderr)
++
+ 
+         return 1
+ 
+Index: eccodes-2.3.0/examples/python/binary_message.py
 ===================================================================
---- ecflow-4.6.1.orig/Pyext/migrate/ecflow_migrate.py
-+++ ecflow-4.6.1/Pyext/migrate/ecflow_migrate.py
-@@ -16,6 +16,7 @@
- # Handle bugs, produced by old versions of ecflow_client --migrate
- #   - Mostly to do with handling newlines
+--- eccodes-2.3.0.orig/examples/python/binary_message.py
++++ eccodes-2.3.0/examples/python/binary_message.py
+@@ -9,6 +9,7 @@
+ # nor does it submit to any jurisdiction.
  #
+ 
 +from __future__ import print_function
- import os          # for getenv
- import shutil      # used to remove directory tree
- #import argparse   # requires python 2.7
+ import traceback
+ import sys
+ 
+Index: eccodes-2.3.0/python/gribapi/gribapi.py
+===================================================================
+--- eccodes-2.3.0.orig/python/gribapi/gribapi.py
++++ eccodes-2.3.0/python/gribapi/gribapi.py
+@@ -23,7 +23,7 @@ When this is enabed, then the system Pyt
+ 
+ """
+ import gribapi_swig as _internal
+-# from gribapi import gribapi_swig as _internal
++from gribapi import gribapi_swig as _internal
+ import types
+ import sys
+ import os
+@@ -32,6 +32,14 @@ from functools import wraps
+ from . import errors
+ from errors import *  # noqa
+ 
++try:
++    type(file)
++except NameError:
++    # python3
++    import io
++    file=io.IOBase
++    long=int
++
+ KEYTYPES = {
+     1: int,
+     2: float,

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



More information about the debian-science-commits mailing list