Skip to contentSkip to conversation

dbus-python cleanup and python3 support

PATCH New Peter Korsgaard 2 participants 6 messages Nov 20, 2014 – Nov 22, 2014

lore
Share & tools
lore
#0 lore raw

cover dbus-python cleanup and python3 support

Hi,

This series cleans up the dbus-python package and adds python3 support. Doing this, I noticed that python3-config currently outputs wrong data for --includes / --ldflags, so this gets patched as well.

There's currently (to my knowledge atleast) no other packages using this output, so we don't need to apply it to master as well.

 package/dbus-python/Config.in                 |  5 +-
 ...thon-0001-fix-python-configure-check.patch | 27 ---------
 package/dbus-python/dbus-python.mk            | 26 +++++---
 ...on3-017-python-config-include-libdir.patch | 60 +++++++++++++++++++
 4 files changed, 80 insertions(+), 38 deletions(-)

Peter Korsgaard (3):
dbus-python: cleanup package
python3: add patch to fix --includes / --ldflags output of python3-config
dbus-python: add python3 support

--
Bye, Peter Korsgaard

#1 lore raw

PATCH 1/3 dbus-python: cleanup package

The patch is not needed anymore as the proper includes can be specified using PYTHON_INCLUDES, and version/pythondir/pyexecdir is correctly detected using host-python.

---
 ...us-python-0001-fix-python-configure-check.patch | 27 ----------------------
 package/dbus-python/dbus-python.mk                 | 11 ++++-----
 2 files changed, 4 insertions(+), 34 deletions(-)
package/dbus-python/dbus-python-0001-fix-python-configure-check.patch deleted +0 -27
deleted file mode 100644
index 2df4da8..0000000
@@ -1,27 +0,0 @@
-Python: add am_cv_python_includes to override runtime python-config check
-[Gustavo: update for dbus-python 1.2.0]
-
-diff -Nura dbus-python-1.2.0.orig/configure dbus-python-1.2.0/configure
---- dbus-python-1.2.0.orig/configure	2013-05-08 04:48:42.000000000 -0300
-+++ dbus-python-1.2.0/configure	2014-07-03 16:54:25.922727033 -0300
-@@ -11762,6 +11762,12 @@
- else
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python headers using $PYTHON-config --includes" >&5
- $as_echo_n "checking for Python headers using $PYTHON-config --includes... " >&6; }
-+if test "${am_cv_python_includes+set}" = set; then
-+  $as_echo_n "(cached) $ECHO_C" >&6
-+  PYTHON_INCLUDES=${am_cv_python_includes}
-+  { $as_echo "$as_me:$LINENO: result: $PYTHON_INCLUDES" >&5
-+$as_echo_t "${ECHO_T}$PYTHON_INCLUDES" >&6; }
-+else
-   PYTHON_INCLUDES=`$PYTHON-config --includes`
-   if test $? = 0; then
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_INCLUDES" >&5
-@@ -11781,6 +11787,7 @@
- $as_echo "$PYTHON_INCLUDES" >&6; }
-   fi
- fi
-+fi
- 
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether those headers are sufficient" >&5
- $as_echo_n "checking whether those headers are sufficient... " >&6; }
package/dbus-python/dbus-python.mk +4 -7
index d4fdfa1..bc57689 100644
@@ -10,13 +10,10 @@ DBUS_PYTHON_INSTALL_STAGING = YES
 DBUS_PYTHON_LICENSE = MIT
 DBUS_PYTHON_LICENSE_FILES = COPYING
 
-DBUS_PYTHON_CONF_ENV = am_cv_pathless_PYTHON=python \
-		ac_cv_path_PYTHON=$(HOST_DIR)/usr/bin/python \
-		am_cv_python_version=$(PYTHON_VERSION) \
-		am_cv_python_platform=linux2 \
-		am_cv_python_pythondir=/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \
-		am_cv_python_pyexecdir=/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \
-		am_cv_python_includes=-I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
+DBUS_PYTHON_CONF_ENV = \
+	PYTHON=$(HOST_DIR)/usr/bin/python2 \
+	PYTHON_INCLUDES="$(shell $(STAGING_DIR)/usr/bin/python2-config --includes)" \
+	PYTHON_LIBS="$(shell $(STAGING_DIR)/usr/bin/python2-config --ldflags)"
 
 DBUS_PYTHON_CONF_OPTS = --disable-html-docs --disable-api-docs
 
Signature · 1 line
2.1.3
#2 lore raw

