]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: optionally run test venvs with system site-packages
authorSun Yuechi <sunyuechi@iscas.ac.cn>
Sat, 6 Jun 2026 18:05:34 +0000 (02:05 +0800)
committerSun Yuechi <sunyuechi@iscas.ac.cn>
Sat, 20 Jun 2026 06:49:16 +0000 (14:49 +0800)
Add a CEPH_PYTHON_SYSTEM_SITE switch (off by default). When set:

  - setup-virtualenv.sh builds its venv with --system-site-packages;
  - run_tox.sh exports VIRTUALENV_SYSTEM_SITE_PACKAGES=true for tox's venvs.

This lets distro packages satisfy test dependencies instead of pip building
them from sdist, which helps where prebuilt wheels are missing (e.g. scipy and
numpy on riscv64) by avoiding a slow rebuild when the RPMs are installed.

Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
src/script/run_tox.sh
src/tools/setup-virtualenv.sh

index f2f71a60f292c64a4fa6de2a1a22f751a4f868fe..61fdea28ccf7bdefcb68a9570b180118797dfdbd 100755 (executable)
@@ -125,6 +125,10 @@ function main() {
     export CEPH_BUILD_DIR=$build_dir
     # use the wheelhouse prepared by install-deps.sh
     export PIP_FIND_LINKS="$tox_path/wheelhouse"
+    # CEPH_PYTHON_SYSTEM_SITE (default off): let tox's venvs see system site-packages
+    if ${CEPH_PYTHON_SYSTEM_SITE:-false}; then
+        export VIRTUALENV_SYSTEM_SITE_PACKAGES=true
+    fi
     tox_cmd=(tox -c $tox_path/tox.ini)
     if [ "$tox_envs" != "__tox_defaults__" ]; then
         tox_cmd+=("-e" "$tox_envs")
index 152e4859715a9acd91fe075d3d42763cd3578958..5dba693c26eecfb9028f831ea2b00473330467e5 100755 (executable)
@@ -62,7 +62,12 @@ if [ -z "$DIR" ] ; then
 fi
 rm -fr $DIR
 mkdir -p $DIR
-$PYTHON -m venv $DIR
+# CEPH_PYTHON_SYSTEM_SITE (default off): build venv against system site-packages
+VENV_OPTS=
+if ${CEPH_PYTHON_SYSTEM_SITE:-false}; then
+    VENV_OPTS="--system-site-packages"
+fi
+$PYTHON -m venv $VENV_OPTS $DIR
 . $DIR/bin/activate
 
 if pip --help | grep -q disable-pip-version-check; then