diff mbox

[v3,2/2] libglib2: fix install even if the host python binary refers to python3

Message ID 1338674897-1810-2-git-send-email-s.martin49@gmail.com
State Superseded
Headers show

Commit Message

Samuel Martin June 2, 2012, 10:08 p.m. UTC
The libglib2's build system uses some python2 scripts in the install rules.

This patch ensures to have a valid host python2 binary and enforces this python2
binary at configure-time.

Signed-off-by: Samuel Martin <s.martin49@gmail.com>

Comments

Samuel Martin June 28, 2012, 8:59 p.m. UTC | #1
ping?
Arnout Vandecappelle July 15, 2012, 11:50 a.m. UTC | #2
On 06/03/12 00:08, Samuel Martin wrote:
> The libglib2's build system uses some python2 scripts in the install rules.
>
> This patch ensures to have a valid host python2 binary and enforces this python2
> binary at configure-time.
>
> Signed-off-by: Samuel Martin<s.martin49@gmail.com>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

  And a bump.
Thomas Petazzoni July 17, 2012, 8:22 a.m. UTC | #3
Le Sun,  3 Jun 2012 00:08:17 +0200,
Samuel Martin <s.martin49@gmail.com> a écrit :

> The libglib2's build system uses some python2 scripts in the install rules.
> 
> This patch ensures to have a valid host python2 binary and enforces this python2
> binary at configure-time.
> 
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>

Isn't there a way to make the libglib2 python script python2 *and*
python3 compatible?

Thomas
Samuel Martin July 17, 2012, 8:34 a.m. UTC | #4
2012/7/17 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>:
> Le Sun,  3 Jun 2012 00:08:17 +0200,
> Samuel Martin <s.martin49@gmail.com> a écrit :
>
>> The libglib2's build system uses some python2 scripts in the install rules.
>>
>> This patch ensures to have a valid host python2 binary and enforces this python2
>> binary at configure-time.
>>
>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>
> Isn't there a way to make the libglib2 python script python2 *and*
> python3 compatible?
>
The truth is I have not checked that.
Will do and report here.

Cheers,
Samuel Martin Aug. 18, 2012, 12:06 p.m. UTC | #5
Hi all,

Reviving an old thread... ;-)

2012/7/17 Samuel Martin <s.martin49@gmail.com>:
> 2012/7/17 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>:
>> Le Sun,  3 Jun 2012 00:08:17 +0200,
>> Samuel Martin <s.martin49@gmail.com> a écrit :
>>
>>> The libglib2's build system uses some python2 scripts in the install rules.
>>>
>>> This patch ensures to have a valid host python2 binary and enforces this python2
>>> binary at configure-time.
>>>
>>> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>>
>> Isn't there a way to make the libglib2 python script python2 *and*
>> python3 compatible?
>>
> The truth is I have not checked that.
> Will do and report here.


Current state in BR, with or without host-python already installed:
- if host-python is already installed in the host directory, then
libglib2 found it; in this case PYTHON=$(HOST_DIR)/usr/bin/python, so
no problem (this is a side effect of the the way we set the PATH env.
var.).
- otherwise, libglib2 use the python binary from the system:
PYTHON=/usr/bin/python, which is wrong if /usr/bin/python points to
/usr/bin/python3.

