All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] trying to add python-smbus-cffi, but installing fails
@ 2015-03-13 17:08 ir. Tjeerd Pinkert
  2015-03-13 17:22 ` Yegor Yefremov
  0 siblings, 1 reply; 8+ messages in thread
From: ir. Tjeerd Pinkert @ 2015-03-13 17:08 UTC (permalink / raw)
  To: buildroot

Hi,

I was trying to install the python smbus-cffi as a package (currently in 
my BR2_EXTERNAL directory) but installation fails.

It looks like the package is trying to load itself to register, but of 
course it fails because I think the host python loads this, and can not 
load the _cffi_backend.so compiled for the target?

Anyone an idea how to get solve this chicken egg problem?

This is the part where the install script fails:
Installed 
/local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/pycparser-2.10-py2.7.egg
Traceback (most recent call last):
   File "setup.py", line 7, in <module>
     import smbus
   File 
"/local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/smbus/__init__.py", 
line 1, in <module>
     from .smbus import ffi
   File 
"/local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/smbus/smbus.py", 
line 40, in <module>
     ffi = FFI()
   File 
"/opt/freescale/buildroot/output/target/usr/lib/python2.7/site-packages/cffi/api.py", 
line 56, in __init__
     import _cffi_backend as backend
ImportError: 
/opt/freescale/buildroot/output/target/usr/lib/python2.7/site-packages/_cffi_backend.so: 
wrong ELF class: ELFCLASS32
make: *** 
[/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/.stamp_built] 
Error 1

I include here the Buildroot scripts for installation, which should make 
it easy to test for others. (I think the 
PYTHON_SMBUS_CFFI_INSTALL_TARGET_OPTS = install is not needed, but it 
also fails without this)



Best regards,


Tjeerd Pinkert
-------------- next part --------------
config BR2_PACKAGE_PYTHON_SMBUS_CFFI
	bool "python-smbus-cffi"
	depends on BR2_PACKAGE_PYTHON_CFFI
	help
	  This Python module allows SMBus access through the I2C /dev interface
	  on Linux hosts. The host kernel must have I2C support, I2C device
	  interface support, and a bus adapter driver.

	  This module is a cffi-based python reimplementation of the
	  python-smbus C-extension (http://www.lm-sensors.org/browser
	  /i2c-tools/trunk/py-smbus/) and works on PyPy and CPython (2.6
	  and up).

	  https://pypi.python.org/pypi/smbus-cffi/
-------------- next part --------------
################################################################################
#
# python-smbus-cffi
#
################################################################################

PYTHON_SMBUS_CFFI_VERSION = 0.4.1
PYTHON_SMBUS_CFFI_SOURCE = smbus-cffi-$(PYTHON_SMBUS_CFFI_VERSION).tar.gz
PYTHON_SMBUS_CFFI_SITE = https://pypi.python.org/packages/source/s/smbus-cffi
PYTHON_SMBUS_CFFI_SETUP_TYPE = setuptools
PYTHON_SMBUS_CFFI_INSTALL_TARGET_OPTS = install
PYTHON_SMBUS_CFFI_DEPENDENCIES = host-pkgconf libffi python-cffi
PYTHON_SMBUS_CFFI_LICENSE = GPLv2
PYTHON_SMBUS_CFFI_LICENSE_FILES = LICENSE

$(eval $(python-package))

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] trying to add python-smbus-cffi, but installing fails
  2015-03-13 17:08 [Buildroot] trying to add python-smbus-cffi, but installing fails ir. Tjeerd Pinkert
@ 2015-03-13 17:22 ` Yegor Yefremov
  2015-03-13 17:34   ` Yegor Yefremov
  0 siblings, 1 reply; 8+ messages in thread
From: Yegor Yefremov @ 2015-03-13 17:22 UTC (permalink / raw)
  To: buildroot

On Fri, Mar 13, 2015 at 6:08 PM, ir. Tjeerd Pinkert <t.j.pinkert@vu.nl> wrote:
> Hi,
>
> I was trying to install the python smbus-cffi as a package (currently in my
> BR2_EXTERNAL directory) but installation fails.
>
> It looks like the package is trying to load itself to register, but of
> course it fails because I think the host python loads this, and can not load
> the _cffi_backend.so compiled for the target?
>
> Anyone an idea how to get solve this chicken egg problem?
>
> This is the part where the install script fails:
> Installed
> /local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/pycparser-2.10-py2.7.egg
> Traceback (most recent call last):
>   File "setup.py", line 7, in <module>
>     import smbus
>   File
> "/local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/smbus/__init__.py",
> line 1, in <module>
>     from .smbus import ffi
>   File
> "/local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/smbus/smbus.py",
> line 40, in <module>
>     ffi = FFI()
>   File
> "/opt/freescale/buildroot/output/target/usr/lib/python2.7/site-packages/cffi/api.py",
> line 56, in __init__
>     import _cffi_backend as backend
> ImportError:
> /opt/freescale/buildroot/output/target/usr/lib/python2.7/site-packages/_cffi_backend.so:
> wrong ELF class: ELFCLASS32
> make: ***
> [/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/.stamp_built]
> Error 1
>
> I include here the Buildroot scripts for installation, which should make it
> easy to test for others. (I think the PYTHON_SMBUS_CFFI_INSTALL_TARGET_OPTS
> = install is not needed, but it also fails without this)

Looks like the problem with python-cryptography:
https://github.com/pyca/cryptography/issues/1325 See the last post.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] trying to add python-smbus-cffi, but installing fails
  2015-03-13 17:22 ` Yegor Yefremov
