Merge pull request #2123 from yambati03/clean-gtsam-develop

Add script to clean up `gtsam-develop` project releases
release/4.3a0
Frank Dellaert 2025-05-07 08:55:33 -04:00 committed by GitHub
commit b7a3bffa98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,46 @@
#!/usr/bin/env bash
# This script deletes all but the most recent release from the gtsam-develop project on PyPI
# and can be used if the project size exceeds the PyPI limit of 10 GB. The user must have
# owner or maintainer privileges on the project.
set -euo pipefail
usage() {
cat <<EOF
Usage: $(basename "$0") <pypi_username>
Deletes all but the most recent release from the gtsam-develop project on PyPI.
You must supply the PyPI user name that has owner or maintainer privileges on
the project. THIS OPERATION IS PERMANENT.
Examples
$ $(basename "$0") yambati3
$ $(basename "$0") # will prompt for user name
EOF
}
if [[ $# -ge 1 ]]; then
PYPI_USER="$1"
else
read -rp "Enter your PyPI user name: " PYPI_USER
[[ -z "$PYPI_USER" ]] && { echo "No user name supplied."; usage; exit 1; }
fi
echo "-----------------------------------------------------------------------"
echo "WARNING: This WILL permanently delete all but the most recent release"
echo " of 'gtsam-develop' on PyPI for user '$PYPI_USER'."
echo " This cannot be undone."
echo "-----------------------------------------------------------------------"
read -rp "Proceed? [y/N]: " REPLY
REPLY=${REPLY,,} # to lowercase
[[ "$REPLY" != "y" && "$REPLY" != "yes" ]] && { echo "Aborted."; exit 0; }
echo "Running pypi_cleanup for user '$PYPI_USER'..."
python3 -m pypi_cleanup.__init__ \
-p gtsam-develop \
--leave-most-recent-only \
--do-it \
-u "$PYPI_USER"
echo "Done."