From 96d8cdef9437643d7e5ead1b1643b9c2de37a2eb Mon Sep 17 00:00:00 2001 From: Alex Pyrgiotis Date: Thu, 23 Feb 2023 23:00:08 +0200 Subject: [PATCH] Suggest users to install Poetry via pipx Replace the command to install Poetry globally via `pip` in our build instructions, with a command that installs Poetry under ~/.local/bin via `pipx`. The rationale is the same as in the previous commit, i.e., PEP 668 does not allow it. Note that in this case, we don't have any CI restrictions, so we could use the official installer instead. However, for security reasons, we prefer suggesting `pipx` to the users, and of course give them a list of alternatives. Note that for Windows and MacOS we leave the command as is, until we figure out how PEP 668 applies in there. --- BUILD.md | 19 +++++++++++++------ dev_scripts/qa.py | 19 +++++++++++++------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/BUILD.md b/BUILD.md index 1c3ffd1..19d415b 100644 --- a/BUILD.md +++ b/BUILD.md @@ -6,15 +6,22 @@ Install dependencies: ```sh sudo apt install -y podman dh-python build-essential fakeroot make libqt5gui5 \ - python3 python3-dev python3-venv python3-pip python3-stdeb python3-all + pipx python3 python3-dev python3-stdeb python3-all ``` -Install poetry (you may need to add `~/.local/bin/` to your `PATH` first): +Install Poetry using `pipx` (recommended) and add it to your `$PATH`: + +_(See also a list of [alternative installation +methods](https://python-poetry.org/docs/#installation))_ ```sh -python3 -m pip install poetry +pipx ensurepath +pipx install poetry ``` +After this, restart the terminal window, for the `poetry` command to be in your +`$PATH`. + Change to the `dangerzone` folder, and install the poetry dependencies: > **Note**: due to an issue with [poetry](https://github.com/python-poetry/poetry/issues/1917), if it prompts for your keying, disable the keyring with `keyring --disable` and run the command again. @@ -53,13 +60,13 @@ Create a .deb: Install dependencies: ```sh -sudo dnf install -y rpm-build podman python3 python3-pip qt5-qtbase-gui +sudo dnf install -y rpm-build podman python3 pipx qt5-qtbase-gui ``` -Install poetry: +Install Poetry using `pipx`: ```sh -python -m pip install poetry +pipx install poetry ``` Change to the `dangerzone` folder, and install the poetry dependencies: diff --git a/dev_scripts/qa.py b/dev_scripts/qa.py index b98f8a8..a51d914 100755 --- a/dev_scripts/qa.py +++ b/dev_scripts/qa.py @@ -156,15 +156,22 @@ Install dependencies: ```sh sudo apt install -y podman dh-python build-essential fakeroot make libqt5gui5 \ - python3 python3-dev python3-venv python3-pip python3-stdeb python3-all + pipx python3 python3-dev python3-stdeb python3-all ``` -Install poetry (you may need to add `~/.local/bin/` to your `PATH` first): +Install Poetry using `pipx` (recommended) and add it to your `$PATH`: + +_(See also a list of [alternative installation +methods](https://python-poetry.org/docs/#installation))_ ```sh -python3 -m pip install poetry +pipx ensurepath +pipx install poetry ``` +After this, restart the terminal window, for the `poetry` command to be in your +`$PATH`. + Change to the `dangerzone` folder, and install the poetry dependencies: > **Note**: due to an issue with [poetry](https://github.com/python-poetry/poetry/issues/1917), if it prompts for your keying, disable the keyring with `keyring --disable` and run the command again. @@ -204,13 +211,13 @@ CONTENT_BUILD_FEDORA = r"""## Fedora Install dependencies: ```sh -sudo dnf install -y rpm-build podman python3 python3-pip qt5-qtbase-gui +sudo dnf install -y rpm-build podman python3 pipx qt5-qtbase-gui ``` -Install poetry: +Install Poetry using `pipx`: ```sh -python -m pip install poetry +pipx install poetry ``` Change to the `dangerzone` folder, and install the poetry dependencies: