After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 618562 - gobject-introspection does not build with python 2.7
gobject-introspection does not build with python 2.7
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal minor
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-05-13 18:04 UTC by Julien Gormotte
Modified: 2015-02-07 17:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Log from the 'make' command (3.44 KB, application/octet-stream)
2010-05-13 18:04 UTC, Julien Gormotte
  Details
Proposed patch (820 bytes, patch)
2010-07-22 17:38 UTC, Patryk Zawadzki
committed Details | Review
[scanner] Make it compatible with python 2.y (1.22 KB, patch)
2010-07-22 17:44 UTC, Johan (not receiving bugmail) Dahlin
committed Details | Review

Description Julien Gormotte 2010-05-13 18:04:34 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
Comment 1 Johan (not receiving bugmail) Dahlin 2010-05-13 18:07:52 UTC
Seems that the protocol for objects passed in to the with statement got a bit stricter:

  • File "/usr/local/src/gobject-introspection/giscanner/xmlwriter.py", line 70 in <module>
    with LibtoolImporter:
AttributeError: __exit__

I suspect the solution is to create a singleton instance of the importer and use instead of the class.
Comment 2 Johan (not receiving bugmail) Dahlin 2010-05-13 18:23:00 UTC
Seems to be related to http://bugs.python.org/issue6101
Comment 3 Julien Gormotte 2010-05-20 17:16:46 UTC
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.
Comment 4 Mike Auty 2010-07-15 00:43:10 UTC
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
Comment 5 Colin Walters 2010-07-15 19:55:21 UTC
Patches accepted.
Comment 6 Mike Auty 2010-07-15 20:11:27 UTC
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
Comment 7 Patryk Zawadzki 2010-07-22 17:36:39 UTC
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).
Comment 8 Patryk Zawadzki 2010-07-22 17:38:13 UTC
Created attachment 166407 [details] [review]
Proposed patch

Attaching the patch for future reference.
Comment 9 Johan (not receiving bugmail) Dahlin 2010-07-22 17:44:10 UTC
The following fix has been pushed:
7bcb292 [scanner] Make it compatible with python 2.y
Comment 10 Johan (not receiving bugmail) Dahlin 2010-07-22 17:44:23 UTC
Created attachment 166409 [details] [review]
[scanner] Make it compatible with python 2.y
Comment 11 André Klapper 2015-02-07 17:03:48 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]