@ 2015-03-13 17:34   ` Yegor Yefremov
  2015-03-16 18:43     ` ir. Tjeerd Pinkert
  0 siblings, 1 reply; 8+ messages in thread
From: Yegor Yefremov @ 2015-03-13 17:34 UTC (permalink / raw)
  To: buildroot

On Fri, Mar 13, 2015 at 6:22 PM, Yegor Yefremov
<yegorslists@googlemail.com> wrote:
> On Fri, Mar 13, 2015 at 6:08 PM, ir. Tjeerd Pinkert <t.j.pinkert@vu.nl> wrote:
>> Hi,
>>
>> I was trying to install the python smbus-cffi as a package (currently in my
>> BR2_EXTERNAL directory) but installation fails.
>>
>> It looks like the package is trying to load itself to register, but of
>> course it fails because I think the host python loads this, and can not load
>> the _cffi_backend.so compiled for the target?
>>
>> Anyone an idea how to get solve this chicken egg problem?
>>
>> This is the part where the install script fails:
>> Installed
>> /local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/pycparser-2.10-py2.7.egg
>> Traceback (most recent call last):
>>   File "setup.py", line 7, in <module>
>>     import smbus
>>   File
>> "/local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/smbus/__init__.py",
>> line 1, in <module>
>>     from .smbus import ffi
>>   File
>> "/local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/smbus/smbus.py",
>> line 40, in <module>
>>     ffi = FFI()
>>   File
>> "/opt/freescale/buildroot/output/target/usr/lib/python2.7/site-packages/cffi/api.py",
>> line 56, in __init__
>>     import _cffi_backend as backend
>> ImportError:
>> /opt/freescale/buildroot/output/target/usr/lib/python2.7/site-packages/_cffi_backend.so:
>> wrong ELF class: ELFCLASS32
>> make: ***
>> [/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/.stamp_built]
>> Error 1
>>
>> I include here the Buildroot scripts for installation, which should make it
>> easy to test for others. (I think the PYTHON_SMBUS_CFFI_INSTALL_TARGET_OPTS
>> = install is not needed, but it also fails without this)
>
> Looks like the problem with python-cryptography:
> https://github.com/pyca/cryptography/issues/1325 See the last post.

In this thread someone mentions a dirty workaround via installing cffi
on host: https://github.com/pyca/bcrypt/issues/34

