From ea78f1a65c851ad5014e74fe5a9ec93e961e5fdabf2b2bc79de944b60f541fa6 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 30 Jul 2025 05:00:30 +0000 Subject: [PATCH] - Add patch set-c-standard-17.patch: * Set the C standard to c17 until libmilter is fixed. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pymilter?expand=0&rev=20 --- .gitattributes | 23 ++++ .gitignore | 1 + ...o-the-deprecated-method-assertEquals.patch | 65 +++++++++++ pymilter-1.0.5.tar.gz | 3 + python-pymilter.changes | 59 ++++++++++ python-pymilter.spec | 104 ++++++++++++++++++ set-c-standard-17.patch | 27 +++++ tmpfiles-python-pymilter.conf | 1 + 8 files changed, 283 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-Remove-calls-to-the-deprecated-method-assertEquals.patch create mode 100644 pymilter-1.0.5.tar.gz create mode 100644 python-pymilter.changes create mode 100644 python-pymilter.spec create mode 100644 set-c-standard-17.patch create mode 100644 tmpfiles-python-pymilter.conf 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/0001-Remove-calls-to-the-deprecated-method-assertEquals.patch b/0001-Remove-calls-to-the-deprecated-method-assertEquals.patch new file mode 100644 index 0000000..a976fa2 --- /dev/null +++ b/0001-Remove-calls-to-the-deprecated-method-assertEquals.patch @@ -0,0 +1,65 @@ +From 1ead9028fc63ae3ec6ea3b0c438e6ed088a2b20e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jaime=20Marqui=CC=81nez=20Ferra=CC=81ndiz?= + +Date: Tue, 5 Mar 2024 19:14:30 +0100 +Subject: [PATCH] Remove calls to the deprecated method "assertEquals" +Reference: https://github.com/sdgathman/pymilter/pull/57 + +It has been removed in python 3.12 +--- + testsample.py | 6 +++--- + testutils.py | 4 ++-- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/testsample.py b/testsample.py +index 100d1a6..70222bf 100644 +--- a/testsample.py ++++ b/testsample.py +@@ -31,7 +31,7 @@ class BMSMilterTestCase(unittest.TestCase): + count = 10 + while count > 0: + rc = ctx._connect(helo='milter-template.example.org') +- self.assertEquals(rc,Milter.CONTINUE) ++ self.assertEqual(rc,Milter.CONTINUE) + with open('test/'+fname,'rb') as fp: + rc = ctx._feedFile(fp) + milter = ctx.getpriv() +@@ -46,7 +46,7 @@ class BMSMilterTestCase(unittest.TestCase): + ctx._setsymval('{auth_type}','batcomputer') + ctx._setsymval('j','mailhost') + rc = ctx._connect() +- self.assertEquals(rc,Milter.CONTINUE) ++ self.assertEqual(rc,Milter.CONTINUE) + with open('test/'+fname,'rb') as fp: + rc = ctx._feedFile(fp) + milter = ctx.getpriv() +@@ -69,7 +69,7 @@ class BMSMilterTestCase(unittest.TestCase): + milter = ctx.getpriv() + # self.assertTrue(milter.user == 'batman',"getsymval failed: "+ + # "%s != %s"%(milter.user,'batman')) +- self.assertEquals(milter.user,'batman') ++ self.assertEqual(milter.user,'batman') + self.assertTrue(milter.auth_type != 'batcomputer',"setsymlist failed") + self.assertTrue(rc == Milter.ACCEPT) + self.assertTrue(ctx._bodyreplaced,"Message body not replaced") +diff --git a/testutils.py b/testutils.py +index 56ec161..93e078c 100644 +--- a/testutils.py ++++ b/testutils.py +@@ -24,11 +24,11 @@ class AddrCacheTestCase(unittest.TestCase): + self.assertTrue(cache.has_key('foo@bar.com')) + self.assertTrue(not cache.has_key('hello@bar.com')) + self.assertTrue('baz@bar.com' in cache) +- self.assertEquals(cache['temp@bar.com'],'testing') ++ self.assertEqual(cache['temp@bar.com'],'testing') + s = open(self.fname).readlines() + self.assertTrue(len(s) == 2) + self.assertTrue(s[0].startswith('foo@bar.com ')) +- self.assertEquals(s[1].strip(),'baz@bar.com') ++ self.assertEqual(s[1].strip(),'baz@bar.com') + # check that new result overrides old + cache['temp@bar.com'] = None + self.assertTrue(not cache['temp@bar.com']) +-- +2.44.0 + diff --git a/pymilter-1.0.5.tar.gz b/pymilter-1.0.5.tar.gz new file mode 100644 index 0000000..7067551 --- /dev/null +++ b/pymilter-1.0.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8093032829ddd53261dbe2991959514156767f3785dfb095ed9b17f3fba965e1 +size 1030610 diff --git a/python-pymilter.changes b/python-pymilter.changes new file mode 100644 index 0000000..e8a0f9f --- /dev/null +++ b/python-pymilter.changes @@ -0,0 +1,59 @@ +------------------------------------------------------------------- +Wed Jul 30 04:59:43 UTC 2025 - Steve Kowalik + +- Add patch set-c-standard-17.patch: + * Set the C standard to c17 until libmilter is fixed. + +------------------------------------------------------------------- +Tue Jun 10 09:04:00 UTC 2025 - Markéta Machová + +- Convert to pip-based build + +------------------------------------------------------------------- +Tue Mar 5 18:22:42 UTC 2024 - Jaime Marquínez Ferrándiz + +- Actually run the correct tests +- Fix the fdupes call +- Add 0001-Remove-calls-to-the-deprecated-method-assertEquals.patch + +------------------------------------------------------------------- +Sat Jan 7 23:24:10 UTC 2023 - Dirk Müller + +- update to 1.0.5: + * fix deprecation warnings + +------------------------------------------------------------------- +Sat Feb 13 00:04:30 UTC 2021 - Neal Gompa + +- Fix dependency on py3dns so that flavor builds generate correctly + +------------------------------------------------------------------- +Fri Feb 12 13:10:10 UTC 2021 - Markéta Machová + +- Drop py{2.3}-only parts as py2 is skipped + +------------------------------------------------------------------- +Wed Dec 11 08:19:51 UTC 2019 - Tomáš Chvátal + +- Require full python for sqlite module + +------------------------------------------------------------------- +Thu Apr 25 08:37:53 UTC 2019 - pgajdos@suse.com + +- version update to 1.0.4 + - cleanup unused files, additional platform support + - Minor doc updates + - patch step for python3 no longer required in build +- turn the test suite on +- deleted patches + - pymilter-dns_dsn.patch (upstreamed) + +------------------------------------------------------------------- +Thu Sep 6 12:54:13 UTC 2018 - Jan Engelhardt + +- Fix grammar issues in description. Fix RPM group. + +------------------------------------------------------------------- +Thu Sep 6 02:33:45 UTC 2018 - Neal Gompa + +- Initial packaging diff --git a/python-pymilter.spec b/python-pymilter.spec new file mode 100644 index 0000000..f4926a2 --- /dev/null +++ b/python-pymilter.spec @@ -0,0 +1,104 @@ +# +# spec file for package python-pymilter +# +# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2018 Neal Gompa . +# +# 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/ +# + + +# we don't want to provide private python extension libs +%global __provides_exclude_from ^(%{python2_sitearch}/.*\\.so|%{python3_sitearch}/.*\\.so)$ +# Python 2 module isn't building properly and we don't really need it right now anyway... +Name: python-pymilter +Version: 1.0.5 +Release: 0 +Summary: Python interface to the sendmail milter API +License: GPL-2.0-or-later +URL: https://www.bmsi.com/python/milter.html +Source0: https://github.com/sdgathman/pymilter/archive/pymilter-%{version}.tar.gz +Source1: tmpfiles-python-pymilter.conf +# PATCH-FIX-UPSTREAM: https://github.com/sdgathman/pymilter/pull/57 +Patch1: 0001-Remove-calls-to-the-deprecated-method-assertEquals.patch +# PATCH-FIX-UPSTREAM https://github.com/sdgathman/pymilter/pull/70 +Patch2: set-c-standard-17.patch +BuildRequires: %{python_module bsddb3} +BuildRequires: %{python_module devel} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: %{pythons} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +BuildRequires: sendmail-devel >= 8.13 +BuildRequires: systemd-rpm-macros +# Common subpackage named as such to avoid creating flavor packages +Requires: pymilter-common = %{version}-%{release} +Requires: python +Requires: python-bsddb3 +Requires: python-py3dns +%python_subpackages + +%description +This is a Python extension module to enable python scripts to attach to +sendmail's libmilter functionality. Additional Python modules provide for +navigation and modification of MIME parts, sending DSNs, and doing CBV. + +%package -n pymilter-common +Summary: Common files for pymilter +Requires(post): systemd +BuildArch: noarch + +%description -n pymilter-common +This package contains the common files used for pymilter. + +%prep +%autosetup -n pymilter-pymilter-%{version} -p1 + +%build +%pyproject_wheel + +%install +%pyproject_install + +mkdir -p %{buildroot}%{_localstatedir}/log/milter +mkdir -p %{buildroot}%{_libexecdir}/milter +mkdir -p %{buildroot}%{_tmpfilesdir} +install -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf + +%python_expand %fdupes %{buildroot}/%{$python_sitearch} + +%check +# remove tests that don't work +rm test.py testpolicy.py +%pyunittest_arch -v + +%files %{python_files} +%doc README.md ChangeLog NEWS TODO CREDITS sample.py template.py +%license COPYING +%{python_sitearch}/Milter +%{python_sitearch}/milter.cpython* +%{python_sitearch}/mime.py +%{python_sitearch}/pymilter-%{version}*-info +%pycache_only %{python_sitearch}/__pycache__/mime* + +%files -n pymilter-common +%license COPYING +%{_libexecdir}/milter +%dir %attr(0755,mail,mail) %{_localstatedir}/log/milter +%{_tmpfilesdir}/%{name}.conf + +%post -n pymilter-common +%tmpfiles_create %{_tmpfilesdir}/%{name}.conf + +%changelog diff --git a/set-c-standard-17.patch b/set-c-standard-17.patch new file mode 100644 index 0000000..fe94cd0 --- /dev/null +++ b/set-c-standard-17.patch @@ -0,0 +1,27 @@ +From 050b3a15bc00a31968cbdcf627692c1eb2ca3219 Mon Sep 17 00:00:00 2001 +From: Sandro +Date: Wed, 12 Mar 2025 23:44:55 +0100 +Subject: [PATCH] Set C standard to C17 explicitely + +GCC 15 uses C23 by default. But `libmilter` is not compatible, yet. +This breaks the build as `bool` is a keyword in C23 (issue #68). +--- + setup.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 958feee..a6fe2a0 100644 +--- a/setup.py ++++ b/setup.py +@@ -36,7 +36,10 @@ + # set MAX_ML_REPLY to 1 for sendmail < 8.13 + define_macros = [ ('MAX_ML_REPLY',32) ], + # save lots of debugging time testing rfc2553 compliance +- extra_compile_args = [ "-Werror=implicit-function-declaration" ] ++ extra_compile_args = [ ++ "-Werror=implicit-function-declaration", ++ "-std=gnu17", ++ ] + ), + ], + keywords = ['sendmail','milter'], diff --git a/tmpfiles-python-pymilter.conf b/tmpfiles-python-pymilter.conf new file mode 100644 index 0000000..04c2f1a --- /dev/null +++ b/tmpfiles-python-pymilter.conf @@ -0,0 +1 @@ +D /var/run/milter 0755 mail mail -