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

kojiromike pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/main by this push:
     new 34e27cd23 AVRO-3952: Auto-install tox
34e27cd23 is described below

commit 34e27cd231d2eb2c3617129f805ea1728bfb804b
Author: Michael A. Smith <[email protected]>
AuthorDate: Mon Apr 15 21:11:57 2024 -0400

    AVRO-3952: Auto-install tox
---
 lang/py/build.sh | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/lang/py/build.sh b/lang/py/build.sh
index 000e048cf..369b8aa69 100755
--- a/lang/py/build.sh
+++ b/lang/py/build.sh
@@ -55,7 +55,7 @@ doc() {
   local doc_dir
   local version=$(cat ../../share/VERSION.txt)
   doc_dir="../../build/avro-doc-$version/api/py"
-  python3 -m tox -e docs
+  _tox -e docs
   mkdir -p "$doc_dir"
   cp -a docs/build/* "$doc_dir"
 }
@@ -72,11 +72,11 @@ interop-data-test() {
 }
 
 lint() {
-  python3 -m tox -e lint
+  _tox -e lint
 }
 
 test_() {
-  TOX_SKIP_ENV=lint python3 -m tox --skip-missing-interpreters
+  TOX_SKIP_ENV=lint _tox --skip-missing-interpreters
 }
 
 main() {
@@ -95,4 +95,16 @@ main() {
   done
 }
 
+_tox() {
+  if command -v tox 2> /dev/null; then
+    tox "$@"
+  else
+    echo 'Your experience will improve if you install tox'
+    virtualenv="$(mktemp -d)"
+    python3 -m venv "$virtualenv"
+    "$virtualenv/bin/python3" -m pip install tox
+    "$virtualenv/bin/tox" "$@"
+  fi
+}
+
 main "$@"

Reply via email to