Skip to contentSkip to conversation

python-pylibftdi new package

PATCH Superseded Christian Kellermann 4 participants 11 messages Feb 27, 2017 – Mar 6, 2017

lore
Share & tools
lore
#0 lore raw

cover python-pylibftdi new package

Dear List,

This patch adds the python binding for libftdi. However it contains a hackish patch which I would like to discuss. Pylibftdi uses the ctypes find_library call to find the libusb and libftdi libraries. This in turn seems to rely on ldconfig which is not part of buildroot.

Patching it out here seems to work fine, but this kind of hides the general problem of fixing find_library in the python package. How would one do this properly?

Thanks,

Christian

Christian Kellermann (1):
libftdi: new package

 package/Config.in                                         |  1 +
 .../python-pylibftdi/0001-do-not-use-find-library.patch   | 14 ++++++++++++++
 package/python-pylibftdi/Config.in                        | 13 +++++++++++++
 package/python-pylibftdi/python-libftdi.hash              |  3 +++
 package/python-pylibftdi/python-libftdi.mk                | 15 +++++++++++++++
 5 files changed, 46 insertions(+)
 create mode 100644 package/python-pylibftdi/0001-do-not-use-find-library.patch
 create mode 100644 package/python-pylibftdi/Config.in
 create mode 100644 package/python-pylibftdi/python-libftdi.hash
 create mode 100644 package/python-pylibftdi/python-libftdi.mk
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 libftdi: new package

---
 package/Config.in                                         |  1 +
 .../python-pylibftdi/0001-do-not-use-find-library.patch   | 14 ++++++++++++++
 package/python-pylibftdi/Config.in                        | 13 +++++++++++++
 package/python-pylibftdi/python-libftdi.hash              |  3 +++
 package/python-pylibftdi/python-libftdi.mk                | 15 +++++++++++++++
 5 files changed, 46 insertions(+)
 create mode 100644 package/python-pylibftdi/0001-do-not-use-find-library.patch
 create mode 100644 package/python-pylibftdi/Config.in
 create mode 100644 package/python-pylibftdi/python-libftdi.hash
 create mode 100644 package/python-pylibftdi/python-libftdi.mk
package/Config.in +1 -0
index deff0fe..452ff0d 100644
@@ -765,6 +765,7 @@ menu "External python modules"
 	source "package/python-pygments/Config.in"
 	source "package/python-pyicu/Config.in"
 	source "package/python-pyinotify/Config.in"
+        source "package/python-pylibftdi/Config.in"
 	source "package/python-pylru/Config.in"
 	source "package/python-pymysql/Config.in"
 	source "package/python-pynacl/Config.in"
