- Add port-to-python3.patch: * Ports gen-keysym-entries.py to Python 3. - Remove unneeded BuildRequires on python and python-devel OBS-URL: https://build.opensuse.org/request/show/920540 OBS-URL: https://build.opensuse.org/package/show/M17N/eekboard?expand=0&rev=9
50 lines
1.8 KiB
Diff
50 lines
1.8 KiB
Diff
Written by Akinori Hattori <hattya@gentoo.org>, sourced from:
|
|
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9f523470ee04ea0ed7ebadbc950b16e2afb17b5
|
|
Index: eekboard-1.0.8/eek/gen-keysym-entries.py
|
|
===================================================================
|
|
--- eekboard-1.0.8.orig/eek/gen-keysym-entries.py
|
|
+++ eekboard-1.0.8/eek/gen-keysym-entries.py
|
|
@@ -1,4 +1,4 @@
|
|
-#!/usr/bin/env python
|
|
+#!/usr/bin/python3
|
|
|
|
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
|
# Copyright (C) 2010-2011 Red Hat, Inc.
|
|
@@ -18,17 +18,20 @@
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
# 02110-1301 USA
|
|
|
|
+from __future__ import print_function
|
|
import sys
|
|
import re
|
|
|
|
if len(sys.argv) != 2:
|
|
- print >> sys.stderr, "Usage: %s TABLE-NAME" % sys.argv[0]
|
|
+ print("Usage: %s TABLE-NAME" % sys.argv[0], file=sys.stderr)
|
|
sys.exit(-1)
|
|
|
|
+py2 = sys.version_info[0] < 3
|
|
table = dict()
|
|
for line in sys.stdin:
|
|
- line = line.decode('UTF-8')
|
|
- match = re.match(r'\s*(0x[0-9A-F]+)\s+(\S*)\s+(\S*)', line, re.I)
|
|
+ if py2:
|
|
+ line = line.decode('UTF-8')
|
|
+ match = re.match(r'\s*(0x[0-9A-F]+)\s+(\w*)\s+(\w*)', line, re.I)
|
|
if match:
|
|
table[int(match.group(1), 16)] = (match.group(2), match.group(3))
|
|
|
|
@@ -37,8 +40,10 @@ sys.stdout.write("static const EekKeysym
|
|
|
|
for index, (keysym, (l, c)) in enumerate([(keysym, table[keysym])
|
|
for keysym in sorted(table.keys())]):
|
|
- sys.stdout.write(" { 0x%X, %s, %s }" %
|
|
- (keysym, l.encode('UTF-8'), c.encode('UTF-8')))
|
|
+ if py2:
|
|
+ l = l.encode('UTF-8')
|
|
+ c = c.encode('UTF-8')
|
|
+ sys.stdout.write(" { 0x%X, %s, %s }" % (keysym, l, c))
|
|
if index < len(table) - 1:
|
|
sys.stdout.write(",")
|
|
sys.stdout.write("\n")
|