PATCH 2/3 python3: add patch to fix --includes / --ldflags output of python3-config

In reply to Peter Korsgaard

The build/real prefix handling using sed breaks if build != real and the standard include / lib directories are used ($prefix/include and $prefix/lib).

E.G.

prefix_build="/usr", libdir="$prefix/lib", includedir="$prefix/include".

If this gets installed with make DESTDIR="/foo" install, then we end up with prefix_real = prefix = "/foo/usr" as expected, but includedir="/foo/foo/usr/include" and libdir="/foo/foo/usr/lib" because of the double sed invocation (prefix is already expanded). Work around it by ensuring we only match the beginning of the string.

Submitted upstream: http://bugs.python.org/issue22907

---
 .../python3-017-python-config-include-libdir.patch | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)
package/python3/python3-017-python-config-include-libdir.patch new file +60 -0
new file mode 100644
index 0000000..50a856d
@@ -0,0 +1,60 @@
+From 50f34d2cac63b6bf0935294a7d63d9451714f4c4 Mon Sep 17 00:00:00 2001
+From: Peter Korsgaard <[email protected]>
+Date: Thu, 20 Nov 2014 13:24:59 +0100
+Subject: [PATCH] Misc/python-config.sh.in: ensure sed invocations only match
+ beginning of strings
+
+The build/real prefix handling using sed breaks if build != real and the
+standard include / lib directories are used ($prefix/include and $prefix/lib).
+
+E.G.
+
+prefix_build="/usr", libdir="$prefix/lib", includedir="$prefix/include".
+
+If this gets installed with make DESTDIR="/foo" install, then we end up with
+prefix_real = prefix = "/foo/usr" as expected, but
+includedir="/foo/foo/usr/include" and libdir="/foo/foo/usr/lib" because of
+the double sed invocation (prefix is already expanded).  Work around it by
+ensuring we only match the beginning of the string.
+
+Submitted upstream: http://bugs.python.org/issue22907
+
+Signed-off-by: Peter Korsgaard <[email protected]>
+---
+ Misc/python-config.sh.in | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in
+index 64c81e5..f75eec5 100644
+--- a/Misc/python-config.sh.in
++++ b/Misc/python-config.sh.in
+@@ -29,12 +29,12 @@ prefix_real=$(installed_prefix "$0")
+ 
+ # Use sed to fix paths from their built-to locations to their installed-to
+ # locations.
+-prefix=$(echo "$prefix_build" | sed "s#$prefix_build#$prefix_real#")
++prefix=$(echo "$prefix_build" | sed "s#^$prefix_build#$prefix_real#")
+ exec_prefix_build="@exec_prefix@"
+-exec_prefix=$(echo "$exec_prefix_build" | sed "s#$exec_prefix_build#$prefix_real#")
+-includedir=$(echo "@includedir@" | sed "s#$prefix_build#$prefix_real#")
+-libdir=$(echo "@libdir@" | sed "s#$prefix_build#$prefix_real#")
+-CFLAGS=$(echo "@CFLAGS@" | sed "s#$prefix_build#$prefix_real#")
++exec_prefix=$(echo "$exec_prefix_build" | sed "s#^$exec_prefix_build#$prefix_real#")
++includedir=$(echo "@includedir@" | sed "s#^$prefix_build#$prefix_real#")
++libdir=$(echo "@libdir@" | sed "s#^$prefix_build#$prefix_real#")
++CFLAGS=$(echo "@CFLAGS@" | sed "s#^$prefix_build#$prefix_real#")
+ VERSION="@VERSION@"
+ LIBM="@LIBM@"
+ LIBC="@LIBC@"
+@@ -48,7 +48,7 @@ OPT="@OPT@"
+ PY_ENABLE_SHARED="@PY_ENABLE_SHARED@"
+ LDVERSION="@LDVERSION@"
+ LIBDEST=${prefix}/lib/python${VERSION}
+-LIBPL=$(echo "@LIBPL@" | sed "s#$prefix_build#$prefix_real#")
++LIBPL=$(echo "@LIBPL@" | sed "s#^$prefix_build#$prefix_real#")
+ SO="@SO@"
+ PYTHONFRAMEWORK="@PYTHONFRAMEWORK@"
+ INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
+-- 
+2.1.3
+
Signature · 1 line
2.1.3
#3 lore raw

PATCH 3/3 dbus-python: add python3 support

In reply to Peter Korsgaard
---
 package/dbus-python/Config.in      |  5 +++--
 package/dbus-python/dbus-python.mk | 17 ++++++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)
