From c95a4d1b8dd89028831931b91cdf282bfabbec53f442a07fffd3fcaf22c791e0 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 17 Jul 2025 12:51:04 +0000 Subject: [PATCH 1/2] cleanup OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:mailman/python-mailmanclient?expand=0&rev=39 --- .gitattributes | 23 +++++ .gitignore | 1 + mailmanclient-3.3.5.tar.gz | 3 + mailmanclient-skip-httpx-tests.patch | 98 ++++++++++++++++++ python-mailmanclient.changes | 147 +++++++++++++++++++++++++++ python-mailmanclient.spec | 85 ++++++++++++++++ 6 files changed, 357 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 mailmanclient-3.3.5.tar.gz create mode 100644 mailmanclient-skip-httpx-tests.patch create mode 100644 python-mailmanclient.changes create mode 100644 python-mailmanclient.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/mailmanclient-3.3.5.tar.gz b/mailmanclient-3.3.5.tar.gz new file mode 100644 index 0000000..49b270c --- /dev/null +++ b/mailmanclient-3.3.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63581c604ca7eac021489c15aacca06a4958eb76f66574c6fab05eac654dd857 +size 89608 diff --git a/mailmanclient-skip-httpx-tests.patch b/mailmanclient-skip-httpx-tests.patch new file mode 100644 index 0000000..a9750ca --- /dev/null +++ b/mailmanclient-skip-httpx-tests.patch @@ -0,0 +1,98 @@ +Index: mailmanclient-3.3.3/src/mailmanclient/tests/test_async_client.py +=================================================================== +--- mailmanclient-3.3.3.orig/src/mailmanclient/tests/test_async_client.py 2021-11-19 10:35:49.358591669 +0100 ++++ mailmanclient-3.3.3/src/mailmanclient/tests/test_async_client.py 2021-11-19 10:35:59.998665466 +0100 +@@ -1,93 +0,0 @@ +-import httpx +-import pytest +-import concurrent.futures +- +-from mailmanclient.asynclient import AsyncClient +-from mailmanclient import Client +- +- +-@pytest.fixture(autouse=True) +-def setup(): +- """Setup for testing. Create test data.""" +- client = Client('http://localhost:9001/3.1', 'restadmin', 'restpass') +- print('Loading test data...') +- try: +- domain = client.create_domain('example.com') +- except Exception: +- domain = client.get_domain('example.com') +- # Create some lists. +- lists = [] +- print('Creating lists...') +- with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor: +- future_to_id = { +- executor.submit(domain.create_list, f'list{i}'): f'list{i}' +- for i in range(10)} +- for future in concurrent.futures.as_completed(future_to_id): +- lists.append(future.result()) +- +- # Subscribe some addresses. +- print('Creating subscirbers...') +- for i, ml in enumerate(lists): +- with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor: +- futures = [ +- executor.submit( +- ml.subscribe, f'mylist{each}@example.com', +- pre_verified=True, pre_confirmed=True, pre_approved=True) +- for each in range(i*5)] +- for _future in concurrent.futures.as_completed(futures): +- print('.', end='') +- yield +- # Cleanup after test. +- for ml in lists: +- ml.delete() +- domain.delete() +- +- +-@pytest.fixture +-async def client(): +- async with httpx.AsyncClient() as conn: +- client = AsyncClient( +- conn, 'http://localhost:9001/3.1', 'restadmin', 'restpass') +- yield client +- +- +-@pytest.mark.asyncio +-async def test_async_client(client): +- domains = await client.domains() +- for each in domains: +- print(f'Domain: {each.mail_host}') +- +- +-@pytest.mark.asyncio +-async def test_get_lists(client): +- lists = await client.lists() +- for ml in lists: +- print(f'Mailinglist: {ml.fqdn_listname}') +- await ml.config() +- +- +-@pytest.mark.asyncio +-async def test_get_members(client): +- members = await client.members() +- for member in members: +- print(f'Member: {member.role} {member.list_id} {member.email} ', +- end='') +- +- +-@pytest.mark.asyncio +-async def test_get_users(client): +- users = await client.users() +- for user in users: +- print(f'User: {user.user_id} ', end='') +- addrs = await user.addresses() +- for addr in addrs: +- print(f'UserAddress: {addr.email}', end='') +- prefs = await user.preferences() +- print('UserPreference: {}'.format(prefs._data), end='') +- +- +-@pytest.mark.asyncio +-async def test_get_addresses(client): +- addresses = await client.addresses() +- for addr in addresses: +- print(f'Address: {addr.email}', end='') diff --git a/python-mailmanclient.changes b/python-mailmanclient.changes new file mode 100644 index 0000000..96ea138 --- /dev/null +++ b/python-mailmanclient.changes @@ -0,0 +1,147 @@ +------------------------------------------------------------------- +Thu Feb 29 20:26:33 UTC 2024 - Ben Greiner + +- Build PEP517 wheel + +------------------------------------------------------------------- +Tue Feb 20 13:23:35 UTC 2024 - Markéta Machová + +- Get rid of six dependency + +------------------------------------------------------------------- +Tue Feb 6 14:56:06 UTC 2024 - Markéta Machová + +- Drop unneeded test dependency python-pytest-vcr + +------------------------------------------------------------------- +Thu Jun 29 13:43:42 UTC 2023 - Matej Cepl + +- Update to 3.3.5: + - Add support for Python 3.11. + +------------------------------------------------------------------- +Thu Jun 29 13:03:21 UTC 2023 - Matej Cepl + +- Remove weird %if %{pkg_vcmp python3-pytest-asyncio >= 0.19} + construct. It just cannot work correctly (bsc#1212834). + +------------------------------------------------------------------- +Mon Nov 21 10:38:25 UTC 2022 - Andreas Schneider + +- Update to version 3.3.4 + * URL quote the query in find_user* methods. (Fixes #75) + * Add support for Python 3.10 and drops support for 3.6. + +------------------------------------------------------------------- +Sat Aug 20 20:38:15 UTC 2022 - Ben Greiner + +- Force pytest-asyncio auto mode -- 0.19.0 changed the default + * https://github.com/pytest-dev/pytest-asyncio#modes + +------------------------------------------------------------------- +Mon Jul 4 10:44:31 UTC 2022 - Ben Greiner + +- Enable multiflavor so that we can pin mailman3 itself to python39 + +------------------------------------------------------------------- +Thu Jun 9 08:48:24 UTC 2022 - Andreas Schneider + +- Fix BR for mailman3 (package has been renamed) +- Add missing BR for async_generator on openSUSE Leap >= 15.3 + +------------------------------------------------------------------- +Fri Nov 19 09:22:22 UTC 2021 - Andreas Schneider + +- Fix running the tests + * Added mailmanclient-skip-httpx-tests.patch +- Set missing Group + +------------------------------------------------------------------- +Thu Nov 18 18:14:51 UTC 2021 - Matej Cepl +- Update to 3.3.3: + - Add pre_confirmed and pre_approved parameters to + MailingList.unsubscribe. + - Add support to fetch pending unsubscription requests. + - Add member_id as a property of Member object. + - Return pending token when a Member is unsubscribed. + - Allow specifying a reason when handling subscription requests + - Add support to specify fields when fetching a roster. + - Add a mechanism to hook into the request parameters. + - Add basic support for async client for Mailman API. + - Allow specifying delivery_mode and delivery_status when + subscribing a Member. + - Add a new Client.find_users API which allows searching for + the users. + +------------------------------------------------------------------- +Tue May 4 09:30:03 UTC 2021 - Ben Greiner + +- Restrict to python3 build + +------------------------------------------------------------------- +Thu Feb 4 00:11:53 UTC 2021 - Jan Engelhardt + +- Avoid name repetition (e.g. rpmlint's name-repeated-in-summary) + +------------------------------------------------------------------- +Wed Feb 3 16:36:32 UTC 2021 - Andreas Schneider + +- Update to 3.3.2 + * Add two new get_requests() and get_requests_count() to get pending + subscription requests``MailingList.get_requests`` is the new API to fetch + pending requests and supersedes the previous requests property. (See !121) + * Add Member.subscription_mode to determine if a User is subscribed or an + Address. (See !121) + * Add a new get_held_count() API to get a count of held messages for a + MailingList. (See !122) + * Add display_name to the pending subscription requests. (Fixes #55) + * Allow setting a Member's address attribute. (See !128) + * Add support for inviting an email address to join a list. + * Rewrite urls according to the baseurl used to instantiate Client instead of + relying on self_link. (Fixes #22) + * Add get_request API to MailingList to get individual request objects. + * Add send_welcome_message parameter to MailingList.subscribe() to suppress + welcome message. (Closes #61) +- Fix build on tumbleweed + +------------------------------------------------------------------- +Tue Aug 4 02:03:44 UTC 2020 - Stasiek Michalski + +- Update to 3.3.1 + * Held message moderation now supports an optional keyword, reason to + specify the reason to reject the message. + * Fix a bug where missing display_name attribute with + MalingList.subscribe would subscribe the user with a display name of + "None". + * Add advertised flag to MailingList object. + * MailingList.nonmembers now uses roster/nonmembers resource instead of + the find/ API for consistency. + * Add Client.get_nonmember and MailingList.get_nonmember to get a + non-member by address. + +------------------------------------------------------------------- +Thu Jan 23 14:56:37 UTC 2020 - pgajdos@suse.com + +- removing 15 conditionals, LANG definition will be removed + later anyway + +------------------------------------------------------------------- +Thu Jan 16 11:06:44 UTC 2020 - pgajdos@suse.com + +- be able to build also for 15 + +------------------------------------------------------------------- +Mon Dec 2 10:47:15 UTC 2019 - pgajdos@suse.com + +- call spec-cleaner + +------------------------------------------------------------------- +Wed Nov 6 11:10:07 UTC 2019 - pgajdos@suse.com + +- run tests except doc ones + +------------------------------------------------------------------- +Tue Oct 1 10:21:27 UTC 2019 - pgajdos@suse.com + +- initial version 3.3.0, required by HyperKitty [SLE-7686] + diff --git a/python-mailmanclient.spec b/python-mailmanclient.spec new file mode 100644 index 0000000..d7dea7c --- /dev/null +++ b/python-mailmanclient.spec @@ -0,0 +1,85 @@ +# +# spec file for package python-mailmanclient +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-mailmanclient +Version: 3.3.5 +Release: 0 +Summary: Python bindings for the Mailman REST API +License: LGPL-3.0-only +Group: Productivity/Networking/Email/Mailinglists +URL: https://www.list.org/ +Source: https://files.pythonhosted.org/packages/source/m/mailmanclient/mailmanclient-%{version}.tar.gz +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-requests +BuildArch: noarch +%if 0%{?sle_version} && 0%{?sle_version} <= 150300 +Patch0: mailmanclient-skip-httpx-tests.patch +%endif +# SECTION test requirements +BuildRequires: %{python_module falcon} +BuildRequires: %{python_module pytest-asyncio} +BuildRequires: %{python_module pytest-services} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests} +BuildRequires: mailman3 >= 3.3.5 +%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150400 +BuildRequires: %{python_module httpx} +%endif +%if 0%{?sle_version} && 0%{?sle_version} <= 150400 +BuildRequires: %{python_module async_generator} +%endif +# /SECTION +%python_subpackages + +%description +Python bindings for Mailman REST API. + +%prep +%autosetup -n mailmanclient-%{version} -p1 +# get rid of six +sed -i 's/six.moves.urllib_error/urllib.error/' src/mailmanclient/tests/test_domain.py src/mailmanclient/tests/test_unicode.py + +%build +export LC_ALL=C.UTF-8 +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +# doctest does not work: +# Traceback (most recent call last): +# File "/usr/lib64/python3.7/logging/handlers.py", line 933, in emit +# self.socket.send(msg) +# OSError: [Errno 9] Bad file descriptor +export LC_ALL=C.UTF-8 +%pytest -k 'not using.rst' --asyncio-mode=auto + +%files %{python_files} +%doc README.rst +%license COPYING.LESSER +%{python_sitelib}/mailmanclient +%{python_sitelib}/mailmanclient-%{version}.dist-info + +%changelog From 447c281d8c792d52ba2020d2ad6c5326815d9cedbd0178ba4756d66cc70f32b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Mon, 29 Dec 2025 11:00:46 +0000 Subject: [PATCH 2/2] - If possible build for primary_python (fixes Leap 16.0) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:mailman/python-mailmanclient?expand=0&rev=40 --- python-mailmanclient.changes | 5 +++++ python-mailmanclient.spec | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/python-mailmanclient.changes b/python-mailmanclient.changes index 96ea138..a6f4eaa 100644 --- a/python-mailmanclient.changes +++ b/python-mailmanclient.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Dec 19 10:17:10 UTC 2025 - Andreas Schneider + +- If possible build for primary_python (fixes Leap 16.0) + ------------------------------------------------------------------- Thu Feb 29 20:26:33 UTC 2024 - Ben Greiner diff --git a/python-mailmanclient.spec b/python-mailmanclient.spec index d7dea7c..e427b43 100644 --- a/python-mailmanclient.spec +++ b/python-mailmanclient.spec @@ -1,7 +1,7 @@ # # spec file for package python-mailmanclient # -# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2025 SUSE LLC and contributors # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,7 +16,15 @@ # +# Always only build one flavor +%if 0%{?sle_version} && 0%{?sle_version} < 160000 %{?sle15_python_module_pythons} +%elif %{defined primary_python} +%define pythons %{primary_python} +%else +%define pythons python3 +%endif + Name: python-mailmanclient Version: 3.3.5 Release: 0