From 0cc31d6a5dc0c101081655b8ab78bfb98c2c7118 Mon Sep 17 00:00:00 2001 From: Helmut Pozimski Date: Thu, 27 Sep 2018 12:58:50 +0200 Subject: [PATCH] gnucash: add patch to make partially ported python code compatible with python3 --- srcpkgs/gnucash/patches/python3.patch | 89 +++++++++++++++++++++++++++ srcpkgs/gnucash/template | 2 +- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/gnucash/patches/python3.patch diff --git a/srcpkgs/gnucash/patches/python3.patch b/srcpkgs/gnucash/patches/python3.patch new file mode 100644 index 00000000000..a5f00a25442 --- /dev/null +++ b/srcpkgs/gnucash/patches/python3.patch @@ -0,0 +1,89 @@ +Source: Hoshpak/upstream +Upstream: partial +Reason: compatibility of the remaining code with python3 +--- gnucash/python/pycons/ishell.py 2018-09-27 12:30:44.136631542 +0200 ++++ gnucash/python/pycons/ishell.py 2018-09-27 12:46:51.636875378 +0200 +@@ -16,11 +16,10 @@ + import os + import sys + import re +-from StringIO import StringIO + try: + import IPython +- from IPython import ipapi +-except Exception,e: ++ from IPython.core import interactiveshell ++except Exception as e: + raise "Error importing IPython (%s)" % str(e) + + +@@ -54,7 +53,7 @@ + header='IPython system call: ', + verbose=self.IP.rc.system_verbose) + # Get a hold of the public IPython API object and use it +- self.ip = ipapi.get() ++ self.ip = interactiveshell.get_ipython() + self.ip.magic('colors LightBG') + sys.excepthook = excepthook + self.iter_more = 0 +--- gnucash/python/pycons/shell.py 2018-09-27 12:47:04.181700180 +0200 ++++ gnucash/python/pycons/shell.py 2018-09-27 12:47:53.483011434 +0200 +@@ -153,9 +153,9 @@ + console.write (buf, 'output') + if len(buf) < 256: break + # Command output +- print(`r`) ++ print(repr(r)) + except SyntaxError: +- exec self.command in self.globals ++ exec(self.command in self.globals) + except: + if hasattr (sys, 'last_type') and sys.last_type == SystemExit: + console.quit() +--- gnucash/python/pycons/console.py 2018-09-27 12:48:04.043863853 +0200 ++++ gnucash/python/pycons/console.py 2018-09-27 12:49:32.770623486 +0200 +@@ -31,10 +31,12 @@ + import re + import tempfile + import readline ++import gi ++gi.require_version('Gtk', '3.0') + from gi.repository import GObject + from gi.repository import Gtk + from gi.repository import Pango +-from StringIO import StringIO ++import io + import shell + try: import ishell + except: pass +@@ -79,8 +81,8 @@ + def writelines(self, l): + for s in l: + self.console.write (s, self.style) +- def seek(self, a): raise IOError, (29, 'Illegal seek') +- def tell(self): raise IOError, (29, 'Illegal seek') ++ def seek(self, a): raise IOError(29, 'Illegal seek') ++ def tell(self): raise IOError(29, 'Illegal seek') + truncate = tell + + +@@ -113,8 +115,8 @@ + def readlines(self): return [] + def write(self, s): return None + def writelines(self, l): return None +- def seek(self, a): raise IOError, (29, 'Illegal seek') +- def tell(self): raise IOError, (29, 'Illegal seek') ++ def seek(self, a): raise IOError(29, 'Illegal seek') ++ def tell(self): raise IOError(29, 'Illegal seek') + truncate = tell + + +@@ -179,7 +181,7 @@ + # Console stuff + self.argv = argv + self.history_init(filename, size) +- self.cout = StringIO() ++ self.cout = io.StringIO() + self.cout.truncate(0) + if shelltype=='ipython': + self.shell = ishell.Shell(argv,locals(),globals(), diff --git a/srcpkgs/gnucash/template b/srcpkgs/gnucash/template index 332501987cb..a646b17624f 100644 --- a/srcpkgs/gnucash/template +++ b/srcpkgs/gnucash/template @@ -1,7 +1,7 @@ # Template file for 'gnucash' pkgname=gnucash version=3.2 -revision=2 +revision=3 build_style=cmake configure_args="-DWITH_SQL=0 -DWITH_PYTHON=1" hostmakedepends="pkg-config guile python3 libxslt perl"