From patchwork Mon Apr 28 22:15:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 343613 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id BB62A1400B5 for ; Tue, 29 Apr 2014 08:15:51 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id A0E888B1F3; Mon, 28 Apr 2014 22:15:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l0BBRlP7lozn; Mon, 28 Apr 2014 22:15:50 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E67E08B1C3; Mon, 28 Apr 2014 22:15:49 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 303FF1BFA34 for ; Mon, 28 Apr 2014 22:15:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2CA998BBD9 for ; Mon, 28 Apr 2014 22:15:48 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id plhjwzt0PI5a for ; Mon, 28 Apr 2014 22:15:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by whitealder.osuosl.org (Postfix) with ESMTPS id 642E08BB4C for ; Mon, 28 Apr 2014 22:15:47 +0000 (UTC) Received: from linux.local ([92.75.75.64]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LtJAR-1X2epG2Ful-012m3Z; Tue, 29 Apr 2014 00:15:29 +0200 From: Peter Seiderer To: buildroot@busybox.net Date: Tue, 29 Apr 2014 00:15:28 +0200 Message-Id: <1398723328-11107-1-git-send-email-ps.report@gmx.net> X-Mailer: git-send-email 1.8.1.4 X-Provags-ID: V03:K0:W2xfL271qFT2Rz61twy9yx03HOeBqPQmoFP6FXdCujXvd+rSW+P 8AomhBWR1mt4BebHZnfqxS6WESLV8zXsIhNuf9sn8tEWk8N4fCavF8w6GLnoqe5zINtOIXU h68KxBtEMaQS/mfa38P7gNNwqB0/xRu1pjm33XtZV+di4KQbb3+5+ktcjE5D25lXFyLW1al x1Adie3txAgJaykPSMtjg== Cc: Peter Korsgaard Subject: [Buildroot] [Patch v2 4/4] evemu: enable python3 bindings X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net Add evemu/python3 related patches: - fix python/evemu/base.py for python3 (add patch from [1]) - fix python3 binding runtime failure [1] http://ftp.de.debian.org/debian/pool/main/e/evemu/evemu_1.2.0-2.debian.tar.xz Signed-off-by: Peter Seiderer --- Changes v1 -> v2: - use original debian patch - remove patch numbering from patch subject (Arnout Vandecappelle) --- ...-fixes-the-syntax-for-raising-exceptions-.patch | 27 +++++++++++++++++ ...u-0007-python-fix-device-open-for-python3.patch | 35 ++++++++++++++++++++++ package/evemu/evemu.mk | 7 ++--- 3 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 package/evemu/evemu-0006-Description-fixes-the-syntax-for-raising-exceptions-.patch create mode 100644 package/evemu/evemu-0007-python-fix-device-open-for-python3.patch diff --git a/package/evemu/evemu-0006-Description-fixes-the-syntax-for-raising-exceptions-.patch b/package/evemu/evemu-0006-Description-fixes-the-syntax-for-raising-exceptions-.patch new file mode 100644 index 0000000..cf3da8b --- /dev/null +++ b/package/evemu/evemu-0006-Description-fixes-the-syntax-for-raising-exceptions-.patch @@ -0,0 +1,27 @@ +Description: fixes the syntax for raising exceptions to be Python2 and Python3 + acceptable. +Author: Stephen M. Webb +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=706155 + +--- a/python/evemu/base.py ++++ b/python/evemu/base.py +@@ -19,15 +19,15 @@ + def _call0(self, api_call, *parameters): + result = api_call(*parameters) + if result == 0 and self.get_c_errno() != 0: +- raise exception.ExecutionError, "%s: %s" % ( +- api_call.__name__, self.get_c_error()) ++ raise exception.ExecutionError("%s: %s" % ( ++ api_call.__name__, self.get_c_error())) + return result + + def _call(self, api_call, *parameters): + result = api_call(*parameters) + if result < 0 and self.get_c_errno() != 0: +- raise exception.ExecutionError, "%s: %s" % ( +- api_call.__name__, self.get_c_error()) ++ raise exception.ExecutionError("%s: %s" % ( ++ api_call.__name__, self.get_c_error())) + return result + + def get_c_errno(self): diff --git a/package/evemu/evemu-0007-python-fix-device-open-for-python3.patch b/package/evemu/evemu-0007-python-fix-device-open-for-python3.patch new file mode 100644 index 0000000..ec989d2 --- /dev/null +++ b/package/evemu/evemu-0007-python-fix-device-open-for-python3.patch @@ -0,0 +1,35 @@ +From f192db7848962a1616e243bb60e705da6c6f3412 Mon Sep 17 00:00:00 2001 +From: Peter Seiderer +Date: Sun, 27 Apr 2014 01:16:16 +0200 +Subject: [PATCH] python: fix device open for python3 + +- use 'rb' instead of 'r+b', fixes: + +>>> import evemu +>>> evemu.Device('/dev/input/event0') +Traceback (most recent call last): + File "", line 1, in + File "/usr/lib/python3.4/site-packages/evemu/__init__.py", line 50, in __init__ +io.UnsupportedOperation: File or stream is not seekable. + +Signed-off-by: Peter Seiderer +--- + python/evemu/__init__.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/python/evemu/__init__.py b/python/evemu/__init__.py +index abdbf7e..aa73871 100644 +--- a/python/evemu/__init__.py ++++ b/python/evemu/__init__.py +@@ -47,7 +47,7 @@ class Device(object): + """ + + if type(f).__name__ == 'str': +- self._file = open(f, 'r+b') ++ self._file = open(f, 'rb') + elif type(f).__name__ == 'file': + self._file = f + else: +-- +1.8.1.4 + diff --git a/package/evemu/evemu.mk b/package/evemu/evemu.mk index 9ff9922..9f7f4af 100644 --- a/package/evemu/evemu.mk +++ b/package/evemu/evemu.mk @@ -27,11 +27,10 @@ EVEMU_DEPENDENCIES = host-pkgconf libevdev # Needs Python for header file generation EVEMU_DEPENDENCIES += $(if $(BR2_PACKAGE_PYTHON3),host-python3,host-python) -# Check for target python (python3 bindings disabled because -# of build/byte-compile problems) -ifeq ($(BR2_PACKAGE_PYTHON),y) +# Check for target python +ifeq ($(BR2_PACKAGE_PYTHON)$(BR2_PACKAGE_PYTHON3),y) EVEMU_CONF_OPT += --enable-python-bindings -EVEMU_DEPENDENCIES += python +EVEMU_DEPENDENCIES += $(if $(BR2_PACKAGE_PYTHON3),python3,python) else EVEMU_CONF_OPT += --disable-python-bindings endif