From e6c8d7f98cd785d2a4ccaf777a9c3d0016a3da19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Montury?= <10528250-pytgaen@users.noreply.gitlab.com> Date: Sat, 3 May 2025 16:12:42 +0200 Subject: [PATCH] fix: add python cmd when python3 is present --- templates/gitlab-ci-python.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/templates/gitlab-ci-python.yml b/templates/gitlab-ci-python.yml index 6a37606..0f07fb6 100644 --- a/templates/gitlab-ci-python.yml +++ b/templates/gitlab-ci-python.yml @@ -607,6 +607,17 @@ variables: fi } + function enforce_python_cmd() { + _p3=$(command -v python3) + if [[ "$_p3" ]] && ! command -v python > /dev/null + then + _p3dir=$(dirname "$_p3") + ln -s "$_p3" "$_p3dir/python" + if [ -n "$TRACE" ]; then + log_info "python3 symlinked to $_p3dir/python" + fi + fi + } function guess_build_system() { _start_time=$(get_current_ts_ms) @@ -1090,6 +1101,7 @@ stages: before_script: - !reference [.python-scripts] - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}" + - enforce_python_cmd - cd ${PYTHON_PROJECT_DIR} - guess_build_system -- GitLab