Merge lp:~bregma/geis/pygies-python3 into lp:~themuso/geis/python3

Proposed by Stephen M. Webb
Status: Merged
Merged at revision: 294
Proposed branch: lp:~bregma/geis/pygies-python3
Merge into: lp:~themuso/geis/python3
Diff against target: 93 lines (+11/-10)
2 files modified
python/Makefile.am (+1/-1)
python/geis/geis_v2.py (+10/-9)
To merge this branch: bzr merge lp:~bregma/geis/pygies-python3
Reviewer Review Type Date Requested Status
Luke Yelavich Pending
Review via email: mp+135044@code.launchpad.net

Description of the change

(1) Strings returned through the ctypes interface were byte strings and needed to be decoded as utf-8 (otherwise a mismatch occurs during dictionary lookups).

(2) Wrong variable name was used in the link line in Makefile.am so no python runtime was linked in (problem may only show up using the GNU gold linker)

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'python/Makefile.am'
2--- python/Makefile.am 2012-11-16 05:09:44 +0000
3+++ python/Makefile.am 2012-11-20 04:13:22 +0000
4@@ -41,5 +41,5 @@
5 -module -avoid-version \
6 -export-symbols-regex PyInit__geis_bindings \
7 $(top_builddir)/libgeis/libgeis.la \
8- $(PYTHON_LDFLAGS)
9+ $(PYTHON_LIBS)
10
11
12=== modified file 'python/geis/geis_v2.py'
13--- python/geis/geis_v2.py 2012-11-16 05:09:44 +0000
14+++ python/geis/geis_v2.py 2012-11-20 04:13:22 +0000
15@@ -139,12 +139,12 @@
16 def __init__(self, attr):
17 self._class = _geis_attr_value_to_pointer(attr)
18 self._id = _geis_gesture_class_id(self._class)
19- self._name = _geis_gesture_class_name(self._class)
20+ self._name = _geis_gesture_class_name(self._class).decode('utf-8')
21 self._attr_count = _geis_gesture_class_attr_count(self._class)
22 self._attrs = {}
23 for i in range(self._attr_count):
24 attr = _geis_gesture_class_attr(self._class, i)
25- attr_name = _geis_attr_name(attr)
26+ attr_name = _geis_attr_name(attr).decode('utf-8')
27 self._attrs[attr_name] = _attr_types.get(_geis_attr_type(attr),
28 _attr_type_unknown)(attr)
29
30@@ -175,7 +175,7 @@
31 def __init__(self, attr):
32 self._device = _geis_attr_value_to_pointer(attr)
33 self._id = _geis_device_id(self._device)
34- self._name = _geis_device_name(self._device)
35+ self._name = _geis_device_name(self._device).decode('utf-8')
36 self._min_x = 0.0
37 self._min_y = 0.0
38 self._max_x = 0.0
39@@ -184,7 +184,7 @@
40 self._attrs = {}
41 for i in range(self._attr_count):
42 attr = _geis_device_attr(self._device, i)
43- attr_name = _geis_attr_name(attr)
44+ attr_name = _geis_attr_name(attr).decode('utf-8')
45 self._attrs[attr_name] = _attr_types.get(_geis_attr_type(attr),
46 _attr_type_unknown)(attr)
47 if re.search("Abs MT Position X \d+ min", attr_name):
48@@ -237,7 +237,7 @@
49 attr_list = {}
50 for i in range(self._attr_count):
51 attr = _geis_touch_attr(self._touch, i)
52- attr_name = _geis_attr_name(attr)
53+ attr_name = _geis_attr_name(attr).decode('utf-8')
54 attr_list[attr_name] = _attr_types.get(_geis_attr_type(attr),
55 _attr_type_unknown)(attr)
56 return attr_list
57@@ -331,7 +331,7 @@
58 attr_list = {}
59 for i in range(_geis_frame_attr_count(self._frame)):
60 attr = _geis_frame_attr(self._frame, i)
61- attr_name = _geis_attr_name(attr)
62+ attr_name = _geis_attr_name(attr).decode('utf-8')
63 attr_list[attr_name] = _attr_types.get(_geis_attr_type(attr),
64 _attr_type_unknown)(attr)
65 return attr_list
66@@ -406,7 +406,8 @@
67 def _attr_type_pointer(attr):
68 """ Extracts an attribute value as an object.
69 """
70- return _attr_pointer_type.get(_geis_attr_name(attr), _pointer_type_unknown)(attr)
71+ return _attr_pointer_type.get(_geis_attr_name(attr).decode('utf-8'),
72+ _pointer_type_unknown)(attr)
73
74
75 def _attr_type_string(attr):
76@@ -418,7 +419,7 @@
77
78
79 def _attr_type_unknown(attr):
80- print("unknown attr type" + _geis_attr_name(attr))
81+ print("unknown attr type" + _geis_attr_name(attr).decode('utf-8'))
82 return None
83
84
85@@ -557,7 +558,7 @@
86 attr_list = {}
87 for i in range(_geis_event_attr_count(self._event)):
88 attr = _geis_event_attr(self._event, i)
89- attr_name = _geis_attr_name(attr)
90+ attr_name = _geis_attr_name(attr).decode('utf-8')
91 attr_list[attr_name] = _attr_types.get(_geis_attr_type(attr),
92 _attr_type_unknown)(attr)
93 return attr_list

Subscribers

People subscribed via source and target branches

to all changes: