[ecflow] 27/50: Add some python3 adaption code

Alastair McKinstry mckinstry at moszumanska.debian.org
Wed Sep 20 15:30:53 UTC 2017


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

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

commit 0cf5b5d7554b6ddf0e9ed32a6ec3d2974785eb92
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Wed Jul 12 10:13:02 2017 +0100

    Add some python3 adaption code
---
 debian/patches/python3.patch | 240 +++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series        |   1 +
 2 files changed, 241 insertions(+)

diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
new file mode 100644
index 0000000..e61a976
--- /dev/null
+++ b/debian/patches/python3.patch
@@ -0,0 +1,240 @@
+Index: ecflow-4.6.1/Pyext/script.py
+===================================================================
+--- ecflow-4.6.1.orig/Pyext/script.py
++++ ecflow-4.6.1/Pyext/script.py
+@@ -7,5 +7,7 @@
+ 
+ #
+ #
+-print 'Hello World !'
++from __future__ import print_function
++
++print ('Hello World !')
+ number = 42
+Index: ecflow-4.6.1/tools/ecflow_fuse.py
+===================================================================
+--- ecflow-4.6.1.orig/tools/ecflow_fuse.py
++++ ecflow-4.6.1/tools/ecflow_fuse.py
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import print_function
+ import os
+ import sys
+ import time
+@@ -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)
+@@ -306,7 +307,7 @@ 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
++            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',        ))
+@@ -356,7 +357,7 @@ class FuseEcflow(LoggingMixIn, Operation
+                 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))
+@@ -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)
+@@ -417,7 +418,7 @@ class FuseEcflow(LoggingMixIn, Operation
+                                                 node.get_state(), suspended)
+         elif ext in ignore: return "-ignored-"
+         elif ext and not ext in exts.keys(): 
+-            print "what?", ext; return "-empty-"
++            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)
+ 
+@@ -504,10 +505,10 @@ class FuseEcflow(LoggingMixIn, Operation
+         if "." in path: 
+             path, ext = path.split(".")
+         if ext and not ext in exts.keys(): 
+-            print "readdir: what?", ext; 
++            print ("readdir: what?", ext; )
+             return [ "/" ]
+ 
+-        print "readdir", path, fh, path, ext
++        print ("readdir", path, fh, path, ext)
+ 
+         self.refresh()
+ 
+@@ -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
+===================================================================
+--- ecflow-4.6.1.orig/Pyext/unicode.py
++++ ecflow-4.6.1/Pyext/unicode.py
+@@ -1,7 +1,7 @@
+ # Determine the python unicode
+-
++from __future__ import print_function
+ 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')
diff --git a/debian/patches/series b/debian/patches/series
index a716dd4..0150a55 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 format-security.patch
 auto_ptr.patch
+python3.patch

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



More information about the debian-science-commits mailing list