[Python-modules-commits] r29660 - in packages/oct2py/trunk/debian (6 files)

noahfx-guest at users.alioth.debian.org noahfx-guest at users.alioth.debian.org
Sun Jul 6 19:23:29 UTC 2014


    Date: Sunday, July 6, 2014 @ 19:23:28
  Author: noahfx-guest
Revision: 29660

ADDED: Latest upstream patches 

Added:
  packages/oct2py/trunk/debian/patches/
  packages/oct2py/trunk/debian/patches/01-helper-function-kill-zombie-octave-sessions.patch
  packages/oct2py/trunk/debian/patches/02-refactoring-allow-pty-to-be-turned-off.patch
  packages/oct2py/trunk/debian/patches/03-fix-syntax-error-test.patch
  packages/oct2py/trunk/debian/patches/04-kill-octave-cli.patch
  packages/oct2py/trunk/debian/patches/series

Added: packages/oct2py/trunk/debian/patches/01-helper-function-kill-zombie-octave-sessions.patch
===================================================================
--- packages/oct2py/trunk/debian/patches/01-helper-function-kill-zombie-octave-sessions.patch	                        (rev 0)
+++ packages/oct2py/trunk/debian/patches/01-helper-function-kill-zombie-octave-sessions.patch	2014-07-06 19:23:28 UTC (rev 29660)
@@ -0,0 +1,28 @@
+Description: Add helper function to kill zombie octave sessions.
+Origin: https://github.com/blink1073/oct2py/commit/fc2ff4f41c818438a144fdf2ef6049c5b911b8a8
+Last-Update: 2014-07-06
+
+--- a/oct2py/__init__.py
++++ b/oct2py/__init__.py
+@@ -44,6 +44,21 @@
+ except Oct2PyError as e:
+     print(e)
+ 
++
++def kill_octave():
++    """Kill all octave instances (cross-platform).
++
++    This will restart the "octave" instance.  If you have instantiated
++    Any other Oct2Py objects, you must restart them.
++    """
++    import os
++    if os.name == 'nt':
++        os.system('taskkill /im octave /f')
++    else:
++        os.system('killall -9 octave')
++    octave.restart()
++
++
+ # clean up namespace
+ del functools, imp, os
+ try:

Added: packages/oct2py/trunk/debian/patches/02-refactoring-allow-pty-to-be-turned-off.patch
===================================================================
--- packages/oct2py/trunk/debian/patches/02-refactoring-allow-pty-to-be-turned-off.patch	                        (rev 0)
+++ packages/oct2py/trunk/debian/patches/02-refactoring-allow-pty-to-be-turned-off.patch	2014-07-06 19:23:28 UTC (rev 29660)
@@ -0,0 +1,86 @@
+Subject: [PATCH] Refactoring and allow pty to be turned off.
+Origin: https://github.com/blink1073/oct2py/commit/6d7bf55dc3dd014c5258b19d8e7e7ca60e14f639
+Last-Update: 2014-07-06
+
+
+---
+ oct2py/session.py | 32 +++++++++++++++-----------------
+ 1 file changed, 15 insertions(+), 17 deletions(-)
+
+diff --git a/oct2py/session.py b/oct2py/session.py
+index e507005..fc74235 100644
+--- a/oct2py/session.py
++++ b/oct2py/session.py
+@@ -511,22 +511,20 @@ def read_incoming(self):
+         If there is a line with only a ">" char, put that on the queue
+         """
+         buf = ''
+-        debug = re.compile(r'\A[\w]+>>? ')
++        debug_prompt = re.compile(r'\A[\w]+>>? ')
+         while 1:
+             buf += os.read(self.fid, 100).decode('utf8')
+-            while '\n' in buf:
+-                i = buf.index('\n')
+-                try:
+-                    self.queue.put(buf[:i].replace('\r', ''))
+-                except:
+-                    return
+-                buf = buf[i+1:]
+-            if re.match(debug, buf):
+-                try:
+-                    self.queue.put(buf)
+-                except:
+-                    return
++            lines = buf.splitlines()
++            for line in lines[:-1]:
++                self.queue.put(line)
++            if buf.endswith('\n'):
++                self.queue.put(lines[-1])
+                 buf = ''
++            elif re.match(debug_prompt, lines[-1]):
++                self.queue.put(lines[-1])
++                buf = ''
++            else:
++                buf = lines[-1]
+ 
+ 
+ class _Session(object):
+@@ -537,7 +535,7 @@ class _Session(object):
+     def __init__(self):
+         self.timeout = int(1e6)
+         self.read_queue = queue.Queue()
+-        self.interaction_file = '__oct2py_interact_%s' % id(self)
++        self.use_pty = (not pty is None) and (not 'NO_PTY' in os.environ)
+         self.proc = self.start()
+         self.stdout = sys.stdout
+         self.set_timeout()
+@@ -569,7 +567,7 @@ def start_subprocess(self):
+         """Start octave using a subprocess (no tty support)"""
+         errmsg = ('\n\nPlease install GNU Octave and put it in your path\n')
+         ON_POSIX = 'posix' in sys.builtin_module_names
+-        if not pty is None:
++        if self.use_pty:
+             master, slave = pty.openpty()
+             self.wfid, self.rfid = master, master
+             rpipe, wpipe = slave, slave
+@@ -617,7 +615,7 @@ def evaluate(self, cmds, verbose=True, log=True, logger=None, timeout=-1):
+         resp = self.expect(['\x03', 'syntax error'])
+         if resp.endswith('syntax error'):
+             resp = self.expect('\^')
+-            if not pty is None:
++            if self.use_pty:
+                 self.expect('\^')
+                 self.expect('\^')
+                 self.expect('\^')
+@@ -650,7 +648,7 @@ def handle_syntax_error(self, resp, main_line):
+                'Octave returned Syntax Error:\n""""\n%s\n"""' % (main_line,
+                                                                  errline))
+         msg += '\nIf using an m-file script, make sure it runs in Octave'
+-        if pty is None:
++        if not self.use_pty:
+             msg += '\nSession Closed by Octave'
+             self.close()
+             raise Oct2PyError(msg)
+-- 
+1.9.3
+

