[PATCH 1/7] Check for python2 if available

Peter Hutterer peter.hutterer at who-t.net
Wed Aug 21 21:52:54 PDT 2013


On Sat, Aug 17, 2013 at 01:58:13PM +0200, David Herrmann wrote:
> On some systems (specifically Arch Linux) /usr/bin/python is v3 while
> /usr/bin/python2 is v2. Check for python2 and use it, iff available.
> Otherwise fall back to python as usual.
> 
> Signed-off-by: David Herrmann <dh.herrmann at gmail.com>

good catch. though given how simple the script is I think it's better to
just make the script compatible for version 2 and 3.

The only issue here is print which can be replaced with str.format(). That
is only available in 2.6 and above, but given that even RHEL6 ships 2.6,
that's a reasonable requirement.

Cheers,
   Peter


> ---
>  configure.ac         | 1 +
>  libevdev/Makefile.am | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 68df538..889ff81 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -27,6 +27,7 @@ AM_SILENT_RULES([yes])
>  
>  # Check for programs
>  AC_PROG_CC
> +AC_CHECK_PROGS([PYTHON2], [python2 python])
>  
>  # Initialize libtool
>  LT_PREREQ([2.2])
> diff --git a/libevdev/Makefile.am b/libevdev/Makefile.am
> index 9879c0e..e71b980 100644
> --- a/libevdev/Makefile.am
> +++ b/libevdev/Makefile.am
> @@ -14,7 +14,7 @@ libevdevincludedir = $(includedir)/libevdev-1.0/libevdev
>  libevdevinclude_HEADERS = libevdev.h
>  
>  event-names.h: Makefile make-event-names.py
> -	        $(srcdir)/make-event-names.py --output=c > $@
> +	$(PYTHON2) $(srcdir)/make-event-names.py --output=c > $@
>  
>  EXTRA_DIST = make-event-names.py
>  CLEANFILES = event-names.h
> -- 
> 1.8.3.4
> 


More information about the Input-tools mailing list