GNOME Bugzilla – Bug 688070
port jhbuild to python3
Last modified: 2020-11-11 18:12:44 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):
2) I get the wrong PYTHONPATH inside jhbuild unless I put PYTHON=python3 in my environment.
Confirmed. The PYTHON=python3 workaround works, but is not obvious.
$ PYTHON=python3 jhbuild run sh -c 'echo $PYTHONPATH'
$ jhbuild run sh -c 'echo $PYTHONPATH'
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.
The PYTHONPATH issue is now discussed in bug 688353, let's limit this one to porting jhbuild itself to Python 3.
(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.
*** Bug 636518 has been marked as a duplicate of this bug. ***
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.
Created attachment 314009 [details] [review]
Make exception raising/handling Python3-compatible
I decided to fix this bug. First patch attached.
Review of attachment 314009 [details] [review]:
Thanks for the patch, committed in commit 2a8de2dfe9952493520e5a1f53a05a4244f59e81
(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
Thanks! I have another patch to add Python3 compatibility to httpcache. Will upload it now.
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):
Output is exactly the same.
(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.
jhbuild is Python 3 only now