mirror of
https://github.com/certbot/certbot.git
synced 2026-06-06 07:12:54 -04:00
* use poetry 1.2.0a1 * pin pip normally * use normal constraints file with pipstrap * remove unused STRIP_HASHES var * Check for old poetry versions * keep pip, setuptools, and wheel pinned in oldest * remove strip hashes * pin back pip * fix new lint error
48 lines
1.8 KiB
Bash
Executable file
48 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
|
# This script accepts no arguments and automates the process of updating
|
|
# Certbot's dependencies. Dependencies can be pinned to older versions by
|
|
# modifying pyproject.toml in the same directory as this file.
|
|
set -euo pipefail
|
|
|
|
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
|
REPO_ROOT="$(dirname "$(dirname "${WORK_DIR}")")"
|
|
RELATIVE_SCRIPT_PATH="$(realpath --relative-to "$REPO_ROOT" "$WORK_DIR")/$(basename "${BASH_SOURCE[0]}")"
|
|
REQUIREMENTS_FILE="$REPO_ROOT/tools/requirements.txt"
|
|
|
|
if ! command -v poetry >/dev/null || [ $(poetry --version | grep -oE '[0-9]+\.[0-9]+' | sed 's/\.//') -lt 12 ]; then
|
|
echo "Please install poetry 1.2+."
|
|
echo "You may need to recreate Certbot's virtual environment and activate it."
|
|
exit 1
|
|
fi
|
|
|
|
# Old eggs can cause outdated dependency information to be used by poetry so we
|
|
# delete them before generating the lock file. See
|
|
# https://github.com/python-poetry/poetry/issues/4103 for more info.
|
|
cd "${REPO_ROOT}"
|
|
rm -rf */*.egg-info
|
|
|
|
cd "${WORK_DIR}"
|
|
|
|
if [ -f poetry.lock ]; then
|
|
rm poetry.lock
|
|
fi
|
|
|
|
poetry lock
|
|
|
|
TEMP_REQUIREMENTS=$(mktemp)
|
|
trap 'rm poetry.lock; rm $TEMP_REQUIREMENTS' EXIT
|
|
|
|
poetry export -o "${TEMP_REQUIREMENTS}" --without-hashes
|
|
# We need to remove local packages from the requirements file.
|
|
sed -i '/^acme @/d; /certbot/d;' "${TEMP_REQUIREMENTS}"
|
|
|
|
cat << EOF > "$REQUIREMENTS_FILE"
|
|
# This file was generated by $RELATIVE_SCRIPT_PATH and can be updated using
|
|
# that script.
|
|
#
|
|
# It is normally used as constraints to pip, however, it has the name
|
|
# requirements.txt so that is scanned by GitHub. See
|
|
# https://docs.github.com/en/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#supported-package-ecosystems
|
|
# for more info.
|
|
EOF
|
|
cat "${TEMP_REQUIREMENTS}" >> "${REQUIREMENTS_FILE}"
|