1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-24 19:55:26 +03:00
aports/community/py3-axolotl/APKBUILD
mio 77038e1c88 community/py3-axolotl: fix tests with newer protos
Fix tests using updated protos generated with libprotoc 3.21.9. Resolves
error with py3-protobuf 5.29.4.

Example error:

```
======================================================================
ERROR: axolotl.tests.groups.test_groupcipher (unittest.loader._FailedTest.axolotl.tests.groups.test_groupcipher)
----------------------------------------------------------------------
ImportError: Failed to import test module: axolotl.tests.groups.test_groupcipher
Traceback (most recent call last):
  File "/usr/lib/python3.12/unittest/loader.py", line 396, in _find_test_path
    module = self._get_module_from_name(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[...]

  File "/usr/lib/python3.12/site-packages/google/protobuf/descriptor.py", line 621, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
```
2025-05-14 16:24:48 +00:00

44 lines
1.4 KiB
Text

# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-axolotl
_pkgname="python-${pkgname#py3-}"
pkgver=0.2.3
pkgrel=9
pkgdesc="Python3 port of libsignal-protocol-java"
url="https://github.com/tgalal/python-axolotl"
arch="noarch"
license="GPL-3.0-only"
depends="py3-cryptography py3-protobuf py3-axolotl-curve25519"
makedepends="py3-gpep517 py3-setuptools"
checkdepends="py3-cparser"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/tgalal/$_pkgname/archive/$pkgver.tar.gz
regenerate-protos.patch
"
builddir="$srcdir"/$_pkgname-$pkgver
replaces="py-axolotl" # Backwards compatibility
provides="py-axolotl=$pkgver-r$pkgrel" # Backwards compatibility
build() {
gpep517 build-wheel \
--wheel-dir .dist \
--output-fd 3 3>&1 >&2
}
check() {
python3 -m venv --clear --without-pip --system-site-packages .testenv
.testenv/bin/python3 -m installer .dist/*.whl
.testenv/bin/python3 -m unittest -v
}
package() {
python3 -m installer -d "$pkgdir" \
.dist/*.whl
rm -r "$pkgdir"/usr/lib/python3.*/site-packages/axolotl/tests
}
sha512sums="
1a10dc9df2f95d19b49909d4d136b5266aae19e24ac84f8b263ae7d4de18f77353c737616ac0648b600e05699a90d348f95c6c1659849986becefb4a0277fc80 py3-axolotl-0.2.3.tar.gz
25514d494f8b14ed284d0a0e7be23cff68a36b3ce580649847d547cc663cf9fc7b2289375d082e0a969e6578cda94f65c7143647bb91de7dad1eb15a471fbd69 regenerate-protos.patch
"