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 682320 - Replace usage of __import__ with importlib.import_module
Replace usage of __import__ with importlib.import_module
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
unspecified
Other Linux
: Low minor
: GNOME 3.10
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-21 01:29 UTC by Simon Feltman
Modified: 2013-07-18 22:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Replace usage of __import__ with importlib.import_module (1.82 KB, patch)
2013-07-18 22:05 UTC, Simon Feltman
committed Details | Review

Description Simon Feltman 2012-08-21 01:29:57 UTC
The python developers are recommending to do this as seen in this discussion: 
http://bugs.python.org/issue15715

In regards to python versions, does pygobject support anything pre 2.7? It would be great to have some kind of official note on the wiki about this because supporting pre 2.7 does make working on this stuff more difficult. It may even help to give a build error for pre-2.7 versions of python (or whatever version support stops at) if this is the case.
Comment 1 Martin Pitt 2012-08-21 06:06:17 UTC
configure.ac says

m4_define(python_min_ver, 2.5.2)
m4_define(python3_min_ver, 3.1)

which I consider the authoritative source. We are in API/feature freeze for GNOME 3.6 since yesterday, so these should not be raised until we start the pygobject 3.5 series.

The currently frozen Debian release still supports 2.6 (will be dropped in the next release), Ubuntu only supports 2.7, I'm not sure about Fedora but as they are usually living on the edge I guess they only support 2.7 as well.

So I think for pygobject's 3.5 series for GNOME 3.8 it's fine to bump to >= 2.7. If you want to fix it before, we could do a sys.version_info check, but that's a bit ugly of course.
Comment 2 Simon Feltman 2012-08-21 07:05:36 UTC
Thanks for the info. I'm don't think adding a version check would be worthwhile if __import__ still works. Doing a full and clean replace targeting pygobject 3.5 seems right.
Comment 3 Martin Pitt 2012-10-23 07:34:27 UTC
PyGObject 3.4 supports 2.6 and newer. FWIW, I wouldn't mind if 3.7.x dropped 2.6 support and only supports 2.7 and 3.x, as 2.7 has been out for ages now.
Comment 4 Martin Pitt 2013-03-25 08:13:29 UTC
For the record, git master (3.9.x) supports only Python 2.7 now, so this is unblocked.
Comment 5 Simon Feltman 2013-07-18 22:05:16 UTC
The following fix has been pushed:
9042710 Replace usage of __import__ with importlib.import_module
Comment 6 Simon Feltman 2013-07-18 22:05:19 UTC
Created attachment 249573 [details] [review]
Replace usage of __import__ with importlib.import_module