diff --git a/hail/scripts/assert_pypi_has_room.py b/hail/scripts/assert_pypi_has_room.py new file mode 100644 index 00000000000..edf50539a9c --- /dev/null +++ b/hail/scripts/assert_pypi_has_room.py @@ -0,0 +1,11 @@ +import os + +wheel_size = os.path.getsize(os.environ["WHEEL"]) +pypi_used_storage = int(os.environ["PYPI_USED_STORAGE"]) + +print(f'Wheel size: {wheel_size / 1024 / 1024:.0f}MiB. PyPI used storage: {pypi_used_storage / 1024 / 1024:.0f}MiB.') + +if wheel_size + pypi_used_storage > 10 * 1024 * 1024 * 1024: + print('Insufficient space available at PyPI.') + exit(1) +print('Sufficient space is available at PyPI.') diff --git a/hail/scripts/deploy.sh b/hail/scripts/deploy.sh index 1446bee5a87..f29edfef12d 100755 --- a/hail/scripts/deploy.sh +++ b/hail/scripts/deploy.sh @@ -2,6 +2,8 @@ set -ex +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + retry() { "$@" || (sleep 2 && "$@") || @@ -59,6 +61,9 @@ then exit 1 fi +export PYPI_USED_STORAGE=$(curl https://pypi.org/pypi/hail/json | jq '[.releases[][].size ]| add') +python3 $SCRIPT_DIR/assert_pypi_has_room.py + # push git tag git tag $HAIL_PIP_VERSION -m "Hail version $HAIL_PIP_VERSION." git push origin $HAIL_PIP_VERSION