diff --git a/authheaders-0.15.3.tar.gz b/authheaders-0.15.3.tar.gz deleted file mode 100644 index 4d748b6..0000000 --- a/authheaders-0.15.3.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e6272060293fb42dbb91939b2fefb34fa2774a1e0e0a4dadd0c7f2ed4104b7c3 -size 108353 diff --git a/authheaders-0.16.0.tar.gz b/authheaders-0.16.0.tar.gz new file mode 100644 index 0000000..b63bb1d --- /dev/null +++ b/authheaders-0.16.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc07214eac61bc54a145b113ddebc2c956621a68431b0534b9787ad584891d9f +size 111904 diff --git a/authheaders-importlib-resources.patch b/authheaders-importlib-resources.patch deleted file mode 100644 index 0472014..0000000 --- a/authheaders-importlib-resources.patch +++ /dev/null @@ -1,126 +0,0 @@ -From 6affef51c7d2efce4489c164aaed8e57437117c2 Mon Sep 17 00:00:00 2001 -From: Andreas Schneider -Date: Mon, 8 Jan 2024 09:44:07 +0100 -Subject: [PATCH] Migrate to importlib_resources - -I'm getting: -pkg_resources.DistributionNotFound: The 'flufl.lock>=5.1' distribution was not found and is required by mailman - -The reason is that flufl.lock switched to PDM and it looks like -pkg_resources can't deal with it. Migrating to importlib_resources -resolves the problem. - -This is following: -https://importlib-resources.readthedocs.io/en/latest/migration.html - -Signed-off-by: Andreas Schneider ---- - authheaders/__init__.py | 25 +++++++++++++------------ - authheaders/dmarc_lookup.py | 36 ++++++++++++------------------------ - 2 files changed, 25 insertions(+), 36 deletions(-) - -diff --git a/authheaders/__init__.py b/authheaders/__init__.py -index d37eca7..0d7be3f 100644 ---- a/authheaders/__init__.py -+++ b/authheaders/__init__.py -@@ -18,6 +18,7 @@ - # Contact: Gene Shuman - # - -+import importlib_resources - import re - import sys - import copy -@@ -28,7 +29,6 @@ - from authres.dmarc import DMARCAuthenticationResult - from dkim import ARC, DKIM, arc_verify, dkim_verify, DKIMException, rfc822_parse - from dns.exception import DNSException --from pkg_resources import resource_filename # Part of setuptools - - # Please accept my appologies for doing this - try: -@@ -57,17 +57,18 @@ def check_psddmarc_list(psdname, dnsfunc=dns_query): - """Check psddmarc.org list of PSD DMARC participants""" - try: - # If the PSD registry is locally available, use it. -- psdfile_name = resource_filename('authheaders', 'psddmarc.csv') -- psd_file = open(psdfile_name) -- psds = [] -- for line in psd_file.readlines(): -- sp = line.split(',') -- if sp[1] == 'current': -- psds.append(sp[0][1:]) -- if psdname in psds: -- return True -- else: -- return False -+ ref = importlib_resources.files('authheaders') / 'psddmarc.csv' -+ with importlib_resources.as_file(ref) as psdfile_name: -+ with open(psdfile_name) as psd_file: -+ psds = [] -+ for line in psd_file.readlines(): -+ sp = line.split(',') -+ if sp[1] == 'current': -+ psds.append(sp[0][1:]) -+ if psdname in psds: -+ return True -+ else: -+ return False - except: - # If not, use the DNS query list. - psd_list_host = '.psddmarc.org' -diff --git a/authheaders/dmarc_lookup.py b/authheaders/dmarc_lookup.py -index 6e1ffe3..7a00fb0 100644 ---- a/authheaders/dmarc_lookup.py -+++ b/authheaders/dmarc_lookup.py -@@ -19,7 +19,7 @@ - # - ############################################################################ - from __future__ import absolute_import, unicode_literals, print_function --from pkg_resources import resource_filename # Part of setuptools -+import importlib_resources - try: - # typing is needed by mypy, but is unused otherwise - from typing import Dict, Text # noqa: F401 -@@ -166,30 +166,18 @@ def receiver_record_walk(host, dnsfunc=dns_query): - result[newHost] = retval - return result - --def get_org_domain(domain): -- fn = get_suffix_list_file_name() -- with open(fn) as suffixList: -+ -+def get_org_domain_from_suffix_list(location, domain): -+ with open(location) as suffixList: - psl = PublicSuffixList(suffixList) - return psl.get_public_suffix(domain) - - --def get_suffix_list_file_name(): -- # type: () -> Text -- '''Get the file name for the public-suffix list data file -- -- :returns: The filename for the datafile in this module. -- :rtype: ``str``''' -- # TODO: automatically update the suffix list data file -- # -- -- if sys.version_info < (3, 0): -- try: -- from authheaders.findpsl import location -- except ImportError: -- location = resource_filename('authheaders', 'public_suffix_list.txt') -- else: -- try: -- from authheaders.findpsl import location -- except ModuleNotFoundError: -- location = resource_filename('authheaders', 'public_suffix_list.txt') -- return location -+def get_org_domain(domain): -+ try: -+ from authheaders.findpsl import location -+ return get_org_domain_from_suffix_list(location, domain) -+ except ModuleNotFoundError: -+ ref = importlib_resources.files('authheaders') / 'public_suffix_list.txt' -+ with importlib_resources.as_file(ref) as location: -+ return get_org_domain_from_suffix_list(location, domain) diff --git a/python-authheaders.changes b/python-authheaders.changes index 22c73bc..b99890e 100644 --- a/python-authheaders.changes +++ b/python-authheaders.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Sat Jan 13 17:31:08 UTC 2024 - Andreas Schneider + +- Update to version 0.16.0 + * https://github.com/ValiMail/authentication-headers/blob/0.16.0/CHANGES + or the CHANGES file included in this package +- Removed authheaders-importlib-resources.patch + ------------------------------------------------------------------- Mon Jan 8 08:47:41 UTC 2024 - Andreas Schneider diff --git a/python-authheaders.spec b/python-authheaders.spec index c37f0d1..5236519 100644 --- a/python-authheaders.spec +++ b/python-authheaders.spec @@ -18,13 +18,12 @@ %{?sle15_python_module_pythons} Name: python-authheaders -Version: 0.15.3 +Version: 0.16.0 Release: 0 Summary: A library wrapping email authentication header verification and generation License: MIT URL: https://github.com/ValiMail/authentication-headers Source: https://files.pythonhosted.org/packages/source/a/authheaders/authheaders-%{version}.tar.gz -Patch0: https://github.com/ValiMail/authentication-headers/pull/28.patch#/authheaders-importlib-resources.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -64,7 +63,9 @@ rm %{buildroot}%{_bindir}/dmarc-policy-find %check export LANG=en_US.UTF-8 -%pytest +# Test requires /etc/resolv.conf via dnspython +donttest="(TestAuthenticateMessage and test_authenticate_dmarc_psdsub)" +%pytest -k "not (${donttest})" %files %{python_files} %doc CHANGES README.md