package/python-pylibftdi/0001-do-not-use-find-library.patch new file +14 -0
new file mode 100644
index 0000000..2f17dc6
@@ -0,0 +1,14 @@
+diff -purN pylibftdi-0.15.0.orig/pylibftdi/driver.py pylibftdi-0.15.0/pylibftdi/driver.py
+--- pylibftdi-0.15.0.orig/pylibftdi/driver.py	2015-04-26 22:41:39.000000000 +0200
++++ pylibftdi-0.15.0/pylibftdi/driver.py	2017-02-27 13:08:56.502958000 +0100
+@@ -121,8 +121,8 @@ class Driver(object):
+                     lib = getattr(cdll, lib_path)
+                     break
+         if lib is None:
+-            raise LibraryMissingError('{} library not found (search: {})'.format(
+-                name, search_list))
++		return cdll.LoadLibrary(name + '.so')
++
+         return lib
+ 
+     @property
package/python-pylibftdi/Config.in new file +13 -0
new file mode 100644
index 0000000..36e3fac
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_PYTHON_PYLIBFTDI
+	bool "python-pylibftdi"
+	select BR2_PACKAGE_LIBFTDI
+        depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
+
+	help
+	  This package contains the python language binding libftdi.
+
+	  https://pypi.python.org/pypi/pylibftdi
+
+comment "python-pylibftdi needs a toolchain w/ threads"
+	depends on BR2_PACKAGE_PYTHON
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/python-pylibftdi/python-libftdi.hash new file +3 -0
new file mode 100644
index 0000000..54b33a1
@@ -0,0 +1,3 @@
+# md5 from https://pypi.python.org/pypi/pylibftdi/json, sha256 locally computed
+md5  eaee7fb3a67f33a35a164a9628daaafe pylibftdi-0.15.0.tar.gz
+sha256  51ef08ebcc4ec3eaec2366e9648d3f8fa1b737ea507a7f3a374ac58abf148e77 pylibftdi-0.15.0.tar.gz
package/python-pylibftdi/python-libftdi.mk new file +15 -0
new file mode 100644
index 0000000..b934c03
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-libftdi
+#
+################################################################################
+
+PYTHON_PYLIBFTDI_VERSION = 0.15.0
+PYTHON_PYLIBFTDI_SOURCE = pylibftdi-$(PYTHON_PYLIBFTDI_VERSION).tar.gz
+PYTHON_PYLIBFTDI_SITE = https://pypi.python.org/packages/e5/bb/d7a86dbd7685e3866ea75d21c6c726d01706fdc0aa5dc9051ce18ae65693
+PYTHON_PYLIBFTDI_LICENSE = MIT
+PYTHON_PYLIBFTDI_LICENSE_FILES = LICENSE.txt
+PYTHON_PYLIBFTDI_DEPENDENCIES =libftdi
+PYTHON_PYLIBFTDI_SETUP_TYPE = distutils
+
+$(eval $(python-package))
Signature · 1 line
2.1.4
#2 lore raw

PATCH 1/1 libftdi: new package

Hi Christian,

patch title should be python-pylibftdi and not libftdi

Quoted 35 lines · Christian Kellermann
---
 package/Config.in                                         |  1 +
 .../python-pylibftdi/0001-do-not-use-find-library.patch   | 14 ++++++++++++++
 package/python-pylibftdi/Config.in                        | 13 +++++++++++++
 package/python-pylibftdi/python-libftdi.hash              |  3 +++
 package/python-pylibftdi/python-libftdi.mk                | 15 +++++++++++++++
 5 files changed, 46 insertions(+)
 create mode 100644 package/python-pylibftdi/0001-do-not-use-find-library.patch
 create mode 100644 package/python-pylibftdi/Config.in
 create mode 100644 package/python-pylibftdi/python-libftdi.hash
 create mode 100644 package/python-pylibftdi/python-libftdi.mk
package/Config.in +1 -0
index deff0fe..452ff0d 100644
@@ -765,6 +765,7 @@ menu "External python modules"
        source "package/python-pygments/Config.in"
        source "package/python-pyicu/Config.in"
        source "package/python-pyinotify/Config.in"
+        source "package/python-pylibftdi/Config.in"
        source "package/python-pylru/Config.in"
        source "package/python-pymysql/Config.in"
        source "package/python-pynacl/Config.in"
package/python-pylibftdi/0001-do-not-use-find-library.patch new file +4 -0
new file mode 100644
index 0000000..2f17dc6
@@ -0,0 +1,14 @@
+diff -purN pylibftdi-0.15.0.orig/pylibftdi/driver.py pylibftdi-0.15.0/pylibftdi/driver.py
+--- pylibftdi-0.15.0.orig/pylibftdi/driver.py  2015-04-26 22:41:39.000000000 +0200
++++ pylibftdi-0.15.0/pylibftdi/driver.py       2017-02-27 13:08:56.502958000 +0100
+@@ -121,8 +121,8 @@ class Driver(object):

package/python-pylibftdi/0001-do-not-use-find-library.patch line 14

Quoted 10 lines
package/python-pylibftdi/0001-do-not-use-find-library.patch new file +10 -0
+                     lib = getattr(cdll, lib_path)
+                     break
+         if lib is None:
+-            raise LibraryMissingError('{} library not found (search: {})'.format(
+-                name, search_list))
++              return cdll.LoadLibrary(name + '.so')
++
+         return lib
+
+     @property

