From 469accceca4af2f4b146254e8a5852ab72ee6d2500f96b8df3971b43ed3d465e Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 27 Nov 2024 23:08:56 +0000 Subject: [PATCH] - Switch to pyproject macros. - Add patch support-python-313.patch: * With Python 3.13, the listening asyncio Unix socket is removed on close OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-aiosmtpd?expand=0&rev=32 --- python-aiosmtpd.changes | 8 ++++++++ python-aiosmtpd.spec | 13 +++++++------ support-python-313.patch | 26 ++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 support-python-313.patch diff --git a/python-aiosmtpd.changes b/python-aiosmtpd.changes index 5a1f14f..5baab30 100644 --- a/python-aiosmtpd.changes +++ b/python-aiosmtpd.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Nov 27 23:07:53 UTC 2024 - Steve Kowalik + +- Switch to pyproject macros. +- Add patch support-python-313.patch: + * With Python 3.13, the listening asyncio Unix socket is removed + on close + ------------------------------------------------------------------- Mon May 20 11:20:49 UTC 2024 - Daniel Garcia diff --git a/python-aiosmtpd.spec b/python-aiosmtpd.spec index 270a948..f605119 100644 --- a/python-aiosmtpd.spec +++ b/python-aiosmtpd.spec @@ -22,16 +22,18 @@ Version: 1.4.6 Release: 0 Summary: SMTP server based on asyncio License: Apache-2.0 -Group: Development/Languages/Python URL: https://aiosmtpd.readthedocs.io/ Source: https://github.com/aio-libs/aiosmtpd/archive/v%{version}.tar.gz#/aiosmtpd-%{version}.tar.gz +# PATCH-FIX-UPSTREAM Based on gh#aio-libs/aiosmtpd#473 +Patch0: support-python-313.patch +BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} BuildRequires: fdupes BuildRequires: git-core BuildRequires: python-rpm-macros Requires: python-atpublic Requires: python-attrs -Requires: (python-typing_extensions if python-base < 3.8) Requires: user(nobody) Requires(post): update-alternatives Requires(postun): update-alternatives @@ -42,7 +44,6 @@ BuildRequires: %{python_module attrs} BuildRequires: %{python_module pytest-asyncio} BuildRequires: %{python_module pytest-mock} BuildRequires: %{python_module pytest} -BuildRequires: %{python_module typing_extensions if %python-base < 3.8} BuildRequires: user(nobody) # /SECTION %python_subpackages @@ -68,10 +69,10 @@ This package provides such an implementation of both the SMTP and LMTP protocols sed -i '/--cov=/d' pytest.ini %build -%python_build +%pyproject_wheel %install -%python_install +%pyproject_install %python_clone -a %{buildroot}%{_bindir}/aiosmtpd %python_expand %fdupes %{buildroot}%{$python_sitelib} @@ -97,7 +98,7 @@ ignore="--ignore aiosmtpd/tests/test_server.py" %license LICENSE %python_alternative %{_bindir}/aiosmtpd %{python_sitelib}/aiosmtpd -%{python_sitelib}/aiosmtpd-%{version}*-info +%{python_sitelib}/aiosmtpd-%{version}.dist-info %exclude %{python_sitelib}/aiosmtpd/docs %changelog diff --git a/support-python-313.patch b/support-python-313.patch new file mode 100644 index 0000000..04b6ca2 --- /dev/null +++ b/support-python-313.patch @@ -0,0 +1,26 @@ +diff --git a/aiosmtpd/tests/test_server.py b/aiosmtpd/tests/test_server.py +index 443c0833..d2251d4a 100644 +--- a/aiosmtpd/tests/test_server.py ++++ b/aiosmtpd/tests/test_server.py +@@ -448,10 +448,17 @@ def test_unixsocket(self, safe_socket_dir, autostop_loop, runner): + # Stop the task + cont.end() + catchup_delay() +- # Now the listener has gone away +- # noinspection PyTypeChecker +- with pytest.raises((socket.timeout, ConnectionError)): +- assert_smtp_socket(cont) ++ if sys.version_info < (3, 13): ++ # Now the listener has gone away ++ # noinspection PyTypeChecker ++ with pytest.raises((socket.timeout, ConnectionError)): ++ assert_smtp_socket(cont) ++ else: ++ # Starting from Python 3.13, listening asyncio Unix socket is ++ # removed on close, see: ++ # https://github.com/python/cpython/issues/111246 ++ # https://github.com/python/cpython/pull/111483 ++ assert not Path(cont.unix_socket).exists() + + @pytest.mark.filterwarnings( + "ignore::pytest.PytestUnraisableExceptionWarning"