Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Use poetry to manage the virtualenv in debian packages #12449

Merged
merged 7 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12449.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use `poetry` to manage the virtualenv in debian packages.
22 changes: 19 additions & 3 deletions debian/build_virtualenv
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,22 @@ case $(dpkg-architecture -q DEB_HOST_ARCH) in
;;
esac

# Use --builtin-venv to use the better `venv` module from CPython 3.4+ rather
# than the 2/3 compatible `virtualenv`.
# Manually install Poetry and export a pip-compatible `requirements.txt`
# We need a Poetry pre-release as the export command is buggy in < 1.2
if [ -e requirements.txt ]; then
richvdh marked this conversation as resolved.
Show resolved Hide resolved
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved
# Guard against a possible future where requirements.txt lives in the repo.
# Otherwise, calling `poetry export` below would silently clobber it.
echo "requirements.txt already exists; aborting" 1>&2
exit 1
fi
TEMP_VENV="$(mktemp -d)"
python3 -m venv "$TEMP_VENV"
source "$TEMP_VENV/bin/activate"
pip install -U pip
pip install poetry==1.2.0b1
poetry export --extras all --extras test -o requirements.txt
deactivate
rm -rf "$TEMP_VENV"

dh_virtualenv \
--install-suffix "matrix-synapse" \
Expand All @@ -41,9 +55,11 @@ dh_virtualenv \
--preinstall="lxml" \
--preinstall="mock" \
--preinstall="wheel" \
--extra-pip-arg "--no-deps" \
--extra-pip-arg="--no-cache-dir" \
--extra-pip-arg="--compile" \
--extras="all,systemd,test"
--extras="all,systemd,test" \
--requirements="requirements.txt"

PACKAGE_BUILD_DIR="debian/matrix-synapse-py3"
VIRTUALENV_DIR="${PACKAGE_BUILD_DIR}${DH_VIRTUALENV_INSTALL_ROOT}/matrix-synapse"
Expand Down
7 changes: 7 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
matrix-synapse-py3 (1.56.0+nmu1) UNRELEASED; urgency=medium

* Non-maintainer upload.
* Use poetry to manage the bundled virtualenv included with this package.

-- Synapse Packaging Team <packages@matrix.org> Wed, 30 Mar 2022 12:21:43 +0100

matrix-synapse-py3 (1.56.0) stable; urgency=medium

* New synapse release 1.56.0.
Expand Down