With no host python2 found, the build error is:
[...]
Making all in tests
make[5]: Entering directory
`/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/tests'
UNINSTALLED_GLIB_SRCDIR=../.. \
	UNINSTALLED_GLIB_BUILDDIR=../.. \
	/usr/bin/python ../../gio/gdbus-2.0/codegen/gdbus-codegen \
	--interface-prefix org.project. \
	--generate-c-code gdbus-test-codegen-generated \
	--c-generate-object-manager \
	--c-namespace Foo_iGen \
	--generate-docbook gdbus-test-codegen-generated-doc \
	--annotate "org.project.Bar" Key1 Value1 \
	--annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \
	--annotate "org.project.Bar.HelloWorld()" Key3 Value3 \
	--annotate "org.project.Bar::TestSignal" Key4 Value4 \
	--annotate "org.project.Bar:ay" Key5 Value5 \
	--annotate "org.project.Bar.TestPrimitiveTypes()[val_int32]" Key6 Value6 \
	--annotate "org.project.Bar.TestPrimitiveTypes()[ret_uint32]" Key7 Value7 \
	--annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \
	./test-codegen.xml \
	
UNINSTALLED_GLIB_SRCDIR=../.. \
	UNINSTALLED_GLIB_BUILDDIR=../.. \
	/usr/bin/python ../../gio/gdbus-2.0/codegen/gdbus-codegen \
	--interface-prefix org.project. \
	--generate-c-code gdbus-test-codegen-generated \
	--c-generate-object-manager \
	--c-namespace Foo_iGen \
	--generate-docbook gdbus-test-codegen-generated-doc \
	--annotate "org.project.Bar" Key1 Value1 \
	--annotate "org.project.Bar" org.gtk.GDBus.Internal Value2 \
	--annotate "org.project.Bar.HelloWorld()" Key3 Value3 \
	--annotate "org.project.Bar::TestSignal" Key4 Value4 \
	--annotate "org.project.Bar:ay" Key5 Value5 \
	--annotate "org.project.Bar.TestPrimitiveTypes()[val_int32]" Key6 Value6 \
	--annotate "org.project.Bar.TestPrimitiveTypes()[ret_uint32]" Key7 Value7 \
	--annotate "org.project.Bar::TestSignal[array_of_strings]" Key8 Value8 \
	./test-codegen.xml \
	
Traceback (most recent call last):
  File "../../gio/gdbus-2.0/codegen/gdbus-codegen", line 41, in <module>
    sys.exit(codegen_main.codegen_main())
  File "/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/gdbus-2.0/codegen/codegen_main.py",
line 171, in codegen_main
    parsed_ifaces = parser.parse_dbus_xml(xml_data)
  File "/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/gdbus-2.0/codegen/parser.py",
line 289, in parse_dbus_xml
    parser = DBusXMLParser(xml_data)
  File "/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/gdbus-2.0/codegen/parser.py",
line 57, in __init__
    self._parser.Parse(xml_data)
  File "/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/gdbus-2.0/codegen/parser.py",
line 155, in handle_start_element
    if attrs.has_key('name') and self.doc_comment_last_symbol == attrs['name']:
AttributeError: 'dict' object has no attribute 'has_key'
make[5]: *** [gdbus-test-codegen-generated.c] Error 1
make[5]: *** Waiting for unfinished jobs....
Traceback (most recent call last):
  File "../../gio/gdbus-2.0/codegen/gdbus-codegen", line 41, in <module>
    sys.exit(codegen_main.codegen_main())
  File "/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/gdbus-2.0/codegen/codegen_main.py",
line 171, in codegen_main
    parsed_ifaces = parser.parse_dbus_xml(xml_data)
  File "/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/gdbus-2.0/codegen/parser.py",
line 289, in parse_dbus_xml
    parser = DBusXMLParser(xml_data)
  File "/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/gdbus-2.0/codegen/parser.py",
line 57, in __init__
    self._parser.Parse(xml_data)
  File "/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/gdbus-2.0/codegen/parser.py",
line 155, in handle_start_element
    if attrs.has_key('name') and self.doc_comment_last_symbol == attrs['name']:
AttributeError: 'dict' object has no attribute 'has_key'
make[5]: *** [gdbus-test-codegen-generated.h] Error 1
make[5]: Leaving directory
`/home/samuel/data/workspace/src/buildroot/master/output/build/host-libglib2-2.30.2/gio/tests'


Current state in somewhere else:
Most of the time, other distros keep the dependency to python2 to
build glib2/gdbus-codegen, e.g.:
- archlinux (though the package has already been bumped to 2.32.4):
https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/glib2&id=614e5ff9b1c81454a96eebad2baf0ab7a803329b
- gentoo:
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/glib/glib-2.30.2.ebuild?view=markup
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-util/gdbus-codegen/gdbus-codegen-2.30.2.ebuild?view=markup


