Subject: Re: [PATCH] ci: fix Python dependency on Ubuntu 24.04

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 6 May 2024 15:02:52 +0200

On Mon, May 06, 2024 at 07:55:25AM -0500, Justin Tobler wrote:
> On 24/05/06 07:35AM, Patrick Steinhardt wrote:
> > Newer versions of Ubuntu have dropped Python 2 starting with Ubuntu
> > 23.04. By default though, our CI setups will try to use that Python
> > version on all Ubuntu-based jobs except for the "linux-gcc" one.
> 
> Naive question, why were the "linux-gcc" jobs the only ones using
> Python 3?

This has been introduced in 6bb40ed20a (ci: use python3 in linux-gcc and
osx-gcc and python2 elsewhere, 2020-01-23). It's been a first step
towards exercising Python 3 in our CI pipeline. The jobs were basically
picked at random, there is no inherent reason.

So ultimately, it does not matter which jobs use what. But what does
matter is whether the image even supports Python 2. And as we nowadays
do have a fair split of jobs using "ubuntu:20.04" and "ubuntu:latest",
I'd just use that the the criterium to pick the Python version.

Once we drop support for Ubuntu 20.04, we can then more forward and stop
supporting Python 2 altogether. Or maybe even earlier than that -- I do
not think it is reasonable to ask Git to maintain compatibility with a
project that is end of life already.

[snip]
> > diff --git a/ci/lib.sh b/ci/lib.sh
> > index 473a2d0348..273f3540a6 100755
> > --- a/ci/lib.sh
> > +++ b/ci/lib.sh
> > @@ -325,9 +325,13 @@ ubuntu-*)
> >  		break
> >  	fi
> >  
> > -	PYTHON_PACKAGE=python2
> > -	if test "$jobname" = linux-gcc
> 
> With this change, "linux-gcc" jobs using ubuntu 20.04 will now use
> Python 2. Is that what we want?

Well, as explained above, the selection was arbitrary in the first
place. Now it's less so as the choice is mandated by what is actually
supported.

Patrick