[Mesa-dev] meson: Build with Python 3

Mathieu Bridon bochecha at daitauha.fr
Thu Jul 5 13:17:31 UTC 2018


This patch series allows building Mesa with Python 3.

The build scripts are kept compatible with Python 2 as well, for those
platforms which don't have Python 3 yet.

In fact, only the Meson build system is moved to Python 3, since it is
the only one I'm 100% sure has Python 3 available. (Meson itself
requires it)

I briefly thought about adding an option to the Meson build system to
control which version of Python to build with, but decided against. I'm
happy to add it if you think it's necessary.

I checked (with the `diff` command) that all the scripts output the
exact same things when built with Meson on:

* master (as of f9b6dfd919 which includes my patches to make the build
  output reproducible)
* the second to last patch in this series (that is, all the scripts
  changed but still building with Python 2)
* the last patch in this series (that is, with Python 3)

Each patch fixes a single type of problem in multiple
scripts/subsystems. As a result, it should be possible to review and
merge each patch independently (but probably not in order), without
breaking the build.

It's a lot of changes:

 86 files changed, 1965 insertions(+), 1833 deletions(-)

The end goal is to be able to eventually remove Python 2 from future
versions of the Flatpak Freedesktop SDK, Mesa being one of the last few
things still requiring it.

For those who prefer reviewing a git repo, I have pushed the changes to
a fork on the FDO Gitlab:

*   a branch compatible with both Python 2 and 3, but still building with
    Python 2:

    https://gitlab.freedesktop.org/bochecha/mesa/tree/python-2-and-3

*   a branch building with Python 3:

    https://gitlab.freedesktop.org/bochecha/mesa/tree/python3





More information about the mesa-dev mailing list