You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by vt...@apache.org on 2026/04/14 12:42:55 UTC

(beam) 01/01: Cherrypick #38162

This is an automated email from the ASF dual-hosted git repository.

vterentev pushed a commit to branch cp-38162
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 2c469e4b34042b9bb4bf4fa7f45c820660333e80
Author: Vitaly Terentyev <vi...@akvelon.com>
AuthorDate: Tue Apr 14 16:42:39 2026 +0400

    Cherrypick #38162
---
 .../java/container/license_scripts/license_script.sh | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/sdks/java/container/license_scripts/license_script.sh b/sdks/java/container/license_scripts/license_script.sh
index 850703d5250..dfbba9e33d2 100755
--- a/sdks/java/container/license_scripts/license_script.sh
+++ b/sdks/java/container/license_scripts/license_script.sh
@@ -18,6 +18,13 @@ set -e
 
 # Get currently used Python version from Gradle or assume a default.
 PYTHON=${1:-python3}
+if ! command -v "${PYTHON}" >/dev/null 2>&1; then
+  if command -v python3 >/dev/null 2>&1; then
+    PYTHON=python3
+  else
+    PYTHON=python
+  fi
+fi
 SCRIPT_DIR="${PWD}/license_scripts"
 ENV_DIR="${PWD}/build/virtualenv"
 
@@ -39,8 +46,19 @@ echo "Copying already-fetched licenses from ${EXISTING_LICENSE_DIR} to ${DOWNLOA
 if [ -d "$DOWNLOAD_DIR" ]; then rm -rf "$DOWNLOAD_DIR" ; fi
 mkdir -p "$DOWNLOAD_DIR"
 cp -r "${EXISTING_LICENSE_DIR}"/*.jar "${DOWNLOAD_DIR}"
-python -m venv --clear ${ENV_DIR}  --without-pip --system-site-packages
+${PYTHON} -m venv --clear ${ENV_DIR} --without-pip --system-site-packages
 . ${ENV_DIR}/bin/activate
+if ! python -m pip --version >/dev/null 2>&1; then
+  GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py"
+  if command -v curl >/dev/null 2>&1; then
+    curl -sSL "$GET_PIP_URL" | python
+  elif command -v wget >/dev/null 2>&1; then
+    wget -qO- "$GET_PIP_URL" | python
+  else
+    echo "Neither curl nor wget found; cannot bootstrap pip"
+    exit 1
+  fi
+fi
 python -m pip install --retries 10 --upgrade pip setuptools wheel
 
 # install packages