A patch needs proper title, commit message and your SoB

package/python-pylibftdi/Config.in line 5

Quoted 11 lines
package/python-pylibftdi/Config.in new file +5 -0
new file mode 100644
index 0000000..36e3fac
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_PYTHON_PYLIBFTDI
+       bool "python-pylibftdi"
+       select BR2_PACKAGE_LIBFTDI
+        depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
+

no newline here

package/python-pylibftdi/Config.in line 12

Quoted 7 lines
package/python-pylibftdi/Config.in new file +7 -0
+       help
+         This package contains the python language binding libftdi.
+
+         https://pypi.python.org/pypi/pylibftdi
+
+comment "python-pylibftdi needs a toolchain w/ threads"
+       depends on BR2_PACKAGE_PYTHON

drop this dependency

Quoted 19 lines
package/python-pylibftdi/Config.in new file +1 -0
+       depends on !BR2_TOOLCHAIN_HAS_THREADS
package/python-pylibftdi/python-libftdi.hash new file +3 -0
new file mode 100644
index 0000000..54b33a1
@@ -0,0 +1,3 @@
+# md5 from https://pypi.python.org/pypi/pylibftdi/json, sha256 locally computed
+md5  eaee7fb3a67f33a35a164a9628daaafe pylibftdi-0.15.0.tar.gz
+sha256  51ef08ebcc4ec3eaec2366e9648d3f8fa1b737ea507a7f3a374ac58abf148e77 pylibftdi-0.15.0.tar.gz
package/python-pylibftdi/python-libftdi.mk new file +3 -0
new file mode 100644
index 0000000..b934c03
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-libftdi

package/python-pylibftdi/python-libftdi.mk line 13

Quoted 10 lines
package/python-pylibftdi/python-libftdi.mk new file +10 -0
+#
+################################################################################
+
+PYTHON_PYLIBFTDI_VERSION = 0.15.0
+PYTHON_PYLIBFTDI_SOURCE = pylibftdi-$(PYTHON_PYLIBFTDI_VERSION).tar.gz
+PYTHON_PYLIBFTDI_SITE = https://pypi.python.org/packages/e5/bb/d7a86dbd7685e3866ea75d21c6c726d01706fdc0aa5dc9051ce18ae65693
+PYTHON_PYLIBFTDI_LICENSE = MIT
+PYTHON_PYLIBFTDI_LICENSE_FILES = LICENSE.txt
+PYTHON_PYLIBFTDI_DEPENDENCIES =libftdi
+PYTHON_PYLIBFTDI_SETUP_TYPE = distutils

according to setup.py setuptools is the preferred setup type

Yegor

Quoted 5 lines
package/python-pylibftdi/python-libftdi.mk new file +2 -1
+
+$(eval $(python-package))
--

2.1.4

#3 lore raw

PATCH v2 1/1 python-pylibftdi: new package

In reply to Christian Kellermann

Adds the python binding for libftdi to buildroot.

---
Changes:

v1 -> v2:
- Formatting
- Removed unneeded dependency
- Use setuptools as SETUP_TYPE

---
 package/Config.in                                         |  1 +
 .../python-pylibftdi/0001-do-not-use-find-library.patch   | 14 ++++++++++++++
 package/python-pylibftdi/Config.in                        | 11 +++++++++++
 package/python-pylibftdi/python-libftdi.hash              |  3 +++
 package/python-pylibftdi/python-libftdi.mk                | 15 +++++++++++++++
 5 files changed, 44 insertions(+)
 create mode 100644 package/python-pylibftdi/0001-do-not-use-find-library.patch
 create mode 100644 package/python-pylibftdi/Config.in
 create mode 100644 package/python-pylibftdi/python-libftdi.hash
 create mode 100644 package/python-pylibftdi/python-libftdi.mk