Will try it, if I have enough time.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] trying to add python-smbus-cffi, but installing fails
  2015-03-13 17:34   ` Yegor Yefremov
@ 2015-03-16 18:43     ` ir. Tjeerd Pinkert
  2015-03-17 11:11       ` [Buildroot] [Patch] Added package python-smbus ir. Tjeerd Pinkert
  0 siblings, 1 reply; 8+ messages in thread
From: ir. Tjeerd Pinkert @ 2015-03-16 18:43 UTC (permalink / raw)
  To: buildroot

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




On 13-03-15 18:34, Yegor Yefremov wrote:
> On Fri, Mar 13, 2015 at 6:22 PM, Yegor Yefremov
> <yegorslists@googlemail.com> wrote:
>> On Fri, Mar 13, 2015 at 6:08 PM, ir. Tjeerd Pinkert <t.j.pinkert@vu.nl> wrote:
>>> Hi,
>>>
>>> I was trying to install the python smbus-cffi as a package (currently in my
>>> BR2_EXTERNAL directory) but installation fails.
>>>
>>> It looks like the package is trying to load itself to register, but of
>>> course it fails because I think the host python loads this, and can not load
>>> the _cffi_backend.so compiled for the target?
>>>
>>> Anyone an idea how to get solve this chicken egg problem?
>>>
>>> This is the part where the install script fails:
>>> Installed
>>> /local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/pycparser-2.10-py2.7.egg
>>> Traceback (most recent call last):
>>>    File "setup.py", line 7, in <module>
>>>      import smbus
>>>    File
>>> "/local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/smbus/__init__.py",
>>> line 1, in <module>
>>>      from .smbus import ffi
>>>    File
>>> "/local/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/smbus/smbus.py",
>>> line 40, in <module>
>>>      ffi = FFI()
>>>    File
>>> "/opt/freescale/buildroot/output/target/usr/lib/python2.7/site-packages/cffi/api.py",
>>> line 56, in __init__
>>>      import _cffi_backend as backend
>>> ImportError:
>>> /opt/freescale/buildroot/output/target/usr/lib/python2.7/site-packages/_cffi_backend.so:
>>> wrong ELF class: ELFCLASS32
>>> make: ***
>>> [/opt/freescale/buildroot/output/build/python-smbus-cffi-0.4.1/.stamp_built]
>>> Error 1
>>>
>>> I include here the Buildroot scripts for installation, which should make it
>>> easy to test for others. (I think the PYTHON_SMBUS_CFFI_INSTALL_TARGET_OPTS
>>> = install is not needed, but it also fails without this)
>>
>> Looks like the problem with python-cryptography:
>> https://github.com/pyca/cryptography/issues/1325 See the last post.
>
> In this thread someone mentions a dirty workaround via installing cffi
> on host: https://github.com/pyca/bcrypt/issues/34
>
> Will try it, if I have enough time.
>
-------------- next part --------------
config BR2_PACKAGE_I2C_TOOLS
	bool "i2c-tools"
	help
	  Heterogeneous set of I2C tools for Linux

	  This package contains a heterogeneous set of I2C tools for Linux:
	  a bus probing tool, a chip dumper, register-level access helpers,
	  EEPROM decoding scripts, and more.

	  http://www.lm-sensors.org/wiki/I2CTools

if BR2_PACKAGE_I2C_TOOLS
	config BR2_PACKAGE_I2C_TOOLS_PYTHON
	bool "Python bindings for the i2c-tools, py-smbus"
	select BR2_PACKAGE_PYTHON
	help
	  Python bindings for the i2c-tools package. This is the
	  python-smbus extention.
endif
-------------- next part --------------
################################################################################
#
# i2c-tools
#
################################################################################

I2C_TOOLS_VERSION = 3.1.1
I2C_TOOLS_SOURCE = i2c-tools-$(I2C_TOOLS_VERSION).tar.bz2
I2C_TOOLS_SITE = http://dl.lm-sensors.org/i2c-tools/releases
I2C_TOOLS_LICENSE = GPLv2+, GPLv2 (py-smbus)
I2C_TOOLS_LICENSE_FILES = COPYING

I2C_TOOLS_EXTRA =
#ifeq ($(BR2_PACKAGE_I2C_TOOLS_PYTHON),y)
#I2C_TOOLS_EXTRA = py-smbus
#I2C_TOOLS_DEPENDENCIES += python
#endif

define I2C_TOOLS_BUILD_CMDS
	$(MAKE) EXTRA=$(I2C_TOOLS_EXTRA) $(TARGET_CONFIGURE_OPTS) -C $(@D)
endef

define I2C_TOOLS_INSTALL_TARGET_CMDS
	for i in i2cdump i2cget i2cset i2cdetect; \
	do \
		$(INSTALL) -m 755 -D $(@D)/tools/$$i $(TARGET_DIR)/usr/bin/$$i; \
	done
endef

$(eval $(generic-package))
-------------- next part --------------
################################################################################
#
# py-smbus (i2c-tools python bindings)
#
################################################################################

ifeq ($(BR2_PACKAGE_I2C_TOOLS_PYTHON),y)

PYTHON_I2C_TOOLS_VERSION = 3.1.1
PYTHON_I2C_TOOLS_SOURCE = i2c-tools-$(PYTHON_I2C_TOOLS_VERSION).tar.bz2
PYTHON_I2C_TOOLS_SITE = http://downloads.sourceforge.net/project/pyalsaaudio
PYTHON_I2C_TOOLS_SETUP_TYPE = distutils
PYTHON_I2C_TOOLS_LICENSE = GPLv2
PYTHON_I2C_TOOLS_LICENSE_FILES = COPYING
PYTHON_I2C_TOOLS_DEPENDENCIES = i2c-tools

$(eval $(python-package))

endif

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [Patch] Added package python-smbus
  2015-03-16 18:43     ` ir. Tjeerd Pinkert