Current state in glib repository:
A patch fixing this has quite recently been merged upstream (which is
already included in the glib release 2.32.4 or later, and works fine
with the current version integrated in BR: 2.30.2):
http://git.gnome.org/browse/glib/patch/?id=03611f7c0670ea14eedbc121972aed7ce60bb9ee


So, I'll send a patch integrating the upstream patch.
If this new patch is accepted, then this patch series (host-python2
and libglib2 depending on python2) could be discarded.


Cheers,
Thomas Petazzoni Aug. 20, 2012, 6:56 p.m. UTC | #6
Hello,

Le Sat, 18 Aug 2012 14:06:22 +0200,
Samuel Martin <s.martin49@gmail.com> a écrit :

> Current state in glib repository:
> A patch fixing this has quite recently been merged upstream (which is
> already included in the glib release 2.32.4 or later, and works fine
> with the current version integrated in BR: 2.30.2):
> http://git.gnome.org/browse/glib/patch/?id=03611f7c0670ea14eedbc121972aed7ce60bb9ee
> 
> So, I'll send a patch integrating the upstream patch.
> If this new patch is accepted, then this patch series (host-python2
> and libglib2 depending on python2) could be discarded.

Excellent! Thanks a lot for the follow-up work. I will discard your
previous patches from the patchwork, and we'll wait for your new patch
integrating the upstream glib solution for this.

Thanks again for working on this!

Thomas
Samuel Martin Aug. 20, 2012, 8:23 p.m. UTC | #7
Hi Thomas,

2012/8/20 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>:
> Hello,
>
[...]
>
> Excellent! Thanks a lot for the follow-up work. I will discard your
> previous patches from the patchwork, and we'll wait for your new patch
> integrating the upstream glib solution for this.
Here it is:
http://patchwork.ozlabs.org/patch/178456/

> Thanks again for working on this!
de nada ;)


Cheers,
diff mbox

Patch

diff --git a/package/libglib2/libglib2.mk b/package/libglib2/libglib2.mk
index d2445a1..500f309 100644
--- a/package/libglib2/libglib2.mk
+++ b/package/libglib2/libglib2.mk
@@ -42,7 +42,10 @@  LIBGLIB2_CONF_ENV = \
 		ac_use_included_regex=no gl_cv_c_restrict=no \
 		ac_cv_path_GLIB_GENMARSHAL=$(HOST_DIR)/usr/bin/glib-genmarshal ac_cv_prog_F77=no \
 		ac_cv_func_posix_getgrgid_r=no \
-		gt_cv_c_wchar_t=$(if $(BR2_USE_WCHAR),yes,no)
+		gt_cv_c_wchar_t=$(if $(BR2_USE_WCHAR),yes,no) \
+		ac_cv_path_PYTHON=$(PYTHON2)
+
+HOST_LIBGLIB2_CONF_ENV += ac_cv_path_PYTHON=$(PYTHON2)
 
 # old uClibc versions don't provide qsort_r
 ifeq ($(BR2_UCLIBC_VERSION_0_9_31)$(BR2_UCLIBC_VERSION_0_9_32)$(BR2_TOOLCHAIN_CTNG_uClibc)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
@@ -57,7 +60,9 @@  HOST_LIBGLIB2_CONF_OPT = \
 
 LIBGLIB2_DEPENDENCIES = host-pkg-config host-libglib2 libffi zlib $(if $(BR2_NEEDS_GETTEXT),gettext libintl)
 
-HOST_LIBGLIB2_DEPENDENCIES = host-pkg-config host-libffi host-zlib
+HOST_LIBGLIB2_DEPENDENCIES = host-pkg-config host-libffi host-zlib $(NEED_PYTHON2)
+
+LIBGLIB2_DEPENDENCIES += $(NEED_PYTHON2)
 
 ifneq ($(BR2_ENABLE_LOCALE),y)
 LIBGLIB2_DEPENDENCIES += libiconv