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.
Revision history for this message
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?

Revision history for this message
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.

Revision history for this message
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

Use unicode literals to prepare for Python 3.

54. By Jussi Pakkanen

Added absolute_import for Python 3 preparation.

53. By Jussi Pakkanen

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
=== modified file 'python/evemu/__init__.py'
--- python/evemu/__init__.py 2012-03-23 15:38:02 +0000
+++ python/evemu/__init__.py 2012-03-30 11:25:35 +0000
@@ -17,8 +17,11 @@
17# You should have received a copy of the GNU Leseer General Public License17# You should have received a copy of the GNU Leseer General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.18# along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
20from __future__ import print_function, absolute_import, unicode_literals
21
20from ctypes.util import find_library22from ctypes.util import find_library
2123
24
22import ctypes25import ctypes
23import evemu.base26import evemu.base
24import evemu.const27import evemu.const
@@ -46,7 +49,7 @@
46 to create a pseudo-device node.49 to create a pseudo-device node.
47 """50 """
4851
49 if type(f).__name__ == 'str':52 if type(f).__name__ == 'str' or type(f).__name__ == 'unicode':
50 self._file = open(f, 'r+b')53 self._file = open(f, 'r+b')
51 elif type(f).__name__ == 'file':54 elif type(f).__name__ == 'file':
52 self._file = f55 self._file = f
5356
=== modified file 'python/evemu/base.py'
--- python/evemu/base.py 2011-11-24 16:26:02 +0000
+++ python/evemu/base.py 2012-03-30 11:25:35 +0000
@@ -1,3 +1,5 @@
1from __future__ import print_function, absolute_import, unicode_literals
2
1import ctypes3import ctypes
2from ctypes.util import find_library4from ctypes.util import find_library
3import os5import os
46
=== modified file 'python/evemu/const.py'
--- python/evemu/const.py 2011-11-24 03:24:15 +0000
+++ python/evemu/const.py 2012-03-30 11:25:35 +0000
@@ -1,3 +1,5 @@
1from __future__ import print_function, absolute_import, unicode_literals
2
1LIB = "utouch-evemu"3LIB = "utouch-evemu"
2DEFAULT_LIB = "/usr/lib/libutouch-evemu.so"4DEFAULT_LIB = "/usr/lib/libutouch-evemu.so"
3LOCAL_LIB = "../src/.libs/libutouch-evemu.so"5LOCAL_LIB = "../src/.libs/libutouch-evemu.so"
46
=== modified file 'python/evemu/exception.py'
--- python/evemu/exception.py 2011-03-23 19:53:36 +0000
+++ python/evemu/exception.py 2012-03-30 11:25:35 +0000
@@ -1,3 +1,5 @@
1from __future__ import print_function, absolute_import, unicode_literals
2
1class EvEmuError(Exception):3class EvEmuError(Exception):
2 pass4 pass
35
46
=== modified file 'python/evemu/testing/result.py'
--- python/evemu/testing/result.py 2011-11-30 20:11:37 +0000
+++ python/evemu/testing/result.py 2012-03-30 11:25:35 +0000
@@ -1,3 +1,5 @@
1from __future__ import print_function, absolute_import, unicode_literals
2
1import unittest3import unittest
2try:4try:
3 # Python 2.75 # Python 2.7
@@ -42,7 +44,7 @@
42 self.stream.writeln(heading)44 self.stream.writeln(heading)
43 if self.last_class != self.current_class:45 if self.last_class != self.current_class:
44 self.stream.writeln(" %s" % this_class)46 self.stream.writeln(" %s" % this_class)
45 self.stream.write(" %s " % method.ljust(50, "."))47 self.stream.write(" %s " % method.ljust(50, b"."))
46 self.stream.write(" ")48 self.stream.write(" ")
47 self.stream.flush()49 self.stream.flush()
4850
4951
=== modified file 'python/evemu/testing/runner.py'
--- python/evemu/testing/runner.py 2011-11-30 20:11:37 +0000
+++ python/evemu/testing/runner.py 2012-03-30 11:25:35 +0000
@@ -1,3 +1,5 @@
1from __future__ import print_function, absolute_import, unicode_literals
2
1import os3import os
2import unittest4import unittest
35
46
=== modified file 'python/evemu/testing/testcase.py'
--- python/evemu/testing/testcase.py 2011-11-30 20:11:37 +0000
+++ python/evemu/testing/testcase.py 2012-03-30 11:25:35 +0000
@@ -1,3 +1,5 @@
1from __future__ import print_function, absolute_import, unicode_literals
2
1from ctypes.util import find_library3from ctypes.util import find_library
2import os4import os
3import unittest5import unittest
46
=== modified file 'python/evemu/tests/test_base.py'
--- python/evemu/tests/test_base.py 2011-11-30 20:11:37 +0000
+++ python/evemu/tests/test_base.py 2012-03-30 11:25:35 +0000
@@ -1,3 +1,5 @@
1from __future__ import print_function, absolute_import, unicode_literals
2
1import unittest3import unittest
24
3from evemu import const5from evemu import const
46
=== modified file 'python/evemu/tests/test_device.py'
--- python/evemu/tests/test_device.py 2012-03-28 14:33:57 +0000
+++ python/evemu/tests/test_device.py 2012-03-30 11:25:35 +0000
@@ -1,3 +1,4 @@
1from __future__ import print_function, absolute_import, unicode_literals
12
2from evemu.testing import testcase3from evemu.testing import testcase
3from multiprocessing import Process, Queue, Event4from multiprocessing import Process, Queue, Event

Subscribers

People subscribed via source and target branches