commit:     e9d13730dde1f436f8b72f7beb732b11f08f924d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 27 17:07:23 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Sep 27 17:30:38 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9d13730

dev-python/betterproto: New package, 2.0.0_beta7, dep of sigstore

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/betterproto/Manifest                    |  2 +
 .../betterproto/betterproto-2.0.0_beta7.ebuild     | 72 ++++++++++++++++++++++
 .../files/betterproto-2.0.0_beta7-pytest-8.patch   | 50 +++++++++++++++
 dev-python/betterproto/metadata.xml                | 12 ++++
 4 files changed, 136 insertions(+)

diff --git a/dev-python/betterproto/Manifest b/dev-python/betterproto/Manifest
new file mode 100644
index 000000000000..1710e4368371
--- /dev/null
+++ b/dev-python/betterproto/Manifest
@@ -0,0 +1,2 @@
+DIST python-betterproto-v.2.0.0b7.gh.tar.gz 217820 BLAKE2B 
2ede4c7b106c8c01279e1e57bc34c13c4e274215f077ae1d294108f40b6043682276c31703b1443bac5ab072a761141de306ff95cb34653180a9ee5bebe29b86
 SHA512 
4ca16c1cd09d76cde69848e6691be6f5716f730b7107f72e4a006c9b5881c815f4f24f9941861a972405d6d08bb47425900428886d1f8a2e37ace370c4514fbe
+DIST python-betterproto-v.2.0.0b7.tests.tar.xz 36328 BLAKE2B 
43bb385c6e6746602b210fdf10a94bb4508366230461823d96fbdbeb868b1e0952cb1a3a596bfa4bbaa2e71b643e17cabeb4e11546c5eedf47d632e07d4078aa
 SHA512 
a8b090d04e89a57dc8ff3b7775756cbf7d07bb317e47f76e12704cd41583b32a4f5f106a72af8c66f63e6def9bfc22ad93b4c39169b06b92b47a9f386326dfa7

diff --git a/dev-python/betterproto/betterproto-2.0.0_beta7.ebuild 
b/dev-python/betterproto/betterproto-2.0.0_beta7.ebuild
new file mode 100644
index 000000000000..8ae0bd22a427
--- /dev/null
+++ b/dev-python/betterproto/betterproto-2.0.0_beta7.ebuild
@@ -0,0 +1,72 @@
+# Copyright 2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=poetry
+PYTHON_COMPAT=( python3_{10..12} )
+
+inherit distutils-r1
+
+TAG=v.${PV/_beta/b}
+MY_P=python-betterproto-${TAG}
+DESCRIPTION="A better Protobuf / gRPC generator & library"
+HOMEPAGE="
+       https://github.com/danielgtaylor/python-betterproto/
+       https://pypi.org/project/betterproto/
+"
+# no tests in sdist, as of 2.0.0b7
+SRC_URI="
+       
https://github.com/danielgtaylor/python-betterproto/archive/${TAG}.tar.gz
+               -> ${MY_P}.gh.tar.gz
+"
+if [[ ${PKGBUMPING} != ${PVR} ]]; then
+       # poetry install -E compiler
+       # poetry run python -m tests.generate -v
+       # pack tests/output*
+       SRC_URI+="
+               test? (
+                       https://dev.gentoo.org/~mgorny/dist/${MY_P}.tests.tar.xz
+               )
+       "
+fi
+S=${WORKDIR}/${MY_P}
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="
+       >=dev-python/black-23.1.0[${PYTHON_USEDEP}]
+       >=dev-python/grpclib-0.4.1[${PYTHON_USEDEP}]
+       >=dev-python/isort-5.11.5[${PYTHON_USEDEP}]
+       >=dev-python/jinja-3.0.3[${PYTHON_USEDEP}]
+       >=dev-python/python-dateutil-2.8[${PYTHON_USEDEP}]
+       >=dev-python/typing-extensions-4.7.1[${PYTHON_USEDEP}]
+"
+BDEPEND="
+       test? (
+               dev-python/cachelib[${PYTHON_USEDEP}]
+               dev-python/pydantic[${PYTHON_USEDEP}]
+               dev-python/tomlkit[${PYTHON_USEDEP}]
+               dev-python/pytest-asyncio[${PYTHON_USEDEP}]
+               dev-python/pytest-mock[${PYTHON_USEDEP}]
+       )
+"
+
+distutils_enable_tests pytest
+
+PATCHES=(
+       # https://github.com/danielgtaylor/python-betterproto/pull/622
+       "${FILESDIR}/${P}-pytest-8.patch"
+)
+
+python_test() {
+       local EPYTEST_DESELECT=(
+               # TODO: ordering issue?
+               "tests/test_inputs.py::test_binary_compatibility[map]"
+       )
+
+       local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+       epytest -p asyncio -p pytest_mock
+}

diff --git 
a/dev-python/betterproto/files/betterproto-2.0.0_beta7-pytest-8.patch 
b/dev-python/betterproto/files/betterproto-2.0.0_beta7-pytest-8.patch
new file mode 100644
index 000000000000..b311826cf4c9
--- /dev/null
+++ b/dev-python/betterproto/files/betterproto-2.0.0_beta7-pytest-8.patch
@@ -0,0 +1,50 @@
+From f891957c8f0d355ea7cc20194050f3346fd16006 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Fri, 27 Sep 2024 19:01:53 +0200
+Subject: [PATCH] Update no-warning tests for pytest-8
+
+Replace the deprecated `pytest.warns(None)` with the suggested
+replacement (from https://github.com/pytest-dev/pytest/issues/9404)
+to make the test suite forward compatible with pytest-8.  This works
+correctly with pytest-6 as well.
+---
+ tests/test_deprecated.py | 15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py
+index c1caead3..ea16d370 100644
+--- a/tests/test_deprecated.py
++++ b/tests/test_deprecated.py
+@@ -35,18 +35,16 @@ def test_message_with_deprecated_field(message):
+ 
+ 
+ def test_message_with_deprecated_field_not_set(message):
+-    with pytest.warns(None) as record:
++    with warnings.catch_warnings():
++        warnings.simplefilter("error")
+         Test(value=10)
+ 
+-    assert not record
+-
+ 
+ def test_message_with_deprecated_field_not_set_default(message):
+-    with pytest.warns(None) as record:
++    with warnings.catch_warnings():
++        warnings.simplefilter("error")
+         _ = Test(value=10).message
+ 
+-    assert not record
+-
+ 
+ @pytest.mark.asyncio
+ async def test_service_with_deprecated_method():
+@@ -58,7 +56,6 @@ async def test_service_with_deprecated_method():
+     assert len(record) == 1
+     assert str(record[0].message) == f"TestService.deprecated_func is 
deprecated"
+ 
+-    with pytest.warns(None) as record:
++    with warnings.catch_warnings():
++        warnings.simplefilter("error")
+         await stub.func(Empty())
+-
+-    assert not record

diff --git a/dev-python/betterproto/metadata.xml 
b/dev-python/betterproto/metadata.xml
new file mode 100644
index 000000000000..a610b16cbd3c
--- /dev/null
+++ b/dev-python/betterproto/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="project">
+               <email>[email protected]</email>
+       </maintainer>
+       <stabilize-allarches/>
+       <upstream>
+               <remote-id 
type="github">danielgtaylor/python-betterproto</remote-id>
+               <remote-id type="pypi">betterproto</remote-id>
+       </upstream>
+</pkgmetadata>

Reply via email to