Qt5 WebEngine and Python3

Adriaan de Groot groot at kde.org
Sun Sep 27 09:53:21 BST 2020


Hi distro-peeps,

If you, like me, are concerned about Qt5 WebEngine and how that is supposed to 
handle the deprecation of Python2 -- with all of Google's wretched build 
system and internals embedded inside -- then a port to Python3 is necessary, 
if only to keep Qt5 5.15.1 building after Python 2.7 really goes away.

I sat down for two weekends -- if KDE could build a better CORBA in one 
weekend (it did) and create an entire Free Software web renderer (it did) then 
surely fixing the demon offspring of our own web thing is also doable. The 
results are in the FreeBSD port as one big patch to the Python bits of the 
qt5-webengine tarball; apply them after configure.

The port lives here:

https://github.com/freebsd/freebsd-ports-kde/tree/webengine-python3/www/qt5-webengine/

the patches are either `python-patches.diff` or `files/python3-build.diff` 
depending on when you look at it; file history of the patch is really crappy 
because it's me running the webengine build a zillion times, cursing the 
Google management that hasn't updated their scripts consistently, or at all, 
for 12 years.

Status:

- it builds, 100%, and gives a webengine that can render web content (e.g. 
reading planet.kde.org)
- the JS engine is missing some methods; it may be because of sorting issues 
that APIs have gotten muddled or wrong. For instance, I get this kind of 
stderr output:

js: Uncaught (in promise) TypeError: Failed to execute 'setTimeout' on 
'Window': No function was found that matched the signature provided.
qml: Loading changed for request url : https://www.google.com/

<Unknown File>: Can't create role for unsupported data type
js: Uncaught TypeError: Failed to execute 'postMessage' on 'Window': No 
function was found that matched the signature provided.

- the patch is rife with fix-it-now kind of bodges; ideally I'd go back and 
understand the tooling better and re-build with a consistent type system, but 
honestly, I'm not being paid for this shit


What I'd like from distro's:

- give the patch a shot, drop python 2.7 from your webengine build and do it 
with Python3
- if you have cycles to spare (both brain and CPU), looking into the 
difference between available JS in the two builds would be a big boon. 

Obvious improvements:
- sorting of lots of the generated C++ output (jinja2 to generate c++ to 
compile later .. monstrous) has gone away, e.g. around line 559

-{% for tag in tags|sort if not tag.multipleTagNames and not tag.noTypeHelpers 
%}
+{% for tag in tags if not tag.multipleTagNames and not tag.noTypeHelpers %}

  After dealing with this a dozen times, I now know that sort(attribute=name) 
is probably what's intended there and it makes the output more like the 
Python2.7 version.
- some internal (i hope) enums are re-ordered, that's another thing to chase 
sorting for


Since FreeBSD is removing Python 2.7 from the ports and packages in december, 
and has marked webengine as deprecated because of this, I thought it was time 
to get things done. It's at about .. mm .. 66%, because I reckon the wrangling 
for JS is going to take another weekend and even with massive ccache and memfs 
builds are neither pleasant nor fast.

[ade]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/distributions/attachments/20200927/fe611e4e/attachment.sig>


More information about the Distributions mailing list