package/Config.in +1 -0
index 26893e5..8248331 100644
@@ -769,6 +769,7 @@ menu "External python modules"
 	source "package/python-pygments/Config.in"
 	source "package/python-pyicu/Config.in"
 	source "package/python-pyinotify/Config.in"
+	source "package/python-pylibftdi/Config.in"
 	source "package/python-pylru/Config.in"
 	source "package/python-pymysql/Config.in"
 	source "package/python-pynacl/Config.in"
package/python-pylibftdi/0001-do-not-use-find-library.patch new file +14 -0
new file mode 100644
index 0000000..2f17dc6
@@ -0,0 +1,14 @@
+diff -purN pylibftdi-0.15.0.orig/pylibftdi/driver.py pylibftdi-0.15.0/pylibftdi/driver.py
+--- pylibftdi-0.15.0.orig/pylibftdi/driver.py	2015-04-26 22:41:39.000000000 +0200
++++ pylibftdi-0.15.0/pylibftdi/driver.py	2017-02-27 13:08:56.502958000 +0100
+@@ -121,8 +121,8 @@ class Driver(object):
+                     lib = getattr(cdll, lib_path)
+                     break
+         if lib is None:
+-            raise LibraryMissingError('{} library not found (search: {})'.format(
+-                name, search_list))
++		return cdll.LoadLibrary(name + '.so')
++
+         return lib
+ 
+     @property
package/python-pylibftdi/Config.in new file +11 -0
new file mode 100644
index 0000000..2ab066c
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_PYLIBFTDI
+	bool "python-pylibftdi"
+	select BR2_PACKAGE_LIBFTDI
+        depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
+	help
+	  This package contains the python language binding libftdi.
+
+	  https://pypi.python.org/pypi/pylibftdi
+
+comment "python-pylibftdi needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/python-pylibftdi/python-libftdi.hash new file +3 -0
new file mode 100644
index 0000000..54b33a1
@@ -0,0 +1,3 @@
+# md5 from https://pypi.python.org/pypi/pylibftdi/json, sha256 locally computed
+md5  eaee7fb3a67f33a35a164a9628daaafe pylibftdi-0.15.0.tar.gz
+sha256  51ef08ebcc4ec3eaec2366e9648d3f8fa1b737ea507a7f3a374ac58abf148e77 pylibftdi-0.15.0.tar.gz
package/python-pylibftdi/python-libftdi.mk new file +15 -0
new file mode 100644
index 0000000..210655d
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-libftdi
+#
+################################################################################
+
+PYTHON_PYLIBFTDI_VERSION = 0.15.0
+PYTHON_PYLIBFTDI_SOURCE = pylibftdi-$(PYTHON_PYLIBFTDI_VERSION).tar.gz
+PYTHON_PYLIBFTDI_SITE = https://pypi.python.org/packages/e5/bb/d7a86dbd7685e3866ea75d21c6c726d01706fdc0aa5dc9051ce18ae65693
+PYTHON_PYLIBFTDI_LICENSE = MIT
+PYTHON_PYLIBFTDI_LICENSE_FILES = LICENSE.txt
+PYTHON_PYLIBFTDI_DEPENDENCIES =libftdi
+PYTHON_PYLIBFTDI_SETUP_TYPE = setuptools
+
+$(eval $(python-package))
Signature · 1 line
2.1.4
#4 lore raw

PATCH v2 1/1 python-pylibftdi: new package

Hello,

Quoted 5 lines · Christian Kellermann
 package/Config.in                                         |  1 +
 .../python-pylibftdi/0001-do-not-use-find-library.patch   | 14 ++++++++++++++
 package/python-pylibftdi/Config.in                        | 11 +++++++++++
 package/python-pylibftdi/python-libftdi.hash              |  3 +++
 package/python-pylibftdi/python-libftdi.mk                | 15 +++++++++++++++

Please add yourself to the DEVELOPERS file for this package.

package/python-pylibftdi/0001-do-not-use-find-library.patch line 3

