From 1fa2f20d4254bc56c2d1572c893638c1621666e972986b6edc1ffafdeab476c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Tue, 10 Jun 2025 09:06:16 +0000 Subject: [PATCH 1/2] - Convert to pip-based build OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pymilter?expand=0&rev=17 --- .gitattributes | 23 +++++ .gitignore | 1 + ...o-the-deprecated-method-assertEquals.patch | 65 ++++++++++++ pymilter-1.0.5.tar.gz | 3 + python-pymilter.changes | 53 ++++++++++ python-pymilter.spec | 99 +++++++++++++++++++ tmpfiles-python-pymilter.conf | 1 + 7 files changed, 245 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 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..88d5321 --- /dev/null +++ b/python-pymilter.changes @@ -0,0 +1,53 @@ +------------------------------------------------------------------- +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..0e346c4 --- /dev/null +++ b/python-pymilter.spec @@ -0,0 +1,99 @@ +# +# 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 +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}/pymilter-%{version}*-info + +%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/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 - From 32e29c9ee5a52b5c5b87e91aa766ea552a9fa9f3ed8f4fc88651979655fd5027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mark=C3=A9ta=20Machov=C3=A1?= Date: Tue, 10 Jun 2025 09:09:07 +0000 Subject: [PATCH 2/2] fix files OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pymilter?expand=0&rev=18 --- python-pymilter.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python-pymilter.spec b/python-pymilter.spec index 0e346c4..b150a6a 100644 --- a/python-pymilter.spec +++ b/python-pymilter.spec @@ -85,7 +85,10 @@ rm test.py testpolicy.py %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