You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by mg...@apache.org on 2026/04/16 14:46:15 UTC

(kudu) branch master updated (bee410f8a -> be9e859da)

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

mgreber pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


    from bee410f8a modernize code with WARN_UNUSED_RESULT attribute
     new f1531669c [gitignore] ignore .qtcreator dir
     new be9e859da [Python] add compatibility testing

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                                         |   1 +
 build-support/python-compat/README.md              |  66 ++++++++
 .../python-compat/bootstrap-deadsnakes-python.sh   | 105 ++++++++++++
 build-support/python-compat/test-client.sh         | 185 +++++++++++++++++++++
 build-support/python-compat/test-packaging.sh      | 140 ++++++++++++++++
 .../{tidy.sh => python-compat/versions.sh}         |  25 +--
 6 files changed, 510 insertions(+), 12 deletions(-)
 create mode 100644 build-support/python-compat/README.md
 create mode 100755 build-support/python-compat/bootstrap-deadsnakes-python.sh
 create mode 100755 build-support/python-compat/test-client.sh
 create mode 100755 build-support/python-compat/test-packaging.sh
 copy build-support/{tidy.sh => python-compat/versions.sh} (56%)
 mode change 100755 => 100644


(kudu) 01/02: [gitignore] ignore .qtcreator dir

Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mgreber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit f1531669cc74f73fa9cbadedf062fff90aad9f44
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Wed Apr 15 15:35:26 2026 -0700

    [gitignore] ignore .qtcreator dir
    
    Change-Id: I44cf78d4b25ed1a4f6a7dd17a03da7a410bce740
    Reviewed-on: http://gerrit.cloudera.org:8080/24195
    Tested-by: Kudu Jenkins
    Reviewed-by: Marton Greber <gr...@gmail.com>
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index f4ca38c5a..73d2f6bf5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,6 +46,7 @@ README.html
 .idea/
 .project
 .qt/
+.qtcreator/
 .qtc_clangd/
 .settings/
 .vscode/


(kudu) 02/02: [Python] add compatibility testing