package/dbus-python/Config.in +3 -2
index a38d277..4b302ef 100644
@@ -3,10 +3,11 @@ config BR2_PACKAGE_DBUS_PYTHON
 	depends on BR2_USE_WCHAR # glib2
 	depends on BR2_TOOLCHAIN_HAS_THREADS # glib2
 	depends on BR2_PACKAGE_DBUS
-	depends on BR2_PACKAGE_PYTHON
+	depends on BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3
 	select BR2_PACKAGE_DBUS_GLIB
 	# pyexpat: runtime dependency only
-	select BR2_PACKAGE_PYTHON_PYEXPAT
+	select BR2_PACKAGE_PYTHON_PYEXPAT if BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON3_PYEXPAT if BR2_PACKAGE_PYTHON3
 	help
 	  Python bindings for D-Bus
 
package/dbus-python/dbus-python.mk +14 -3
index bc57689..1637406 100644
@@ -9,14 +9,25 @@ DBUS_PYTHON_SITE = http://dbus.freedesktop.org/releases/dbus-python
 DBUS_PYTHON_INSTALL_STAGING = YES
 DBUS_PYTHON_LICENSE = MIT
 DBUS_PYTHON_LICENSE_FILES = COPYING
+DBUS_PYTHON_DEPENDENCIES = dbus-glib
+DBUS_PYTHON_CONF_OPTS = --disable-html-docs --disable-api-docs
+
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+DBUS_PYTHON_DEPENDENCIES += python host-python
 
-DBUS_PYTHON_CONF_ENV = \
+DBUS_PYTHON_CONF_ENV += \
 	PYTHON=$(HOST_DIR)/usr/bin/python2 \
 	PYTHON_INCLUDES="$(shell $(STAGING_DIR)/usr/bin/python2-config --includes)" \
 	PYTHON_LIBS="$(shell $(STAGING_DIR)/usr/bin/python2-config --ldflags)"
+else
+DBUS_PYTHON_DEPENDENCIES += python3 host-python3
+
+DBUS_PYTHON_CONF_ENV += \
+	PYTHON=$(HOST_DIR)/usr/bin/python3 \
+	PYTHON_INCLUDES="$(shell $(STAGING_DIR)/usr/bin/python3-config --includes)" \
+	PYTHON_LIBS="$(shell $(STAGING_DIR)/usr/bin/python3-config --ldflags)"
+endif
 
-DBUS_PYTHON_CONF_OPTS = --disable-html-docs --disable-api-docs
 
-DBUS_PYTHON_DEPENDENCIES = dbus-glib python host-python
 
 $(eval $(autotools-package))
Signature · 1 line
2.1.3
#4 lore raw

cover dbus-python cleanup and python3 support

In reply to Peter Korsgaard

Dear Peter Korsgaard,

Quoted 4 lines · Peter Korsgaard

Peter Korsgaard (3):
dbus-python: cleanup package
python3: add patch to fix --includes / --ldflags output of python3-config
dbus-python: add python3 support

Thanks, series applied to next. Probably the first time that I apply some patches from you :-)

I found one minor issue: on the last patch, you forgot to update the dependencies of the comment, so I added the following change to your patch:

comment "dbus-python needs a toolchain w/ wchar, threads"
- depends on BR2_PACKAGE_DBUS && BR2_PACKAGE_PYTHON
+ depends on BR2_PACKAGE_DBUS && (BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3)

Thanks!

Thomas

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

cover dbus-python cleanup and python3 support

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Quoted 10 lines

Dear Peter Korsgaard,

Quoted 4 lines · Peter Korsgaard

Peter Korsgaard (3):
dbus-python: cleanup package
python3: add patch to fix --includes / --ldflags output of python3-config
dbus-python: add python3 support

Thanks, series applied to next. Probably the first time that I apply some patches from you :-)

;)

Review

Quoted 7 lines

I found one minor issue: on the last patch, you forgot to update the dependencies of the comment, so I added the following change to your patch:

comment "dbus-python needs a toolchain w/ wchar, threads"

(quoted diff) +1 -1
-       depends on BR2_PACKAGE_DBUS && BR2_PACKAGE_PYTHON
+       depends on BR2_PACKAGE_DBUS && (BR2_PACKAGE_PYTHON || BR2_PACKAGE_PYTHON3)

Ahh yes, thanks

Signature · 1 line
Bye, Peter Korsgaard