Skip to contentSkip to conversation

][PATCH] python-evdev: add setup.py patch to make sure it uses sysroot headers

krogoth Stephen Arnold 1 participant 1 message Oct 6, 2016

lore
Share & tools
lore
#0 lore raw

From: Steve Arnold <[email protected]>

This currently works (randomly) when BUILD_HOST headers are a close enough match, but fails as soon as they differ, due to static header include paths in setup.py. This patch adds a path check for the STAGING_INC dir and makes it use the right headers.

Also includes DEPENDS/RDEPENDS from Tim and small doc package instead of empty dev package.

---
 .../python/python-evdev/use-sysroot-headers.patch  | 24 +++++++++++++++++++
 .../recipes-devtools/python/python-evdev_0.6.0.bb  | 28 ++++++++++++++++++----
 2 files changed, 48 insertions(+), 4 deletions(-)
 create mode 100644 meta-python/recipes-devtools/python/python-evdev/use-sysroot-headers.patch
meta-python/recipes-devtools/python/python-evdev/use-sysroot-headers.patch new file +24 -0
new file mode 100644
index 0000000..ce62bfc
@@ -0,0 +1,24 @@
+--- a/setup.py	2016-10-01 10:00:11.491758891 -0700
++++ b/setup.py	2016-10-01 10:01:45.045089476 -0700
+@@ -65,10 +65,17 @@
+ 
+ #-----------------------------------------------------------------------------
+ def create_ecodes():
+-    headers = [
+-        '/usr/include/linux/input.h',
+-        '/usr/include/linux/input-event-codes.h',
+-    ]
++
++    if not os.path.lexists(os.path.expandvars('$STAGING_INCDIR')):
++        headers = [
++            '/usr/include/linux/input.h',
++            '/usr/include/linux/input-event-codes.h',
++        ]
++    else:
++        headers = [
++            os.path.expandvars('$STAGING_INCDIR/linux/input.h'),
++            os.path.expandvars('$STAGING_INCDIR/linux/input-event-codes.h'),   
++        ]
+ 
+     headers = [header for header in headers if os.path.isfile(header)]
+     if not headers:
meta-python/recipes-devtools/python/python-evdev_0.6.0.bb +24 -4
index e555552..152206a 100644
@@ -4,9 +4,29 @@ SECTION = "devel/python"
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=18debddbb3f52c661a129724a883a8e2"
 
-SRC_URI = "https://github.com/gvalkov/python-evdev/archive/v${PV}.zip"
+SRC_URI = "file://use-sysroot-headers.patch"
 
-SRC_URI[md5sum] = "24e4ffa98e338b535eae44d91d609005"
-SRC_URI[sha256sum] = "61f6893d80da87a995e5781c74d22a39448b1b32004ffac2f31817017709be04"
+SRC_URI[md5sum] = "294ac2997bd419d56b9451511536f9f4"
+SRC_URI[sha256sum] = "c0e1410cc88eaa6a016baeafb2acb1274d36a057944143b59e94f36bb4aaaa82"
 
-inherit setuptools
+inherit pypi setuptools
+
+DEPENDS_${PN} += "\
+    ${PYTHON_PN}-ctypes \
+"
+
+RDEPENDS_${PN} += "\
+    ${PYTHON_PN}-ctypes \
+    ${PYTHON_PN}-fcntl \
+    ${PYTHON_PN}-io \
+    ${PYTHON_PN}-shell \
+    ${PYTHON_PN}-stringold \
+"
+
+do_install_append() {
+    # note the full docs require Sphinx to build them
+    install -d ${D}${datadir}/doc/${BPN}/
+    install -m 0644 ${S}/README.rst ${D}${datadir}/doc/${PN}/
+}
+
+PACKAGES = "${PN}-doc ${PN} ${PN}-dbg"
Signature · 1 line
2.9.3