Added: packages/oct2py/trunk/debian/patches/03-fix-syntax-error-test.patch
===================================================================
--- packages/oct2py/trunk/debian/patches/03-fix-syntax-error-test.patch	                        (rev 0)
+++ packages/oct2py/trunk/debian/patches/03-fix-syntax-error-test.patch	2014-07-06 19:23:28 UTC (rev 29660)
@@ -0,0 +1,21 @@
+Subject: [PATCH] Increase wait time on travis, fix syntax error test
+Origin: https://github.com/blink1073/oct2py/commit/ff07cab56647705462bf87de70ea5b85bd25e11f
+Last-Update: 2014-07-06
+
+
+diff --git a/oct2py/tests/test_oct2py.py b/oct2py/tests/test_oct2py.py
+index 3d9d8d6..a94ea8a 100644
+--- a/oct2py/tests/test_oct2py.py
++++ b/oct2py/tests/test_oct2py.py
+@@ -674,7 +674,7 @@ def test_syntax_error(self):
+         oc = Oct2Py()
+         self.assertRaises(Oct2PyError, oc._eval, "a=1++3")
+ 
+-        if os.name == 'nt':
++        if not oc._session.use_pty:
+             self.assertRaises(Oct2PyError, oc._eval, "a=1")
+         else:
+             oc.put('a', 1)
+-- 
+1.9.3
+

Added: packages/oct2py/trunk/debian/patches/04-kill-octave-cli.patch
===================================================================
--- packages/oct2py/trunk/debian/patches/04-kill-octave-cli.patch	                        (rev 0)
+++ packages/oct2py/trunk/debian/patches/04-kill-octave-cli.patch	2014-07-06 19:23:28 UTC (rev 29660)
@@ -0,0 +1,23 @@
+Subject: [PATCH] Kill octave-cli as well
+Origin: https://github.com/blink1073/oct2py/commit/c1d973985eb063cb1d85e2d517b787821b40dd20
+Last-Update: 2014-07-06
+
+---
+ oct2py/__init__.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/oct2py/__init__.py b/oct2py/__init__.py
+index f4e8d09..b9c3058 100644
+--- a/oct2py/__init__.py
++++ b/oct2py/__init__.py
+@@ -56,6 +56,7 @@ def kill_octave():
+         os.system('taskkill /im octave /f')
+     else:
+         os.system('killall -9 octave')
++        os.system('killall -9 octave-cli')
+     octave.restart()
+ 
+ 
+-- 
+1.9.3
+

Added: packages/oct2py/trunk/debian/patches/series
===================================================================
--- packages/oct2py/trunk/debian/patches/series	                        (rev 0)
+++ packages/oct2py/trunk/debian/patches/series	2014-07-06 19:23:28 UTC (rev 29660)
@@ -0,0 +1,4 @@
+01-helper-function-kill-zombie-octave-sessions.patch
+02-refactoring-allow-pty-to-be-turned-off.patch
+03-fix-syntax-error-test.patch
+04-kill-octave-cli.patch
\ No newline at end of file




More information about the Python-modules-commits mailing list