Dockerfiles: Make python always execute python3#245
Conversation
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
gilles-peskine-arm
left a comment
There was a problem hiding this comment.
This is incomplete.
And I'm not sure it's desirable.
| true | ||
|
|
||
| # Make python point to python3 | ||
| RUN ln -sf /usr/bin/python3 /usr/local/bin/python |
There was a problem hiding this comment.
Also needed on 16.04 (but we want /usr/local/bin/python3 there, not /usr/bin/python3 which is too old).
| # to install several Python packages (done by individual jobs) | ||
| python3-venv \ | ||
| # make `python` invoke `python3` | ||
| python-is-python3 \ |
There was a problem hiding this comment.
In our script files we use python e.g link and python3 e.g. link interchangeably.
Historically, we used python3, not python, because during the python2→python3 transition, python was often python2. I don't know if that's still relevant in 2026, however. Ubuntu 20.04 was the last Ubuntu LTS where /usr/bin/python being Python 2 was officially supported. What about other OSes? What's /usr/bin/python on macOS these days?
Even if it's ok to no longer care about Python 2, I don't think we should use python3 and python interchangeably. That just makes things harder. Even if Python 2 is not available, python and python3 could be different versions of Python 3.x on some systems.
There was a problem hiding this comment.
Fix for make_generates_files.py: Mbed-TLS/mbedtls-framework#270
| # to install several Python packages (done by individual jobs) | ||
| python3-venv \ | ||
| # make `python` invoke `python3` | ||
| python-is-python3 \ |
There was a problem hiding this comment.
Also needed on arm-compilers.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
In our script files we use python e.g link and python3 e.g. link interchangeably. But across our CI that may not always be the same executable or version, since at 18:04 this is pointing to python 2.7.17 and on 20.04 that is pointing nowhere.
This is not required when we are running our scripts through a venv as we do most of the times so its a good to have change