[Webkit-unassigned] [Bug 184986] Make all python scripts compatible with both python2 and python3

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Dec 3 09:54:06 PST 2018


--- Comment #8 from Michael Catanzaro <mcatanzaro at igalia.com> ---
Nowadays distros (at least openSUSE and Fedora) are patching WebKit to build without python3, so we should retake this soon. Of the steps listed in my first comment, we only need to fix (1) now. (2-5) will be a lot of work and can come later.

(In reply to Michael Catanzaro from comment #0)
> python2 is going away on Linux, so we need to convert our scripts to be
> compatible with python3. But macOS does not have python2, so we need to be
> careful to maintain python2 compatibility. This means we should keep the
> existing #!/usr/bin/env python shebangs and just test all our scripts to
> ensure they work with /usr/bin/python symlinked to python3

This is no longer allowed for scripts used by the CMake build. We need to ensure all scripts called by the CMake build explicitly use the shebang #!/usr/bin/python3.

#!/usr/bin python is now explicitly banned in Fedora for being ambiguous.

#!/usr/bin/python2 is also banned for being python2.

And #!/usr/bin/env (what we mostly do now) is also banned since it could resolve to something other than the system interpreter.

The only allowed shebang is #!/usr/bin/python3. Of course, this won't work for Apple, nor for FreeBSD.

So for any scripts used by the CMake build that are also used by Apple, we need to either (a) *generate* the script using a CMake-time configure replacement, e.g. from a .py.cmake file, or (b) just remove the shebang and explicitly invoke the python3 interpreter when executing it from CMake. (We can add CMake code to detect whether to use python3 or python2.) Unless Apple magically gains python3 support and it happens to be installed as /usr/bin/python3, I believe those are the only two possible solution.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20181203/818e402d/attachment.html>

More information about the webkit-unassigned mailing list