Skip to content

Commit

Permalink
Use system GPG python bindings
Browse files Browse the repository at this point in the history
bmaptool was incorrectly installing the gpg bindings from PyPi. This is
incorrect however, since the gpg module must match the system GPG
library and is packaged with it. Modify the dependencies, instructions,
and CI to reflect this

Signed-off-by: Joshua Watt <[email protected]>
  • Loading branch information
JPEWdev committed Nov 19, 2024
1 parent f53bc5a commit f61172a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install -y pbzip2 pigz lzop liblz4-tool libgpgme11-dev
sudo apt-get install -y pbzip2 pigz lzop liblz4-tool libgpgme11-dev python3-gpg
python -m pip install --upgrade pip
pip install build
- name: Build package
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,11 @@ More details can be found [in the OpenZFS documentation](https://openzfs.github.
changes to the project, first create a new virtual environment and activate it:

```bash
python3 -m venv .venv
python3 -m venv .venv --system-site-packages
. .venv/bin/activate
```
Note: --system-site-packages is required to give the virtual environment
access to the system GPG python bindings

Next install the project in editable mode with development dependencies:

Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name = "bmaptool"
description = "BMAP tools"
dynamic = ["version"]
dependencies = [
"gpg >= 1.10.0",
# NOTE: gpg is not installed because it must come from the system GPG package
# (e.g. python3-gpg on Ubuntu) and not from PyPi. The PyPi version is very old
# and no longer functions correctly
#"gpg >= 1.10.0",
]
required-python = ">= 3.8"
authors = [
Expand Down
5 changes: 3 additions & 2 deletions src/bmaptool/CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ def verify_detached_bmap_signature(args, bmap_obj, bmap_path):
error_out(
'cannot verify the signature because the python "gpg" '
"module is not installed on your system\nPlease, either "
"install the module or use --no-sig-verify"
"install system GPG python bindings (e.g. python3-gpg) or use "
"--no-sig-verify"
)

try:
Expand Down Expand Up @@ -254,7 +255,7 @@ def verify_clearsign_bmap_signature(args, bmap_obj):
'cannot verify the signature because the python "gpg"'
"module is not installed on your system\nCannot extract "
"block map from the bmap file which has clearsign format, "
"please, install the module"
"please install system GPG python bindings (e.g. python3-gpg)"
)

try:
Expand Down

0 comments on commit f61172a

Please sign in to comment.