commit: e0f35bada73c5c5307f60be980010bf2abd3fb48 Author: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in> AuthorDate: Mon Apr 21 10:33:38 2025 +0000 Commit: David Roman <davidroman96 <AT> gmail <DOT> com> CommitDate: Mon Apr 21 10:33:38 2025 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=e0f35bad
dev-python/mastodon-py: add 2.0.1 Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in> dev-python/mastodon-py/Manifest | 1 + .../files/mastodon-py-2.0.1-tests.patch | 41 ++++++++++++++ dev-python/mastodon-py/mastodon-py-2.0.1.ebuild | 63 ++++++++++++++++++++++ 3 files changed, 105 insertions(+) diff --git a/dev-python/mastodon-py/Manifest b/dev-python/mastodon-py/Manifest index 95dedc81d..3cbdadd78 100644 --- a/dev-python/mastodon-py/Manifest +++ b/dev-python/mastodon-py/Manifest @@ -1 +1,2 @@ DIST Mastodon.py-1.8.1.tar.gz 8694359 BLAKE2B d3b8d2196199eeaeb0377c8503e763099943142c58b5b45bbbb86a38c0629ea6ee6427b53c989267a13d4d2a0c104635387ffef96d05d7dfa7dd8c2756e8704b SHA512 812bfdcb1a59a06376bfb48798b43cac9dc9390781b3949e4b3d751ec0530b25b187e688c7cfc18eff6d5bb23c9bf442bce5f6902727331e8bc550e310dab94c +DIST mastodon_py-2.0.1.tar.gz 10988936 BLAKE2B 237e81a0501db59acb066cb156cddf9898265b7dc988c1edee451f4f9c5fb4f97629b2dfc561ce42e5d1e5858e00a916b56d002acbbe2891b4bb4d57e05661da SHA512 7aff1f6cf6c159d9ab95ff9d44aa1249c8db1536121fc5cd88ff0c46c22b23efb0c4857d6c6a744630b23804504b6d7886848ca194957dd524b4b014dadcd5e3 diff --git a/dev-python/mastodon-py/files/mastodon-py-2.0.1-tests.patch b/dev-python/mastodon-py/files/mastodon-py-2.0.1-tests.patch new file mode 100644 index 000000000..8b6467498 --- /dev/null +++ b/dev-python/mastodon-py/files/mastodon-py-2.0.1-tests.patch @@ -0,0 +1,41 @@ +Fix compatibility with pytest-recording + +pytest-recording stores cassettes for each module in its own directory. +Using "vcr_cassette_dir" fixture, we override it to use the old +behavior. + +Part of https://github.com/halcy/Mastodon.py/pull/407 + +--- a/tests/conftest.py ++++ b/tests/conftest.py +@@ -63,6 +63,11 @@ def vcr_config(): + decode_compressed_response = True + ) + ++@pytest.fixture(scope="module") ++def vcr_cassette_dir(request) -> str: ++ module = request.node.fspath # current test file ++ return os.path.join(module.dirname, "cassettes") ++ + # Fixtures for testing against actual, real servers + # Please be extremely careful with these + @pytest.fixture +diff --git a/tests/test_streaming.py b/tests/test_streaming.py +index 7bbdfc0..0f66519 100644 +--- a/tests/test_streaming.py ++++ b/tests/test_streaming.py +@@ -14,11 +14,6 @@ streaming_is_patched = False + real_connections = [] + close_connections = False + +-@pytest.fixture(scope='module') +-def vcr(vcr): +- vcr.match_on = ['path'] +- return vcr +- + @pytest.fixture(scope='module') + def vcr_config(): + return { +-- +2.49.0 + diff --git a/dev-python/mastodon-py/mastodon-py-2.0.1.ebuild b/dev-python/mastodon-py/mastodon-py-2.0.1.ebuild new file mode 100644 index 000000000..fee283979 --- /dev/null +++ b/dev-python/mastodon-py/mastodon-py-2.0.1.ebuild @@ -0,0 +1,63 @@ +# Copyright 2022-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{11..13} ) +PYPI_PN="Mastodon.py" +inherit distutils-r1 optfeature pypi + +DESCRIPTION="Python wrapper for the Mastodon API" +HOMEPAGE=" + https://pypi.org/project/Mastodon.py/ + https://github.com/halcy/Mastodon.py +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND=" + >=dev-python/blurhash-1.1.4[${PYTHON_USEDEP}] + >=dev-python/decorator-4.0.0[${PYTHON_USEDEP}] + dev-python/python-dateutil[${PYTHON_USEDEP}] + dev-python/python-magic[${PYTHON_USEDEP}] + >=dev-python/requests-2.4.2[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + >=dev-python/cryptography-1.6.0[${PYTHON_USEDEP}] + >=dev-python/http-ece-1.0.5[${PYTHON_USEDEP}] + dev-python/pytest-mock[${PYTHON_USEDEP}] + dev-python/pytest-recording[${PYTHON_USEDEP}] + dev-python/pytz[${PYTHON_USEDEP}] + dev-python/requests-mock[${PYTHON_USEDEP}] + dev-python/vcrpy[${PYTHON_USEDEP}] + ) +" + +PATCHES=( "${FILESDIR}"/${PN}-2.0.1-tests.patch ) + +EPYTEST_XDIST=1 +EEPYTEST_DESELECT=( + # something related to simplejson + tests/test_notifications.py::test_notifications_dismiss_pre_2_9_2 + tests/test_status.py::test_status_card_pre_2_9_2 + # requires PROPERTIES="test_network" + tests/test_streaming.py::test_stream_user_direct + tests/test_streaming.py::test_stream_user_local +) + +distutils_enable_tests pytest + +distutils_enable_sphinx docs \ + dev-python/sphinx-rtd-theme + +python_test() { + epytest -o addopts= +} + +pkg_postinst() { + optfeature "webpush support" "dev-python/cryptography dev-python/http-ece" +}