Merge lp:~jpakkane/evemu/python3-preparation into lp:evemu

Proposed by Jussi Pakkanen
Status: Needs review
Proposed branch: lp:~jpakkane/evemu/python3-preparation
Merge into: lp:evemu
Diff against target: 112 lines (+20/-2)
9 files modified
python/evemu/__init__.py (+4/-1)
python/evemu/base.py (+2/-0)
python/evemu/const.py (+2/-0)
python/evemu/exception.py (+2/-0)
python/evemu/testing/result.py (+3/-1)
python/evemu/testing/runner.py (+2/-0)
python/evemu/testing/testcase.py (+2/-0)
python/evemu/tests/test_base.py (+2/-0)
python/evemu/tests/test_device.py (+1/-0)
To merge this branch: bzr merge lp:~jpakkane/evemu/python3-preparation
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Open Input Framework Team Pending
Review via email: mp+100103@code.launchpad.net

Description of the change

Python 3 is coming. This branch prepares for that by cleaning up the code and adding __future__ imports that add stricter checking.

There are very few changes, but personally I would not merge this until after 12/04 has been released.

To post a comment you must log in.
Stephen M. Webb (bregma) wrote :

I don't understand why you bother importing stuff from __future__ that never gets used. For example, there are no print statement in any of this code, so why import print_function? Is it not bad form in Python to import moduoles that do not get used?

Jussi Pakkanen (jpakkane) wrote :

__future__ imports are special. They are not modules, but rather change the behaviour of the compiler/interpreter.

It's a bit like having -Werror on in C. It tells you immediately if you screw up in the future.

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:55
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~jpakkane/evemu/python3-preparation/+merge/100103/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/evemu-ci/2/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/evemu-raring-amd64-ci/2//console
    FAILURE: http://jenkins.qa.ubuntu.com/job/evemu-raring-armhf-ci/2//console
    FAILURE: http://jenkins.qa.ubuntu.com/job/evemu-raring-i386-ci/2//console

Click here to trigger a rebuild:
http://jenkins.qa.ubuntu.com/job/evemu-ci/2//rebuild/?

review: Needs Fixing (continuous-integration)

Unmerged revisions

55. By Jussi Pakkanen on 2012-03-30

Use unicode literals to prepare for Python 3.

54. By Jussi Pakkanen on 2012-03-30

Added absolute_import for Python 3 preparation.

53. By Jussi Pakkanen on 2012-03-30

Added print_function to prepare for Python 3.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'python/evemu/__init__.py'
2--- python/evemu/__init__.py 2012-03-23 15:38:02 +0000
3+++ python/evemu/__init__.py 2012-03-30 11:25:35 +0000
4@@ -17,8 +17,11 @@
5 # You should have received a copy of the GNU Leseer General Public License
6 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7
8+from __future__ import print_function, absolute_import, unicode_literals
9+
10 from ctypes.util import find_library
11
12+
13 import ctypes
14 import evemu.base
15 import evemu.const
16@@ -46,7 +49,7 @@
17 to create a pseudo-device node.
18 """
19
20- if type(f).__name__ == 'str':
21+ if type(f).__name__ == 'str' or type(f).__name__ == 'unicode':
22 self._file = open(f, 'r+b')
23 elif type(f).__name__ == 'file':
24 self._file = f
25
26=== modified file 'python/evemu/base.py'
27--- python/evemu/base.py 2011-11-24 16:26:02 +0000
28+++ python/evemu/base.py 2012-03-30 11:25:35 +0000
29@@ -1,3 +1,5 @@
30+from __future__ import print_function, absolute_import, unicode_literals
31+
32 import ctypes
33 from ctypes.util import find_library
34 import os
35
36=== modified file 'python/evemu/const.py'
37--- python/evemu/const.py 2011-11-24 03:24:15 +0000
38+++ python/evemu/const.py 2012-03-30 11:25:35 +0000
39@@ -1,3 +1,5 @@
40+from __future__ import print_function, absolute_import, unicode_literals
41+
42 LIB = "utouch-evemu"
43 DEFAULT_LIB = "/usr/lib/libutouch-evemu.so"
44 LOCAL_LIB = "../src/.libs/libutouch-evemu.so"
45
46=== modified file 'python/evemu/exception.py'
47--- python/evemu/exception.py 2011-03-23 19:53:36 +0000
48+++ python/evemu/exception.py 2012-03-30 11:25:35 +0000
49@@ -1,3 +1,5 @@
50+from __future__ import print_function, absolute_import, unicode_literals
51+
52 class EvEmuError(Exception):
53 pass
54
55
56=== modified file 'python/evemu/testing/result.py'
57--- python/evemu/testing/result.py 2011-11-30 20:11:37 +0000
58+++ python/evemu/testing/result.py 2012-03-30 11:25:35 +0000
59@@ -1,3 +1,5 @@
60+from __future__ import print_function, absolute_import, unicode_literals
61+
62 import unittest
63 try:
64 # Python 2.7
65@@ -42,7 +44,7 @@
66 self.stream.writeln(heading)
67 if self.last_class != self.current_class:
68 self.stream.writeln(" %s" % this_class)
69- self.stream.write(" %s " % method.ljust(50, "."))
70+ self.stream.write(" %s " % method.ljust(50, b"."))
71 self.stream.write(" ")
72 self.stream.flush()
73
74
75=== modified file 'python/evemu/testing/runner.py'
76--- python/evemu/testing/runner.py 2011-11-30 20:11:37 +0000
77+++ python/evemu/testing/runner.py 2012-03-30 11:25:35 +0000
78@@ -1,3 +1,5 @@
79+from __future__ import print_function, absolute_import, unicode_literals
80+
81 import os
82 import unittest
83
84
85=== modified file 'python/evemu/testing/testcase.py'
86--- python/evemu/testing/testcase.py 2011-11-30 20:11:37 +0000
87+++ python/evemu/testing/testcase.py 2012-03-30 11:25:35 +0000
88@@ -1,3 +1,5 @@
89+from __future__ import print_function, absolute_import, unicode_literals
90+
91 from ctypes.util import find_library
92 import os
93 import unittest
94
95=== modified file 'python/evemu/tests/test_base.py'
96--- python/evemu/tests/test_base.py 2011-11-30 20:11:37 +0000
97+++ python/evemu/tests/test_base.py 2012-03-30 11:25:35 +0000
98@@ -1,3 +1,5 @@
99+from __future__ import print_function, absolute_import, unicode_literals
100+
101 import unittest
102
103 from evemu import const
104
105=== modified file 'python/evemu/tests/test_device.py'
106--- python/evemu/tests/test_device.py 2012-03-28 14:33:57 +0000
107+++ python/evemu/tests/test_device.py 2012-03-30 11:25:35 +0000
108@@ -1,3 +1,4 @@
109+from __future__ import print_function, absolute_import, unicode_literals
110
111 from evemu.testing import testcase
112 from multiprocessing import Process, Queue, Event

Subscribers

People subscribed via source and target branches