GNOME Bugzilla – Bug 618562
gobject-introspection does not build with python 2.7
Last modified: 2015-02-07 17:03:48 UTC
Created attachment 160989 [details] Log from the 'make' command gobject-introspection does not build with python 2.7 Tested on Funtoo Linux, x86_64
Seems that the protocol for objects passed in to the with statement got a bit stricter:
+ Trace 221889
with LibtoolImporter:
I suspect the solution is to create a singleton instance of the importer and use instead of the class.
Seems to be related to http://bugs.python.org/issue6101
Are you sure this is a minor bug ? There are chances that a lot of distributions will start using python 2.7 soon, so this could be a blocker for packaging.
Python have closed this bug[1] as being a GI issue, so any movement on this? Both 0.9.0 and 0.9.2 feature this problem and Gentoo are moving into the python-2.7 testing phase, so this may begin hitting users soon... [1] http://bugs.python.org/issue9259
Patches accepted.
PLD seem to have the following patch[1] although the only test I've given it is to compile gobject-introspection itself (which does run the g-ir-scanner and used to fail). I've no idea whether/how the patch works, but hopefully someone here will understand it a bit better... [1] http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/gobject-introspection/gobject-introspection-build.patch
PLD here. Python 2.7 was changed to conform to the language specification and the documentation. The specification says __enter__ and __exit__ are only looked for in the *class* of the object, not the instance. As "LibtoolImporter" is an instance of "type", the type is searched for the needed methods (and fails miserably). By instantiating LibtoolImporter, we make Python search the correct class ("LibtoolImporter(None, None)" is an instance of "LibtoolImporter"). Python is not buggy, its previous implementation was and gobject-introspection relies on the bug. Our fix is trivial and correct (albeit ugly, because the whole "with LibtoolImporter" having side effects is an ugly "clever" hack).
Created attachment 166407 [details] [review] Proposed patch Attaching the patch for future reference.
The following fix has been pushed: 7bcb292 [scanner] Make it compatible with python 2.y
Created attachment 166409 [details] [review] [scanner] Make it compatible with python 2.y
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]