Skip to content

Dockerfiles: Make python always execute python3#245

Open
minosgalanakis wants to merge 2 commits into
Mbed-TLS:mainfrom
minosgalanakis:force-python-version-dockerfiles
Open

Dockerfiles: Make python always execute python3#245
minosgalanakis wants to merge 2 commits into
Mbed-TLS:mainfrom
minosgalanakis:force-python-version-dockerfiles

Conversation

@minosgalanakis

@minosgalanakis minosgalanakis commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

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

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
@minosgalanakis minosgalanakis added the size-xs Estimated task size: extra small (a few hours at most) label Jan 9, 2026

@gilles-peskine-arm gilles-peskine-arm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needed on arm-compilers.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs: ci needs design approval needs: review size-xs Estimated task size: extra small (a few hours at most)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants