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 688070 - port jhbuild to python3
port jhbuild to python3
Status: RESOLVED FIXED
Product: jhbuild
Classification: Infrastructure
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Jhbuild maintainers
Jhbuild QA
: 636518 (view as bug list)
Depends on:
Blocks: python3
 
 
Reported: 2012-11-11 00:32 UTC by Matthias Clasen
Modified: 2020-11-11 18:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make exception raising/handling Python3-compatible (28.34 KB, patch)
2015-10-24 10:51 UTC, Boris Egorov
committed Details | Review
Make httpcache Python3 compatible (3.44 KB, patch)
2016-02-10 16:54 UTC, Boris Egorov
none Details | Review

Description Matthias Clasen 2012-11-11 00:32:12 UTC
We're porting GNOME to python3 for 3.8.

I see at least 2 issues with jhbuild:

1) jhbuild itself doesn't work with python3:

python3 jhbuild shell
Traceback (most recent call last):
  • File "/home/mclasen/bin/jhbuild", line 6 in <module>
    import __builtin__
ImportError: No module named '__builtin__'


2) I get the wrong PYTHONPATH inside jhbuild unless I put PYTHON=python3 in my environment.
Comment 1 Martin Pitt 2012-11-16 09:27:54 UTC
Confirmed. The PYTHON=python3 workaround works, but is not obvious.

$ PYTHON=python3 jhbuild run  sh -c 'echo $PYTHONPATH'
/home/martin-scratch/gnome/lib/python3.3/site-packages:/home/martin-scratch/gnome/lib64/python3.3/site-packages

$ jhbuild run  sh -c 'echo $PYTHONPATH'
/home/martin-scratch/gnome/lib/python2.7/site-packages:/home/martin-scratch/gnome/lib64/python2.7/site-packages

Without PYTHON=python3, running something through python3 tries to load the python 2 extensions (such as libpyglib-gi-2.0-python2.so.0), which fails horribly.

I don't immediately have a good idea how to fix this properly. Having support for $PYTHON3PATH (http://bugs.python.org/issue2375) would be ideal.
Comment 2 Frederic Peters 2012-11-16 09:54:06 UTC
The PYTHONPATH issue is now discussed in bug 688353, let's limit this one to porting jhbuild itself to Python 3.
Comment 3 Colin Walters 2012-11-16 14:12:59 UTC
(In reply to comment #2)
> The PYTHONPATH issue is now discussed in bug 688353, let's limit this one to
> porting jhbuild itself to Python 3.

Will it still support being run under python2.6+ in this plan?  I use jhbuild heavily on older systems such as RHEL6.  I suppose I could install python3...but it'd be nice not to have to.
Comment 4 Frederic Peters 2013-03-03 21:37:35 UTC
*** Bug 636518 has been marked as a duplicate of this bug. ***
Comment 5 Marcin Wojdyr 2013-05-30 11:15:39 UTC
We use it on RHEL5 with Python 2.4, which I think is the oldest still officially supported distro. We do it for a reason: binaries built on RHEL5 usually work fine on all newer distros.

According to the manual Python 2.3 also should work, but afair it doesn't.
Comment 6 Boris Egorov 2015-10-24 10:51:26 UTC
Created attachment 314009 [details] [review]
Make exception raising/handling Python3-compatible

I decided to fix this bug. First patch attached.
Comment 7 Javier Jardón (IRC: jjardon) 2016-02-10 02:11:27 UTC
Review of attachment 314009 [details] [review]:

Thanks for the patch, committed in commit 2a8de2dfe9952493520e5a1f53a05a4244f59e81
Comment 8 Boris Egorov 2016-02-10 16:51:06 UTC
(In reply to Javier Jardón (IRC: jjardon) from comment #7)
> Review of attachment 314009 [details] [review] [review]:
> 
> Thanks for the patch, committed in commit
> 2a8de2dfe9952493520e5a1f53a05a4244f59e81

Thanks! I have another patch to add Python3 compatibility to httpcache. Will upload it now.
Comment 9 Boris Egorov 2016-02-10 16:54:23 UTC
Created attachment 320807 [details] [review]
Make httpcache Python3 compatible

I tested this with a simple 'test': pasted this in the end of the file and executed file under both versions of python:

    if __name__ == "__main__":
        filename = load('http://live.gnome.org/FredericPeters/Bugs299?action=raw')
        for line in open(filename):
            print(line.strip())


Output is exactly the same.
Comment 10 John Ralls 2017-06-24 21:51:24 UTC
(In reply to Michael Catanzaro from comment #8 on bug 781938)
> Probably time to investigate porting JHBuild to Python 3....

(In reply to John Ralls from comment #9 on bug 781938)
> (In reply to Michael Catanzaro from comment #8)
> > Probably time to investigate porting JHBuild to Python 3....
> 
> If you do that please keep it working with Py2 as well. After a brief
> flirtation with Py3 in 10.6 Apple has shipped only Py2.

(In reply to Michael Catanzaro from comment #10 on bug 781938)
> I'm surprised macOS users are using JHBuild! I think that's fine, so long as
> it's not holding back the core codebase. Maintaining support for Python 2
> would be too much IMO. We've already ported most of the rest of GNOME to
> Python 3 without maintaining Python 2 compatibility.
> 
> Anyway, let's move further discussion on this to bug #688070, and focus here
> on meson builddir deletion.

https://wiki.gnome.org/action/show/Projects/GTK+/OSX. Not new.

Hot diggity! I'd missed that G-I had gotten fixed up for Python3. It does still work fine with Python2, BTW.
Comment 11 Christoph Reiter (lazka) 2020-11-11 18:12:44 UTC
jhbuild is Python 3 only now