Quoted 9 lines
package/python-pylibftdi/0001-do-not-use-find-library.patch new file +3 -0
new file mode 100644
index 0000000..2f17dc6
@@ -0,0 +1,14 @@
+diff -purN pylibftdi-0.15.0.orig/pylibftdi/driver.py pylibftdi-0.15.0/pylibftdi/driver.py
+--- pylibftdi-0.15.0.orig/pylibftdi/driver.py	2015-04-26 22:41:39.000000000 +0200
++++ pylibftdi-0.15.0/pylibftdi/driver.py	2017-02-27 13:08:56.502958000 +0100

I think Yegor mentioned it in his review of your previous iteration:
there must be a description of the patch here + a Signed-off-by. See
the Buildroot manual for details, and other patches in the tree. See
for
example ./package/lttng-libust/0001-lttng-ust-elf.c-define-NT_GNU_BUILD_ID-if-not-define.patch.

If this project is using Git as its version control system, then we really prefer if the patch is produced by "git format-patch".

package/python-pylibftdi/Config.in line 4

Quoted 10 lines
package/python-pylibftdi/Config.in new file +4 -0
new file mode 100644
index 0000000..2ab066c
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_PYLIBFTDI
+	bool "python-pylibftdi"
+	select BR2_PACKAGE_LIBFTDI
+        depends on BR2_TOOLCHAIN_HAS_THREADS # libusb

Indentation should be one tab.

Quoted 4 lines
package/python-pylibftdi/Config.in new file +4 -0
+	help
+	  This package contains the python language binding libftdi.
+
+	  https://pypi.python.org/pypi/pylibftdi

package/python-pylibftdi/Config.in

Quoted 10 lines
package/python-pylibftdi/Config.in new file +9 -0
+
+comment "python-pylibftdi needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
 
+PYTHON_PYLIBFTDI_VERSION = 0.15.0
+PYTHON_PYLIBFTDI_SOURCE = pylibftdi-$(PYTHON_PYLIBFTDI_VERSION).tar.gz
+PYTHON_PYLIBFTDI_SITE = https://pypi.python.org/packages/e5/bb/d7a86dbd7685e3866ea75d21c6c726d01706fdc0aa5dc9051ce18ae65693
+PYTHON_PYLIBFTDI_LICENSE = MIT
+PYTHON_PYLIBFTDI_LICENSE_FILES = LICENSE.txt
+PYTHON_PYLIBFTDI_DEPENDENCIES =libftdi

Missing space after = sign.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#5 lore raw

PATCH v3 1/1 python-pylibftdi: new package

Adds the python binding for libftdi to buildroot.

---
Changes:

v2 -> v3:
- Style fixes
- Patch description added
- added myself to DEVELOPERS

v1 -> v2:
- Formatting
- Removed unneeded dependency
- Use setuptools as SETUP_TYPE

---
 DEVELOPERS                                         |  3 +++
 package/Config.in                                  |  1 +
 .../0001-do-not-use-find-library.patch             | 31 ++++++++++++++++++++++
 package/python-pylibftdi/Config.in                 | 11 ++++++++
 package/python-pylibftdi/python-libftdi.hash       |  3 +++
 package/python-pylibftdi/python-libftdi.mk         | 15 +++++++++++
 6 files changed, 64 insertions(+)
 create mode 100644 package/python-pylibftdi/0001-do-not-use-find-library.patch
 create mode 100644 package/python-pylibftdi/Config.in
 create mode 100644 package/python-pylibftdi/python-libftdi.hash
 create mode 100644 package/python-pylibftdi/python-libftdi.mk
DEVELOPERS +3 -0
index 09a0a6e..8cb2b5a 100644
@@ -305,6 +305,9 @@ F:	package/micropython/
 F:	package/micropython-lib/
 F:	package/syslog-ng/
 
+N:	Christian Kellermann <[email protected]>
+F:	package/python-pylibftdi/
+
 N:	Christian Stewart <[email protected]>
 F:	linux/linux-ext-aufs.mk
 F:	package/aufs/
