From patchwork Tue Mar 17 11:11:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "ir. Tjeerd Pinkert" X-Patchwork-Id: 450941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 9E206140172 for ; Tue, 17 Mar 2015 22:11:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id AC0D7335B7; Tue, 17 Mar 2015 11:11:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CI5YaRSBIGJH; Tue, 17 Mar 2015 11:11:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 651F032044; Tue, 17 Mar 2015 11:11:52 +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 945BB1C20E8 for ; Tue, 17 Mar 2015 11:11:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 90ACE91889 for ; Tue, 17 Mar 2015 11:11:50 +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 7rwFYKlJoprd for ; Tue, 17 Mar 2015 11:11:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mailin.vu.nl (mailin.vu.nl [130.37.164.19]) by whitealder.osuosl.org (Postfix) with ESMTPS id 7FD7391843 for ; Tue, 17 Mar 2015 11:11:48 +0000 (UTC) Received: from PEXHB012B.vu.local (130.37.236.67) by mailin.vu.nl (130.37.164.19) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 17 Mar 2015 12:11:47 +0100 Received: from [145.108.172.20] (130.37.253.20) by mails.vu.nl (130.37.236.67) with Microsoft SMTP Server id 14.3.224.2; Tue, 17 Mar 2015 12:11:45 +0100 Message-ID: <55080BF0.1020108@vu.nl> Date: Tue, 17 Mar 2015 12:11:44 +0100 From: "ir. Tjeerd Pinkert" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 MIME-Version: 1.0 To: "buildroot@busybox.net" References: <5503198F.6070804@vu.nl> <5507244E.2080009@vu.nl> In-Reply-To: <5507244E.2080009@vu.nl> X-Originating-IP: [130.37.253.20] Subject: [Buildroot] [Patch] Added package python-smbus X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Hi all, I managed to add a package python-smbus that installs the i2c-tools py-smbus extension so that i2c can be used under python. Most probably it is better to integrate this somehow into the i2c-tools scripts but this is the first onset of getting it working. Hints on how to best integrate, if regarded necessary, are welcome. Best regards, Tjeerd Pinkert buildroot$ git diff 6bf057b0f2ba188397a691f74877a4a30aaea3f9 -- On 16-03-15 19:43, ir. Tjeerd Pinkert wrote: > Since I'm quite new to Buildroot, I am trying to understand how to do > things and how this thing works by reading the manual and source code. > > I have been trying further on the python-smbus-cffi today, but > python-cffi seems to be fundamentally broken according to the internet. > Since my host machine does not yet have the python-cffi package (Debian > Stable), I could not pursue that path further. > > Next I tried to get the py-smbus from the i2c-tools package compiled. > Unfortunately unsuccessful. To compile the py-smbus package one normally > adds the EXTRA=py-smbus to the make command. I did that by adding an > option to the configuration menu and then trying to compile via a > modified makefile, but that goes wrong. > > I figured I needed a python-package makefile. Simply adding one to the > package directory then seems to be logical, but somehow does not work > because > > 1. I need to call 'make' from the subdirectory py-smbus. > 2. I get a funny error, probably I don't understand the make system good > enough yet. > > I get the following compilation error, I attached the scripts to this > email, but, what would be the correct approach for this type of > (sub)package compilation? Help is highly appreciated. > > error: > package/i2c-tools/i2c-tools-python.mk:17: *** "I2C_TOOLS_SETUP_TYPE must > be set". Stop. > > Best regards, > > > Tjeerd Pinkert diff --git a/package/Config.in b/package/Config.in index 262a7fb..7ef7149 100644 --- a/package/Config.in +++ b/package/Config.in @@ -525,6 +525,7 @@ menu "external python modules" source "package/python-flup/Config.in" source "package/python-gobject/Config.in" source "package/python-httplib2/Config.in" + source "package/python-smbus/Config.in" source "package/python-id3/Config.in" source "package/python-ipaddr/Config.in" source "package/python-ipy/Config.in" diff --git a/package/python-smbus/Config.in b/package/python-smbus/Config.in new file mode 100644 index 0000000..d53b0af --- /dev/null +++ b/package/python-smbus/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_PYTHON_SMBUS + bool "python-smbus" + depends on BR2_PACKAGE_I2C_TOOLS + help + Python bindings to smbus from the i2c-tools package + + http://www.lm-sensors.org/wiki/I2CTools + + pyhton-smbus needs i2c-tools diff --git a/package/python-smbus/python-smbus.mk b/package/python-smbus/python-smbus.mk new file mode 100644 index 0000000..1673e6a --- /dev/null +++ b/package/python-smbus/python-smbus.mk @@ -0,0 +1,18 @@ +################################################################################ +# +# python-smbus (i2c-tools python bindings) +# +################################################################################ + +PYTHON_SMBUS_VERSION = 3.1.1 +PYTHON_SMBUS_SOURCE = i2c-tools-$(PYTHON_SMBUS_VERSION).tar.bz2 +PYTHON_SMBUS_SITE = http://dl.lm-sensors.org/i2c-tools/releases +PYTHON_SMBUS_SETUP_TYPE = distutils +PYTHON_SMBUS_LICENSE = GPLv2 +PYTHON_SMBUS_LICENSE_FILES = COPYING +PYTHON_SMBUS_DEPENDENCIES = i2c-tools +PYTHON_SMBUS_SUBDIR=py-smbus + +TARGET_CFLAGS += -I../include + +$(eval $(python-package))