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 all 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.
20 changes: 16 additions & 4 deletions debian/build_virtualenv
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@ 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
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 exported_requirements.txt
deactivate
rm -rf "$TEMP_VENV"

# Use --no-deps to only install pinned versions in exported_requirements.txt,
# and to avoid https://github.com/pypa/pip/issues/9644
dh_virtualenv \
--install-suffix "matrix-synapse" \
--builtin-venv \
Expand All @@ -41,9 +51,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="exported_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.58.0+nmu1) UNRELEASED; urgency=medium
DMRobertson marked this conversation as resolved.
Show resolved Hide resolved

* 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.57.0~rc1) stable; urgency=medium

* New synapse release 1.57.0~rc1.
Expand Down
1 change: 1 addition & 0 deletions debian/clean
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exported_requirements.txt