[Mesa-dev] meson: Build with Python 3

Jose Fonseca jfonseca at vmware.com
Fri Jul 6 10:22:43 UTC 2018


AFAICS, we use python 2 in two places:

(1) SCons*

   I suspect using Python 3 will be far from straightforward, as it will 
require newer SCons versions, and all that's implied.

   So I rather not embark on this yet.

(2) C code generation scripts

   Python 3.5 seems to be included on our build environment for all 
supported OSes.

   So I think it should be possible to start using Python 3 for the 
scripts.  We just need to ensure the Scons* files use python 3 interpreter.

   That said, it's better if we can keep using Python 2 and 3 at the 
same time, for a transitory period, so we have time to iron out any 
wrinkles transitioning, which is not possible if we do a "all or 
nothing" approach.


Jose

On 05/07/18 16:51, Dylan Baker wrote:
> Dave, Brian, and Jose,
> 
> IIRC when we discussed migrating piglit to python 3 (and went with a hybrid
> approach instead), y'all had requirements to run on python 2, and couldn't
> support python 3. Is that still the case, or would moving to python 3 be
> acceptable?
> 
> Quoting Mathieu Bridon (2018-07-05 06:17:31)
>> 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
>>
>>
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list