gnucash: add patch to make partially ported python code compatible with python3
This commit is contained in:
parent
0b0a82364e
commit
0cc31d6a5d
89
srcpkgs/gnucash/patches/python3.patch
Normal file
89
srcpkgs/gnucash/patches/python3.patch
Normal file
|
@ -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(),
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'gnucash'
|
# Template file for 'gnucash'
|
||||||
pkgname=gnucash
|
pkgname=gnucash
|
||||||
version=3.2
|
version=3.2
|
||||||
revision=2
|
revision=3
|
||||||
build_style=cmake
|
build_style=cmake
|
||||||
configure_args="-DWITH_SQL=0 -DWITH_PYTHON=1"
|
configure_args="-DWITH_SQL=0 -DWITH_PYTHON=1"
|
||||||
hostmakedepends="pkg-config guile python3 libxslt perl"
|
hostmakedepends="pkg-config guile python3 libxslt perl"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user