[Mesa-dev] [PATCH v2 3/5] configure: Enforce python 2.7.x

Emil Velikov emil.l.velikov at gmail.com
Fri Aug 17 10:21:18 UTC 2018


On 16 August 2018 at 21:47, Dylan Baker <dylan at pnwbakers.com> wrote:
> Quoting Emil Velikov (2018-08-16 09:19:06)
>> On 16 August 2018 at 14:27, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> > On 15 August 2018 at 17:18, Dylan Baker <dylan at pnwbakers.com> wrote:
>> >> We don't want to support older versions of python 2 anymore, and we
>> >> don't support python 3.x in autotools currently.
>> >> ---
>> >>  configure.ac | 7 +++++++
>> >>  1 file changed, 7 insertions(+)
>> >>
>> >> diff --git a/configure.ac b/configure.ac
>> >> index c2155a541b0..78672734d06 100644
>> >> --- a/configure.ac
>> >> +++ b/configure.ac
>> >> @@ -162,6 +162,13 @@ if test -z "$PYTHON2"; then
>> >>          AC_MSG_ERROR([Python not found - unable to generate sources])
>> >>      fi
>> >>  else
>> >> +    PYTHON_VERSION=`$PYTHON2 --version |& awk '{print $2}'`  dnl Yes, python2 prints it's version to stderr
>> >> +    PYTHON_MAJOR=`echo $PYTHON_VERSION | cut -d . -f 1`
>> >> +    PYTHON_MINOR=`echo $PYTHON_VERSION | cut -d . -f 2`
>> >> +    if test $PYTHON_MAJOR -ne 2 -o $PYTHON_MINOR -ne 7; then
>> >> +        AC_MSG_ERROR([Python version 2.7.x not found - unable to generate sources])
>> >> +    fi
>> >> +
>> > A slightly better alternative is to use AM_PATH_PYTHON as seen here [1]
>> > Since there's no reason to keep autoconf python2 only, I've prepped a
>> > small series [2].
>
> I like your version much better (I secretly was hoping that you'd propose
> something less gross than my lame attempt), so I'll drop the autotools patches
> and just keep the scons and meson ones.
>
Ack. Thank you.

>> >
>> > Once everything is green I'll send it out. Until then, feel free to
>> > drop this or reuse as much/little from my patch.
>> >
>> Jfyi, some of the tests not been ported to python2+3, as mentioned here [A].
>> Would be great to check why they haven't flagged up in the meson CI.
>>
>
> Because the python file itself is python 2/3 safe (I wrote or re-wrote that when
> I did the initial meson port). The shell script invokes $PYTHON2 but that only
> exists to make it easier for autotools, meson invokes the underlying python by
> calling python3 foo.py.
>
That's the problem here, the code you wrote is python 2/3 safe, but
the old code that gets reused was not.
This went unnoticed since a) the execute bit of the files was set and
b) the shebang line was there.

I attempted to remove that before [1] and now it came to bite us :-\
Will update/resend the patch - there is no reason to have an exception here.

Thanks
Emil

[1] https://patchwork.freedesktop.org/patch/218603/


More information about the mesa-dev mailing list