@ 2015-03-17 11:11       ` ir. Tjeerd Pinkert
  2015-03-17 11:37         ` Zoltan Gyarmati
  2015-04-05 18:11         ` Ryan Barnett
  0 siblings, 2 replies; 8+ messages in thread
From: ir. Tjeerd Pinkert @ 2015-03-17 11:11 UTC (permalink / raw)
  To: 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 --
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))




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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [Patch] Added package python-smbus
  2015-03-17 11:11       ` [Buildroot] [Patch] Added package python-smbus ir. Tjeerd Pinkert
@ 2015-03-17 11:37         ` Zoltan Gyarmati
  2015-03-17 14:12           ` ir. Tjeerd Pinkert
  2015-04-05 18:11         ` Ryan Barnett
  1 sibling, 1 reply; 8+ messages in thread
From: Zoltan Gyarmati @ 2015-03-17 11:37 UTC (permalink / raw)
  To: buildroot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear Tjeerd,

sorry, i didn't spot your thread yesterday, actually I just posted a
python-smbus patch a couple of weeks back, see here:
http://patchwork.ozlabs.org/patch/435345/

Right now i can't test your patch, but for first sight it seems to be
OK. I also considered to integrate it into the i2c-tools package, but
imho it's reasonable to handle it as an external python module, as you
did as well.

Regards
zgyarmati

On 17.03.2015 12:11, ir. Tjeerd Pinkert wrote:
> 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 -- 
> 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))
> 
> 
> 
> 
> 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
> _______________________________________________ buildroot mailing
> list buildroot at busybox.net 
> http://lists.busybox.net/mailman/listinfo/buildroot

- -- 
Bests,
Zoltan Gyarmati
IRC freenode: zgyarmati
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJVCBHsAAoJEAGmEeeR8iVhbEMH/0VVl37kKph96e5fdErI7ssF
trBbexvhSNMeLCsaD41k6s02p3rHxRsoU7/YNXyTZYBWatPfdvtWHhbxkakP8h1x
8cLvjyp4BanZLHrIPFeM/wRVWRd7mAV8DNnl58EfyE7NdGco4krQreXhi22y+eYz
zmLcAd7gQsvuR7hm/8wp89U9ORVTfQN9YXH8U5SaiL5gKxtwH19v/egkW1d0M033
kQE6qvIP+zvcB8ROjrybkTnP0lS4PliKEmaR8uqjHPy405nl6nfOLCCQNIVxNDVy
HpXzFz14brfYAFMrsz8qBgeyy/Sl4ZMw9shzuXCHPYrAwxr3I4loQd4V1Lgt9hg=
=xzEs
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [Patch] Added package python-smbus
  2015-03-17 11:37         ` Zoltan Gyarmati
