make evemu Python 3 aware

Daniel Martin consume.noise at gmail.com
Fri Jan 3 09:25:48 PST 2014


On Fri, Jan 03, 2014 at 11:18:19AM +1000, Peter Hutterer wrote:
> On Thu, Jan 02, 2014 at 10:47:50PM +0100, Daniel Martin wrote:
> > Hi,
> > 
> > I just wanted to test evemu(-describe) with my new Logitech tk820 [0]
> > and noticed that evemu doesn't like to be used with Python 3(.3). So,
> > I've fixed that ...
> > 
> > First, make testing more easy by being able to change the python binary
> > via the environment:
> > [PATCH evemu 01/11] Make it possible to overwrite python binary via env
> > 
> > Python 3 awareness:
> > [PATCH evemu 02/11] py: Replace print statement with function call
> > [PATCH evemu 03/11] py: Don't use find_library for libevemu.so
> > [PATCH evemu 04/11] tests: Replace tab with spaces
> > [PATCH evemu 05/11] py: Raise exception objects
> > [PATCH evemu 06/11] py: Fix file opening
> > [PATCH evemu 07/11] py: Fix file object detection
> > [PATCH evemu 08/11] py: Add _callstr() - returns str object
> > [PATCH evemu 09/11] tests: Open temporary device file in text mode
> > [PATCH evemu 10/11] tests: Fix tests with fixed lists
> 
> unless otherwise commented: Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
> 
> > This one changes the module API, skip it if you don't like it:
> > [PATCH evemu 11/11] py: Change has_prop() and has_event() to return bool
> 
> would be nice, but before we change this we should figure out if the python
> API is actually correctly handled right now and in sync with everything - my
> guess is that it probably isn't.
> 
> As for the actual change: I'm not sure it really gives us a lot of
> benefits. it'll likely break any existing users (if there are any) for
> little more than a cosmetic change. otoh, we just bumped the ABI anyway, so
> if we do this the time is now (together with any others we need to do). I'll
> leave it up to Benjamin to make the call.

The API change isn't that hard as I thought, even with Python 2.6 it
shouldn't break any existing tests as comparing a bool with an int works
as expected:
    >>> True == 1
    True
    >>> False == 1
    False
    ...


More information about the Input-tools mailing list