Posted by mg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mgreber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit be9e859daa2155cdc51e0e7ba547b8b3d0d7022b
Author: Marton Greber <gr...@gmail.com>
AuthorDate: Tue Mar 31 11:11:52 2026 +0200

    [Python] add compatibility testing
    
    The Kudu Python client declares support for Python 2.7 and 3.6–3.11
    in its trove classifiers, but had no mechanism to verify that the build,
    test suite, and sdist packaging actually work across all those versions.
    
    build-support/python-compat/ fills this gap with shell scripts that
    bootstrap each interpreter via the deadsnakes PPA and exercise the
    full build+test+package cycle per version:
      bootstrap-deadsnakes-python.sh  install all supported interpreters
      test-client.sh                  build extension + run test suite
      test-packaging.sh               sdist round-trip in a clean venv
    
    test-client.sh supports a -j [N] flag for parallel execution across
    versions (mirroring make -j semantics).  Parallel builds are safe
    because each version gets its own isolated copy of the source tree
    under /tmp: setup.py generates several files in-tree at import time
    (config.pxi, version.py, kudu/*.cpp) that would otherwise race when
    multiple interpreters build concurrently.  The source tree is cleaned
    once up-front and then copied per version with cp -aL (dereferencing
    symlinks such as version.txt -> ../version.txt) so every build starts
    from a known-clean state.
    
    Tools like tox exist for exactly this kind of test-matrix work, but
    supporting a range that stretches back to Python 2.7 requires older
    virtualenv versions that conflict with modern toolchains, making a
    tox setup more brittle than the straightforward shell scripts here.
    
    These scripts are intended to be run manually by developers when
    adding or dropping a supported Python version, and as part of the
    release checklist to confirm packaging works across the full matrix.
    They are not wired into CI.
    
    DONT_BUILD
    
    Change-Id: Id1f4e6c837a0a3e9da531627ec38f1c452341c11
    Reviewed-on: http://gerrit.cloudera.org:8080/24155
    Reviewed-by: Zoltan Chovan <zc...@cloudera.com>
    Tested-by: Marton Greber <gr...@gmail.com>
    Reviewed-by: Zoltan Martonka <zm...@cloudera.com>
---
 build-support/python-compat/README.md              |  66 ++++++++
 .../python-compat/bootstrap-deadsnakes-python.sh   | 105 ++++++++++++
 build-support/python-compat/test-client.sh         | 185 +++++++++++++++++++++
 build-support/python-compat/test-packaging.sh      | 140 ++++++++++++++++
 build-support/python-compat/versions.sh            |  34 ++++
 5 files changed, 530 insertions(+)

diff --git a/build-support/python-compat/README.md b/build-support/python-compat/README.md
new file mode 100644
index 000000000..37be08336
--- /dev/null
+++ b/build-support/python-compat/README.md
@@ -0,0 +1,66 @@
+<!---
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# python-compat
+
+Test infrastructure for verifying the Kudu Python client builds, passes its
+test suite, and packages correctly across all supported Python versions.
+
+Useful when:
+- A new Python version is added or dropped
+- Preparing a release
+
+## Scripts
+
+| Script | What it does |
+|---|---|
+| `bootstrap-deadsnakes-python.sh` | Installs all supported Python interpreters via the deadsnakes PPA (Ubuntu/Debian) |
+| `test-client.sh` | For each version: builds the Cython extension and runs the test suite |
+| `test-packaging.sh` | For each version: builds an sdist and installs it in a clean venv to verify packaging |
+
+The list of supported versions is derived from the trove classifiers in
+`python/setup.py` — that is the single source of truth.
+
+## Usage
+
+Run once to set up interpreters, then run the test scripts:
+
+```bash
+# 1. Install all supported Python interpreters
+./bootstrap-deadsnakes-python.sh
+
+# 2. Verify the client builds and tests pass
+./test-client.sh
+
+# 3. Verify sdist packaging round-trip
+./test-packaging.sh
+```
+
+To test a specific version or subset:
+
+```bash
+./test-client.sh 3.12
+./test-client.sh 3.11 3.12 3.13
+```
+
+## Prerequisites
+
+- Ubuntu/Debian with `sudo` and `apt-get`
+- `virtualenv` on PATH (`pip install virtualenv`)
+- Kudu built with `KUDU_HOME` pointing to the repo root (or inferred automatically)
diff --git a/build-support/python-compat/bootstrap-deadsnakes-python.sh b/build-support/python-compat/bootstrap-deadsnakes-python.sh
new file mode 100755
index 000000000..1e0a05e6b
--- /dev/null
+++ b/build-support/python-compat/bootstrap-deadsnakes-python.sh
@@ -0,0 +1,105 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Test infrastructure script: install every Python version supported by the
+# Kudu Python client via the deadsnakes PPA, then run a smoke test for each.
+#
+# Usage:
+#   ./bootstrap-deadsnakes-python.sh
+#
+# Requires: Ubuntu/Debian with apt-get and sudo.
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+export KUDU_HOME="${KUDU_HOME:-$(cd "${SCRIPT_DIR}/../.." && pwd)}"
+PYTHON_DIR="${KUDU_HOME}/python"
+
+source "${SCRIPT_DIR}/versions.sh"
+
+log() { echo "[bootstrap-deadsnakes] $*"; }
+die() { echo "[bootstrap-deadsnakes] ERROR: $*" >&2; exit 1; }
+
+[[ -x "/usr/bin/apt-get" ]] || die "This script requires apt-get (Ubuntu/Debian)."
+command -v sudo >/dev/null 2>&1 || die "sudo is required."
+command -v virtualenv >/dev/null 2>&1 || die "virtualenv is required."
+
+# One-time setup: deadsnakes PPA + prerequisites
+setup_ppa() {
+  log "Updating apt index and ensuring prerequisites..."
+  sudo apt-get update -y
+  sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+    software-properties-common ca-certificates curl
+
+  if ! grep -rq "deadsnakes/ppa" /etc/apt/sources.list /etc/apt/sources.list.d/ 2>/dev/null; then
+    log "Adding deadsnakes PPA..."
+    sudo add-apt-repository -y ppa:deadsnakes/ppa
+    sudo apt-get update -y
+  else
+    log "deadsnakes PPA already present."
+  fi
+}
+
+# Smoke test: verify the interpreter works and a venv can be created
+smoke_test() {
+  local ver="$1"
+  local py_bin="python${ver}"
+
+  command -v "${py_bin}" >/dev/null 2>&1 || die "${py_bin} not found on PATH after install."
+
+  local work
+  work="$(mktemp -d)"
+  local venv_dir="${work}/venv"
+
+  log "Creating temp venv with ${py_bin}..."
+  virtualenv -p "${py_bin}" "${venv_dir}" >/dev/null
+
+  source "${venv_dir}/bin/activate"
+  python -c "import sys; print('OK:', sys.version)"
+  python -m pip --version >/dev/null
+  deactivate || true
+  rm -rf "${work}"
+}
+
+setup_ppa
+
+summary_ok=()
+summary_skip=()
+summary_fail=()
+
+for ver in "${SUPPORTED_VERSIONS[@]}"; do
+  log "=== Python ${ver} ==="
+  log "Installing: python${ver} python${ver}-dev"
+  sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+    "python${ver}" "python${ver}-dev"
+  if smoke_test "${ver}"; then
+    log "OK Python ${ver} ready."
+    summary_ok+=("${ver}: OK")
+  else
+    summary_fail+=("${ver}: FAIL")
+  fi
+done
+
+echo ""
+log "Summary:"
+for line in "${summary_ok[@]+"${summary_ok[@]}"}";    do echo "  ${line}"; done
+for line in "${summary_skip[@]+"${summary_skip[@]}"}"; do echo "  ${line}"; done
+for line in "${summary_fail[@]+"${summary_fail[@]}"}"; do echo "  ${line}"; done
+
+[[ ${#summary_fail[@]} -eq 0 ]] || exit 1
diff --git a/build-support/python-compat/test-client.sh b/build-support/python-compat/test-client.sh
new file mode 100755
index 000000000..49fa6c16c
--- /dev/null
+++ b/build-support/python-compat/test-client.sh
@@ -0,0 +1,185 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# For each requested Python version:
+#   0. make clean         -- remove stale build artifacts (run once, up-front)
+#   1. Copy python/ to an isolated temp dir (e.g. /tmp/kudu-python-311-XXXXXX)
+#   2. Create a venv inside that temp dir
+#   3. make requirements  -- install dev dependencies into the venv
+#   4. make build         -- compile the Cython extension in-place
+#   5. make test          -- run the test suite
+#   6. Remove the temp dir
+#
+# Each version builds in its own temp copy of the source tree, so parallel
+# invocations never race on shared generated files (config.pxi, version.py,
+# *.cpp, build/).
+#
+# Usage:
+#   ./test-client.sh               # test all supported versions
+#   ./test-client.sh 3.12          # test a single version
+#   ./test-client.sh 3.11 3.12     # test a subset
+#   ./test-client.sh -j            # run all versions in parallel
+#   ./test-client.sh -j4           # run up to 4 versions in parallel
+#   ./test-client.sh -j 3.11 3.12  # parallel subset (unlimited)
+#
+# Environment:
+#   KUDU_HOME   If unset, inferred from the script location (two levels up)
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+export KUDU_HOME="${KUDU_HOME:-$(cd "${SCRIPT_DIR}/../.." && pwd)}"
+PYTHON_DIR="${KUDU_HOME}/python"
+
+cd "${PYTHON_DIR}"
+
+source "${SCRIPT_DIR}/versions.sh"
+
+MAX_JOBS=0  # 0 = sequential; >0 = parallel with that concurrency limit
+VERSIONS=()
+while [[ $# -gt 0 ]]; do
+  case "$1" in
+    -j)   MAX_JOBS=$(( ${#SUPPORTED_VERSIONS[@]} )); shift ;;  # unlimited
+    -j*)  MAX_JOBS="${1#-j}"; shift ;;                         # -j4 style
+    *)    VERSIONS+=("$1"); shift ;;
+  esac
+done
+if [[ ${#VERSIONS[@]} -eq 0 ]]; then
+  VERSIONS=("${SUPPORTED_VERSIONS[@]}")
+fi
+
+log() { echo "[test-client] $*"; }
+die() { echo "[test-client] ERROR: $*" >&2; exit 1; }
+
+if command -v virtualenv >/dev/null 2>&1; then
+  VIRTUALENV_CMD=(virtualenv)
+elif python3 -m virtualenv --version >/dev/null 2>&1; then
+  VIRTUALENV_CMD=(python3 -m virtualenv)
+else
+  die "virtualenv is required."
+fi
+
+run_one() {
+  local ver="$1"
+  local py_bin="python${ver}"
+  # venv name: strip the dot, e.g. 2.7 -> venv_27, 3.11 -> venv_311
+  local venv_name="venv_${ver/./}"
+
+  if ! command -v "${py_bin}" >/dev/null 2>&1; then
+    log "SKIP ${ver}: ${py_bin} not found on PATH"
+    # return 2 distinct from 0 (OK) and 1 (FAIL) so callers can label it correctly
+    return 2
+  fi
+  local py_path
+  py_path="$(command -v "${py_bin}")"
+
+  # Each version gets its own copy of the source tree so parallel builds
+  # don't race on shared generated files (config.pxi, version.py, *.cpp, build/).
+  local work_dir
+  work_dir="$(mktemp -d /tmp/kudu-python-${ver}-XXXXXX)"
+  cp -aL "${PYTHON_DIR}/." "${work_dir}/"
+  cd "${work_dir}"
+
+  log "=== Python ${ver} -> ${work_dir}/${venv_name} ==="
+
+  log "Creating ${venv_name} with: ${VIRTUALENV_CMD[*]} -p ${py_path}"
+  "${VIRTUALENV_CMD[@]}" -p "${py_path}" "${venv_name}"
+
+  source "${venv_name}/bin/activate"
+
+  local rc=0
+
+  log "make requirements"
+  make requirements || { log "FAIL ${ver}: make requirements"; rc=1; }
+
+  if [[ "${rc}" -eq 0 ]]; then
+    log "make build"
+    make build || { log "FAIL ${ver}: make build"; rc=1; }
+  fi
+
+  if [[ "${rc}" -eq 0 ]]; then
+    log "make test"
+    make test || { log "FAIL ${ver}: make test"; rc=1; }
+  fi
+
+  [[ "${rc}" -eq 0 ]] && log "OK ${ver}"
+  deactivate 2>/dev/null || true
+  cd "${PYTHON_DIR}"
+  rm -rf "${work_dir}"
+  return "${rc}"
+}
+
+log "KUDU_HOME=${KUDU_HOME}"
+log "PYTHON_DIR=${PYTHON_DIR}"
+log "Versions: ${VERSIONS[*]}"
+log "make clean"
+make clean
+
+failed=0
+summary=()
+
+if [[ "${MAX_JOBS}" -gt 0 ]]; then
+  log "Running ${#VERSIONS[@]} version(s) in parallel (max jobs: ${MAX_JOBS})..."
+  WORK_DIR="$(mktemp -d)"
+  log "Log dir: ${WORK_DIR}  (tail -f ${WORK_DIR}/<ver>.log to monitor)"
+  declare -a pids=()
+  running=0
+
+  for ver in "${VERSIONS[@]}"; do
+    # Throttle: wait for a slot before spawning the next job.
+    while [[ "${running}" -ge "${MAX_JOBS}" ]]; do
+      wait -n 2>/dev/null || true
+      running=$(( running - 1 ))
+    done
+    run_one "${ver}" > "${WORK_DIR}/${ver}.log" 2>&1 &
+    pids+=($!)
+    running=$(( running + 1 ))
+  done
+
+  for i in "${!VERSIONS[@]}"; do
+    ver="${VERSIONS[$i]}"
+    ec=0; wait "${pids[$i]}" || ec=$?
+    case "${ec}" in
+      0) summary+=("${ver}: OK") ;;
+      2) summary+=("${ver}: SKIP") ;;
+      *) summary+=("${ver}: FAIL"); failed=1 ;;
+    esac
+    log "--- Output: Python ${ver} ---"
+    cat "${WORK_DIR}/${ver}.log"
+  done
+
+  rm -rf "${WORK_DIR}"
+else
+  for ver in "${VERSIONS[@]}"; do
+    ec=0; run_one "${ver}" || ec=$?
+    case "${ec}" in
+      0) summary+=("${ver}: OK") ;;
+      2) summary+=("${ver}: SKIP") ;;
+      *) summary+=("${ver}: FAIL"); failed=1 ;;
+    esac
+  done
+fi
+
+echo ""
+log "Summary:"
+for line in "${summary[@]}"; do
+  echo "  ${line}"
+done
+
+[[ "${failed}" -eq 0 ]] || exit 1
diff --git a/build-support/python-compat/test-packaging.sh b/build-support/python-compat/test-packaging.sh
new file mode 100755
index 000000000..7a2695753
--- /dev/null
+++ b/build-support/python-compat/test-packaging.sh
@@ -0,0 +1,140 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# For each requested Python version:
+#   1. Build an sdist in a clean venv
+#   2. Install that sdist in a second clean venv
+#   3. Verify the package imports correctly
+#
+# Usage:
+#   ./test-packaging.sh               # test all supported versions
+#   ./test-packaging.sh 3.12          # test a single version
+#   ./test-packaging.sh 3.11 3.12     # test a subset
+#
+# Environment:
+#   KUDU_HOME   If unset, inferred from the script location (two levels up)
+
+set -euo pipefail
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+export KUDU_HOME="${KUDU_HOME:-$(cd "${SCRIPT_DIR}/../.." && pwd)}"
+PYTHON_DIR="${KUDU_HOME}/python"
+
+cd "${PYTHON_DIR}"
+
+source "${SCRIPT_DIR}/versions.sh"
+
+if [[ $# -gt 0 ]]; then
+  VERSIONS=("$@")
+else
+  VERSIONS=("${SUPPORTED_VERSIONS[@]}")
+fi
+
+log() { echo "[test-packaging] $*"; }
+die() { echo "[test-packaging] ERROR: $*" >&2; exit 1; }
+ok()  { echo "[test-packaging] OK    $*"; }
+
+if command -v virtualenv >/dev/null 2>&1; then
+  VIRTUALENV_CMD=(virtualenv)
+elif python3 -m virtualenv --version >/dev/null 2>&1; then
+  VIRTUALENV_CMD=(python3 -m virtualenv)
+else
+  die "virtualenv is required (install: pip install virtualenv)."
+fi
+
+failed=0
+summary=()
+
+run_one() {
+  local ver="$1"
+  local py_bin="python${ver}"
+
+  if ! command -v "${py_bin}" >/dev/null 2>&1; then
+    log "SKIP ${ver}: ${py_bin} not found on PATH"
+    summary+=("${ver}: SKIP (no ${py_bin})")
+    return 0
+  fi
+
+  log "=== Python ${ver} ==="
+
+  # Build the sdist in a clean venv
+  log "Building sdist..."
+  local build_venv
+  build_venv="$(mktemp -d)"
+
+  "${VIRTUALENV_CMD[@]}" -p "${py_bin}" "${build_venv}" >/dev/null
+  source "${build_venv}/bin/activate"
+
+  make requirements
+  rm -rf dist/
+  python setup.py sdist --quiet
+
+  local sdist
+  sdist="$(ls -1t dist/*.tar.gz 2>/dev/null | head -1)"
+  if [[ -z "${sdist}" ]]; then
+    log "FAIL ${ver}: no .tar.gz produced"
+    summary+=("${ver}: FAIL sdist")
+    failed=1
+    deactivate 2>/dev/null || true
+    rm -rf "${build_venv}"
+    return 0
+  fi
+  log "Built: ${sdist}"
+
+  deactivate
+  rm -rf "${build_venv}"
+
+  # Install the sdist in a second clean venv
+  log "Installing sdist..."
+  local install_venv
+  install_venv="$(mktemp -d)"
+
+  "${VIRTUALENV_CMD[@]}" -p "${py_bin}" "${install_venv}" >/dev/null
+  source "${install_venv}/bin/activate"
+
+  if pip install "${sdist}" && python -c "import kudu; print('kudu', kudu.__version__)"; then
+    log "pip list:"
+    pip list
+    ok "Python ${ver} — sdist round-trip OK."
+    summary+=("${ver}: OK")
+  else
+    log "FAIL ${ver}: install or import failed"
+    summary+=("${ver}: FAIL install")
+    failed=1
+  fi
+
+  deactivate 2>/dev/null || true
+  rm -rf "${install_venv}"
+}
+
+log "KUDU_HOME=${KUDU_HOME}"
+log "PYTHON_DIR=${PYTHON_DIR}"
+log "Versions: ${VERSIONS[*]}"
+
+for ver in "${VERSIONS[@]}"; do
+  run_one "${ver}"
+done
+
+echo ""
+log "Summary:"
+for line in "${summary[@]}"; do
+  echo "  ${line}"
+done
+
+[[ "${failed}" -eq 0 ]] || exit 1
diff --git a/build-support/python-compat/versions.sh b/build-support/python-compat/versions.sh
new file mode 100644
index 000000000..ae10edfdd
--- /dev/null
+++ b/build-support/python-compat/versions.sh
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Sourced by the python-compat scripts to provide SUPPORTED_VERSIONS.
+# Parses supported Python versions from the version classifiers in python/setup.py.
+#
+# Requires: KUDU_HOME must be set before sourcing.
+
+# \K resets the match start, so only the X.Y part (e.g. "3.12") is captured.
+_versions_sh_parse() {
+  grep -oP "Programming Language :: Python :: \K\d+\.\d+" \
+    "${KUDU_HOME}/python/setup.py" | sort -V
+}
+
+mapfile -t SUPPORTED_VERSIONS < <(_versions_sh_parse)
+
+if [[ ${#SUPPORTED_VERSIONS[@]} -eq 0 ]]; then
+  echo "versions.sh: ERROR: no Python version classifiers found in ${KUDU_HOME}/python/setup.py" >&2
+  exit 1
+fi