@ 2015-03-17 14:12           ` ir. Tjeerd Pinkert
  0 siblings, 0 replies; 8+ messages in thread
From: ir. Tjeerd Pinkert @ 2015-03-17 14:12 UTC (permalink / raw)
  To: buildroot

Dear Zoltan,

I missed your patch as well, so don't worry. It probably depends on the 
fact if adding to the TARGET_CFLAGS is considered sane, in that case no 
extra file/file modification is needed which might make things less 
prone to error? I would be fine with both approaches.

I think your way of handling the source definitions is preferable, since 
that gives only one place where the source is defined.

Best regards,


Tjeerd Pinkert

On 17-03-15 12:37, Zoltan Gyarmati wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Dear Tjeerd,
>
> sorry, i didn't spot your thread yesterday, actually I just posted a
> python-smbus patch a couple of weeks back, see here:
> http://patchwork.ozlabs.org/patch/435345/
>
> Right now i can't test your patch, but for first sight it seems to be
> OK. I also considered to integrate it into the i2c-tools package, but
> imho it's reasonable to handle it as an external python module, as you
> did as well.
>
> Regards
> zgyarmati
>
> On 17.03.2015 12:11, ir. Tjeerd Pinkert wrote:
>> 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 --
>> 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))
>>
>>
>>
>>
>> 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
>> _______________________________________________ buildroot mailing
>> list buildroot at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
>
> - --
> Bests,
> Zoltan Gyarmati
> IRC freenode: zgyarmati
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
>
> iQEcBAEBAgAGBQJVCBHsAAoJEAGmEeeR8iVhbEMH/0VVl37kKph96e5fdErI7ssF
> trBbexvhSNMeLCsaD41k6s02p3rHxRsoU7/YNXyTZYBWatPfdvtWHhbxkakP8h1x
> 8cLvjyp4BanZLHrIPFeM/wRVWRd7mAV8DNnl58EfyE7NdGco4krQreXhi22y+eYz
> zmLcAd7gQsvuR7hm/8wp89U9ORVTfQN9YXH8U5SaiL5gKxtwH19v/egkW1d0M033
> kQE6qvIP+zvcB8ROjrybkTnP0lS4PliKEmaR8uqjHPy405nl6nfOLCCQNIVxNDVy
> HpXzFz14brfYAFMrsz8qBgeyy/Sl4ZMw9shzuXCHPYrAwxr3I4loQd4V1Lgt9hg=
> =xzEs
> -----END PGP SIGNATURE-----
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [Patch] Added package python-smbus
  2015-03-17 11:11       ` [Buildroot] [Patch] Added package python-smbus ir. Tjeerd Pinkert
  2015-03-17 11:37         ` Zoltan Gyarmati
@ 2015-04-05 18:11         ` Ryan Barnett
  1 sibling, 0 replies; 8+ messages in thread
From: Ryan Barnett @ 2015-04-05 18:11 UTC (permalink / raw)
  To: buildroot

Hi Tjeerd,

On Tue, Mar 17, 2015 at 6:11 AM, ir. Tjeerd Pinkert <t.j.pinkert@vu.nl> wrote:
> 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

For the future reference, can you please send patches using git? For
more information on this, please see the manual.

http://nightly.buildroot.org/manual.html#submitting-patches

[...]

> 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

Since you are using i2c-tools package itself, an option should be
added to this package to build and install the python bindings. I was
going to attempt to try to explain the way to do this but it turned
out that it was completely different than what is proposed here. I
will be pushing this out here shortly and would appreciate if you
could test this new patch out.

> +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))

Thanks,
-Ryan

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-05 18:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13 17:08 [Buildroot] trying to add python-smbus-cffi, but installing fails ir. Tjeerd Pinkert
2015-03-13 17:22 ` Yegor Yefremov
2015-03-13 17:34   ` Yegor Yefremov
2015-03-16 18:43     ` ir. Tjeerd Pinkert
2015-03-17 11:11       ` [Buildroot] [Patch] Added package python-smbus ir. Tjeerd Pinkert
2015-03-17 11:37         ` Zoltan Gyarmati
2015-03-17 14:12           ` ir. Tjeerd Pinkert
2015-04-05 18:11         ` Ryan Barnett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.