package/Config.in +1 -0
index 26893e5..8248331 100644
@@ -769,6 +769,7 @@ menu "External python modules"
 	source "package/python-pygments/Config.in"
 	source "package/python-pyicu/Config.in"
 	source "package/python-pyinotify/Config.in"
+	source "package/python-pylibftdi/Config.in"
 	source "package/python-pylru/Config.in"
 	source "package/python-pymysql/Config.in"
 	source "package/python-pynacl/Config.in"
package/python-pylibftdi/0001-do-not-use-find-library.patch new file +31 -0
new file mode 100644
index 0000000..ae8fe2d
@@ -0,0 +1,31 @@
+Hard code library loading
+
+Shortcut the search for the libraries in case the built in
+find_library is broken.
+
+As buildroot does not ship any of the external programs that the core
+procedure use to find libraries use the canonical name of the shared
+object and load it.
+
+In this case this affects loading libftdi and libusb.
+
+This should be reliable as we specify said libs as dependencies of
+this package.
+
+Signed-off-by: Christian Kellermann <[email protected]>
+
+---
+diff -purN pylibftdi-0.15.0.orig/pylibftdi/driver.py pylibftdi-0.15.0/pylibftdi/driver.py
+--- pylibftdi-0.15.0.orig/pylibftdi/driver.py	2015-04-26 22:41:39.000000000 +0200
++++ pylibftdi-0.15.0/pylibftdi/driver.py	2017-02-27 13:08:56.502958000 +0100
+@@ -121,8 +121,8 @@ class Driver(object):
+                     lib = getattr(cdll, lib_path)
+                     break
+         if lib is None:
+-            raise LibraryMissingError('{} library not found (search: {})'.format(
+-                name, search_list))
++		return cdll.LoadLibrary(name + '.so')
++
+         return lib
+ 
+     @property
package/python-pylibftdi/Config.in new file +11 -0
new file mode 100644
index 0000000..f829071
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_PYLIBFTDI
+	bool "python-pylibftdi"
+	select BR2_PACKAGE_LIBFTDI
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
+	help
+	  This package contains the python language binding libftdi.
+
+	  https://pypi.python.org/pypi/pylibftdi
+
+comment "python-pylibftdi needs a toolchain w/ threads"
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
package/python-pylibftdi/python-libftdi.hash new file +3 -0
new file mode 100644
index 0000000..54b33a1
@@ -0,0 +1,3 @@
+# md5 from https://pypi.python.org/pypi/pylibftdi/json, sha256 locally computed
+md5  eaee7fb3a67f33a35a164a9628daaafe pylibftdi-0.15.0.tar.gz
+sha256  51ef08ebcc4ec3eaec2366e9648d3f8fa1b737ea507a7f3a374ac58abf148e77 pylibftdi-0.15.0.tar.gz
package/python-pylibftdi/python-libftdi.mk new file +15 -0
new file mode 100644
index 0000000..b375abb
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-libftdi
+#
+################################################################################
+
+PYTHON_PYLIBFTDI_VERSION = 0.15.0
+PYTHON_PYLIBFTDI_SOURCE = pylibftdi-$(PYTHON_PYLIBFTDI_VERSION).tar.gz
+PYTHON_PYLIBFTDI_SITE = https://pypi.python.org/packages/e5/bb/d7a86dbd7685e3866ea75d21c6c726d01706fdc0aa5dc9051ce18ae65693
+PYTHON_PYLIBFTDI_LICENSE = MIT
+PYTHON_PYLIBFTDI_LICENSE_FILES = LICENSE.txt
+PYTHON_PYLIBFTDI_DEPENDENCIES = libftdi
+PYTHON_PYLIBFTDI_SETUP_TYPE = setuptools
+
+$(eval $(python-package))
Signature · 1 line
2.1.4
#6 lore raw

PATCH v3 1/1 python-pylibftdi: new package

Quoted 3 lines · Christian Kellermann

Adds the python binding for libftdi to buildroot.

Quoted 138 lines

---
Changes:

v2 -> v3:
- Style fixes
- Patch description added
- added myself to DEVELOPERS

v1 -> v2:
- Formatting
- Removed unneeded dependency
- Use setuptools as SETUP_TYPE

---
 DEVELOPERS                                         |  3 +++
 package/Config.in                                  |  1 +
 .../0001-do-not-use-find-library.patch             | 31 ++++++++++++++++++++++
 package/python-pylibftdi/Config.in                 | 11 ++++++++
 package/python-pylibftdi/python-libftdi.hash       |  3 +++
 package/python-pylibftdi/python-libftdi.mk         | 15 +++++++++++
 6 files changed, 64 insertions(+)
 create mode 100644 package/python-pylibftdi/0001-do-not-use-find-library.patch
 create mode 100644 package/python-pylibftdi/Config.in
 create mode 100644 package/python-pylibftdi/python-libftdi.hash
 create mode 100644 package/python-pylibftdi/python-libftdi.mk
DEVELOPERS +3 -0
index 09a0a6e..8cb2b5a 100644
@@ -305,6 +305,9 @@ F:  package/micropython/
 F:     package/micropython-lib/
 F:     package/syslog-ng/
 
+N:     Christian Kellermann <[email protected]>
+F:     package/python-pylibftdi/
+
 N:     Christian Stewart <[email protected]>
 F:     linux/linux-ext-aufs.mk
 F:     package/aufs/
package/Config.in +1 -0
index 26893e5..8248331 100644
@@ -769,6 +769,7 @@ menu "External python modules"
        source "package/python-pygments/Config.in"
        source "package/python-pyicu/Config.in"
        source "package/python-pyinotify/Config.in"
+       source "package/python-pylibftdi/Config.in"
        source "package/python-pylru/Config.in"
        source "package/python-pymysql/Config.in"
        source "package/python-pynacl/Config.in"
package/python-pylibftdi/0001-do-not-use-find-library.patch new file +31 -0
new file mode 100644
index 0000000..ae8fe2d
@@ -0,0 +1,31 @@
+Hard code library loading
+
+Shortcut the search for the libraries in case the built in
+find_library is broken.
+
+As buildroot does not ship any of the external programs that the core
+procedure use to find libraries use the canonical name of the shared
+object and load it.
+
+In this case this affects loading libftdi and libusb.
+
+This should be reliable as we specify said libs as dependencies of
+this package.
+
+Signed-off-by: Christian Kellermann <[email protected]>
+
+---
+diff -purN pylibftdi-0.15.0.orig/pylibftdi/driver.py pylibftdi-0.15.0/pylibftdi/driver.py
+--- pylibftdi-0.15.0.orig/pylibftdi/driver.py  2015-04-26 22:41:39.000000000 +0200
++++ pylibftdi-0.15.0/pylibftdi/driver.py       2017-02-27 13:08:56.502958000 +0100
+@@ -121,8 +121,8 @@ class Driver(object):
+                     lib = getattr(cdll, lib_path)
+                     break
+         if lib is None:
+-            raise LibraryMissingError('{} library not found (search: {})'.format(
+-                name, search_list))
++              return cdll.LoadLibrary(name + '.so')
++
+         return lib
+
+     @property
package/python-pylibftdi/Config.in new file +11 -0
new file mode 100644
index 0000000..f829071
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_PYTHON_PYLIBFTDI
+       bool "python-pylibftdi"
+       select BR2_PACKAGE_LIBFTDI
+       depends on BR2_TOOLCHAIN_HAS_THREADS # libusb
+       help
+         This package contains the python language binding libftdi.
+
+         https://pypi.python.org/pypi/pylibftdi
+
+comment "python-pylibftdi needs a toolchain w/ threads"
+       depends on !BR2_TOOLCHAIN_HAS_THREADS
package/python-pylibftdi/python-libftdi.hash new file +3 -0
new file mode 100644
index 0000000..54b33a1
@@ -0,0 +1,3 @@
+# md5 from https://pypi.python.org/pypi/pylibftdi/json, sha256 locally computed
+md5  eaee7fb3a67f33a35a164a9628daaafe pylibftdi-0.15.0.tar.gz
+sha256  51ef08ebcc4ec3eaec2366e9648d3f8fa1b737ea507a7f3a374ac58abf148e77 pylibftdi-0.15.0.tar.gz
package/python-pylibftdi/python-libftdi.mk new file +15 -1
new file mode 100644
index 0000000..b375abb
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-libftdi
+#
+################################################################################
+
+PYTHON_PYLIBFTDI_VERSION = 0.15.0
+PYTHON_PYLIBFTDI_SOURCE = pylibftdi-$(PYTHON_PYLIBFTDI_VERSION).tar.gz
+PYTHON_PYLIBFTDI_SITE = https://pypi.python.org/packages/e5/bb/d7a86dbd7685e3866ea75d21c6c726d01706fdc0aa5dc9051ce18ae65693
+PYTHON_PYLIBFTDI_LICENSE = MIT
+PYTHON_PYLIBFTDI_LICENSE_FILES = LICENSE.txt
+PYTHON_PYLIBFTDI_DEPENDENCIES = libftdi
+PYTHON_PYLIBFTDI_SETUP_TYPE = setuptools
+
+$(eval $(python-package))
--

