Skip to content

Commit

Permalink
AVRO-3952: Auto-install tox
Browse files Browse the repository at this point in the history
  • Loading branch information
kojiromike committed Apr 16, 2024
1 parent db1ac6f commit 34e27cd
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lang/py/build.sh
Expand Up @@ -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"
}
Expand All @@ -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() {
Expand All @@ -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 "$@"

0 comments on commit 34e27cd

Please sign in to comment.