Accepting request 547564 from home:dimstar:Factory
- Migrate orca plugin to python3: orca has been a python3 application since version 3.7, released in 2013: + Add python3-base BuildRequires. + Add sbl-orca-python3.patch: convert brlapi.py and python/Makefile to python3. (removed python3-tools BR of my previous SR; was from an earlier experiment) OBS-URL: https://build.opensuse.org/request/show/547564 OBS-URL: https://build.opensuse.org/package/show/hardware/sbl?expand=0&rev=29
This commit is contained in:
parent
3b650f4a29
commit
47dea93159
138
sbl-orca-python3.patch
Normal file
138
sbl-orca-python3.patch
Normal file
@ -0,0 +1,138 @@
|
||||
Index: sbl-3.5.0.20130317.git7a75bc29/python/Makefile
|
||||
===================================================================
|
||||
--- sbl-3.5.0.20130317.git7a75bc29.orig/python/Makefile
|
||||
+++ sbl-3.5.0.20130317.git7a75bc29/python/Makefile
|
||||
@@ -2,12 +2,11 @@
|
||||
### Author: Marco Skambraks <marco@skammel.de>
|
||||
include ../make.config
|
||||
|
||||
-PYVER=$(shell python --version 2>&1|cut -c 8-|cut -c 1-3)
|
||||
-ORCA_DIR=$(DESTDIR)$(LIBDIR)/python$(PYVER)/site-packages/orca
|
||||
+ORCA_DIR=$(DESTDIR)$(shell python3 -c "import site; print(site.getsitepackages()[0])")/orca
|
||||
|
||||
all: brlapi.py
|
||||
@echo -n Generating byte code...
|
||||
- @python -c 'import brlapi' && echo ok || @echo failed
|
||||
+ @python3 -c 'import brlapi' && echo ok || @echo failed
|
||||
|
||||
clean:
|
||||
rm -f *~ xyz jj.jj *.pyc
|
||||
@@ -15,7 +14,7 @@ clean:
|
||||
install: all
|
||||
@if [ -d $(ORCA_DIR) ] || [ ! -z "$(DESTDIR)" ]; then \
|
||||
install --directory $(ORCA_DIR) ; \
|
||||
- install -m 644 brlapi.py brlapi.pyc $(ORCA_DIR) ; \
|
||||
+ install -m 644 brlapi.py* $(ORCA_DIR) ; \
|
||||
else \
|
||||
echo please make sure that orca is installed in: ; \
|
||||
echo $(ORCA_DIR) ; \
|
||||
Index: sbl-3.5.0.20130317.git7a75bc29/python/brlapi.py
|
||||
===================================================================
|
||||
--- sbl-3.5.0.20130317.git7a75bc29.orig/python/brlapi.py
|
||||
+++ sbl-3.5.0.20130317.git7a75bc29/python/brlapi.py
|
||||
@@ -42,7 +42,7 @@ class getconf:
|
||||
try:
|
||||
conffile = open("/etc/sbl.conf",'r')
|
||||
except:
|
||||
- print "cannot open /etc/sbl.conf"
|
||||
+ print("cannot open /etc/sbl.conf")
|
||||
return None
|
||||
|
||||
for i in conffile.readlines():
|
||||
@@ -99,7 +99,7 @@ class getconf:
|
||||
try:
|
||||
kmfile = open("/etc/sbl/keymap/" + brlname + ".map", 'r')
|
||||
except:
|
||||
- print "no keymap found for ", brlname
|
||||
+ print("no keymap found for ", brlname)
|
||||
return False
|
||||
|
||||
for i in kmfile.readlines():
|
||||
@@ -167,32 +167,32 @@ class Connection:
|
||||
if self.brld == None:
|
||||
self.brld = CDLL("libbrld.so.1")
|
||||
except:
|
||||
- print "cannot open libbrld.so.1"
|
||||
+ print("cannot open libbrld.so.1")
|
||||
return None
|
||||
|
||||
self.conf = getconf()
|
||||
self.fileDescriptor = self.brld.brld_open("localhost", self.conf.brldport())
|
||||
|
||||
if self.fileDescriptor < 0:
|
||||
- print "brld: connection failed"
|
||||
+ print("brld: connection failed")
|
||||
raise IoError
|
||||
|
||||
tmpstr = create_string_buffer('\000' * 128)
|
||||
tmpstr.value = self.conf.brldauth()
|
||||
if self.brld.brld_reg(2, tmpstr.value) < 0:
|
||||
- print "brld: reg failed"
|
||||
+ print("brld: reg failed")
|
||||
else:
|
||||
if self.brld.brld_seteventmode() <0:
|
||||
- print "brld: eventmode setfailed"
|
||||
+ print("brld: eventmode setfailed")
|
||||
return None
|
||||
|
||||
if self.brld.brld_getxy(byref(self.x),byref(self.y)) <0:
|
||||
- print "brld: error getting Displaysize"
|
||||
+ print("brld: error getting Displaysize")
|
||||
return None
|
||||
|
||||
self.displaySize = (self.x.value, self.y.value)
|
||||
if self.brld.brld_getalias(byref(tmpstr)) <0:
|
||||
- print "brld: error getting brlname"
|
||||
+ print("brld: error getting brlname")
|
||||
return None
|
||||
self.brlname = tmpstr.value
|
||||
self.conf.loadkeymap(self.brlname)
|
||||
@@ -208,7 +208,7 @@ class Connection:
|
||||
s.value = text.decode("UTF-8").encode("iso8859-1")
|
||||
|
||||
if self.brld.brld_write(cursor, s, "") <0:
|
||||
- print "brld: writeText error"
|
||||
+ print("brld: writeText error")
|
||||
return False
|
||||
|
||||
return True
|
||||
@@ -220,7 +220,7 @@ class Connection:
|
||||
|
||||
len_diff = 0
|
||||
add_spaces = ""
|
||||
- s.value = writestruct.text.replace(u"\u2022", "*").encode("iso8859-1")
|
||||
+ s.value = writestruct.text.replace("\u2022", "*").encode("iso8859-1")
|
||||
if len(writestruct.attrOr) < len(writestruct.text):
|
||||
len_diff = len(writestruct.text) - len(writestruct.attrOr)
|
||||
add_spaces = ' ' * len_diff
|
||||
@@ -228,8 +228,8 @@ class Connection:
|
||||
a.value = writestruct.attrOr.replace('\x00',' ') + add_spaces
|
||||
|
||||
if self.brld.brld_write(writestruct.cursor-1, s.value, a.value) <0:
|
||||
- print "brld: write err"
|
||||
- print "brlline= ", writestruct.text
|
||||
+ print("brld: write err")
|
||||
+ print("brlline= ", writestruct.text)
|
||||
return False
|
||||
|
||||
return True
|
||||
@@ -239,7 +239,7 @@ class Connection:
|
||||
pressed = c_int()
|
||||
key = self.brld.brld_getkey(byref(pressed))
|
||||
if key == -4:
|
||||
- print "brld: getkey no connection"
|
||||
+ print("brld: getkey no connection")
|
||||
raise IoError
|
||||
|
||||
if key <= 0:
|
||||
@@ -319,8 +319,8 @@ class Connection:
|
||||
return True
|
||||
|
||||
def enterTtyMode(self, tty=7, driver=None):
|
||||
- print "brld: enterTtyMode"
|
||||
- print tty, driver
|
||||
+ print("brld: enterTtyMode")
|
||||
+ print(tty, driver)
|
||||
|
||||
|
||||
def leaveTtyMode(self):
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Dec 2 10:41:38 UTC 2017 - dimstar@opensuse.org
|
||||
|
||||
- Migrate orca plugin to python3: orca has been a python3
|
||||
application since version 3.7, released in 2013:
|
||||
+ Add python3-base BuildRequires.
|
||||
+ Add sbl-orca-python3.patch: convert brlapi.py and
|
||||
python/Makefile to python3.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 9 13:22:43 UTC 2016 - fbui@suse.com
|
||||
|
||||
|
10
sbl.spec
10
sbl.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package sbl
|
||||
#
|
||||
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -31,10 +31,12 @@ Patch3: sbl-install_perms.patch
|
||||
Patch4: sbl-libdir.patch
|
||||
Patch5: sbl-init-scripts.patch
|
||||
Patch6: sbl-sppkdev.patch
|
||||
Patch7: sbl-orca-python3.patch
|
||||
BuildRequires: bluez-devel
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: libusb-devel
|
||||
BuildRequires: orca
|
||||
BuildRequires: python3-base
|
||||
BuildRequires: speechd-devel
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%if 0%{?suse_version} > 1310
|
||||
@ -57,7 +59,6 @@ Summary: brld-orca brlapi
|
||||
License: GPL-2.0 and GPL-2.0+
|
||||
Group: Productivity/Multimedia/Sound/Utilities
|
||||
Requires: orca
|
||||
%py_requires
|
||||
|
||||
%description orca
|
||||
this python module enables orca to use brld for braille output
|
||||
@ -72,6 +73,7 @@ this python module enables orca to use brld for braille output
|
||||
%endif
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} CFLAGS="%{optflags} -D_POSIX_C_SOURCE=2 -D_BSD_SOURCE" LIB_CFLAGS="%{optflags} -D_POSIX_C_SOURCE=2 -D_BSD_SOURCE -fPIC -I%{_includedir}/speech-dispatcher"
|
||||
@ -147,7 +149,7 @@ ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcbrld
|
||||
|
||||
%files orca
|
||||
%defattr (-,root,root,755)
|
||||
%dir %{python_sitearch}/orca
|
||||
%{python_sitearch}/orca/brlapi.py*
|
||||
%dir %{python3_sitearch}/orca
|
||||
%{python3_sitearch}/orca/brlapi.py*
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user