2.1.4

#8 lore raw

PATCH v3 1/1 python-pylibftdi: new package

In reply to Christian Kellermann

Hello,

Quoted 5 lines · Christian Kellermann

Adds the python binding for libftdi to buildroot.

---
Changes:

This package causes a build issue:

Traceback (most recent call last):
File "/home/test/autobuild/run/instance-0/output/host/usr/lib/python3.5/py_compile.py", line 125, in compile
_optimize=optimize)
File "<frozen importlib._bootstrap_external>", line 700, in source_to_code
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/test/autobuild/run/instance-0/output/target/usr/lib/python3.5/site-packages/pylibftdi/driver.py", line 124
return cdll.LoadLibrary(name + '.so')
^
TabError: inconsistent use of tabs and spaces in indentation

See
http://autobuild.buildroot.net/results/67c/67cddfdb801e83acfd9f197f5661fd43fa38a092/build-end.log
for the full log.

Could you have a look ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#9 lore raw

PATCH v3 1/1 python-pylibftdi: new package

Thomas, Christian, All,

On 2017-03-06 09:20 +0100, Thomas Petazzoni spake thusly:

Quoted 9 lines · Christian Kellermann
Quoted 5 lines

Adds the python binding for libftdi to buildroot.

---
Changes:

This package causes a build issue:

Quoted 9 lines

Traceback (most recent call last):
File "/home/test/autobuild/run/instance-0/output/host/usr/lib/python3.5/py_compile.py", line 125, in compile
_optimize=optimize)
File "<frozen importlib._bootstrap_external>", line 700, in source_to_code
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/test/autobuild/run/instance-0/output/target/usr/lib/python3.5/site-packages/pylibftdi/driver.py", line 124
return cdll.LoadLibrary(name + '.so')
^
TabError: inconsistent use of tabs and spaces in indentation

That is because of our patch 0001-do-not-use-find-library.patch which introduces leading tabs instead of spaces.

Patch incoming...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#10 lore raw

cover python-pylibftdi new package

In reply to Christian Kellermann

Hi Christian,

Quoted 10 lines · Christian Kellermann

Dear List,

This patch adds the python binding for libftdi. However it contains a hackish patch which I would like to discuss. Pylibftdi uses the ctypes find_library call to find the libusb and libftdi libraries. This in turn seems to rely on ldconfig which is not part of buildroot.

Patching it out here seems to work fine, but this kind of hides the general problem of fixing find_library in the python package. How would one do this properly?

This is a known problem and so far there is no proper solution. So I think the patch is acceptable.

Btw. have you tried libftdi's native Python support via SWIG? pylibftdi hasn't reached version 1.0.0 and the project hasn't been updated since September 2015.

Yegor