forked from pool/python-authheaders
Accepting request 1138689 from devel:languages:python
- Update to version 0.16.0
* Switch from pkg_resources resource_filename to
importlib_resources
* Add initial doctests for dmarc_lookup.py
* Correctly strip trailing backslash in parsed DMARC record
components
* Handle DMARC records containing empty quoted values (#26)
* Add dmarc_lookup.DMARCException and raise it for missing
tag/values (#27)
* Catch DMARCException error and return DMARC permerror
result (#27)
* Set DMARC result to permerror if From domain cannot be
extracted (#25)
* Use dns.resolver.resolve instead of dns.resolver.query
due to deprecation
* Update PSL from upstream
* Add new option for authenticate_message, dmarcbis to
enable DMARC policy
* discovery and alignment per draft-ietf-dmarc-dmarcbis
(default is False)
- Removed authheaders-importlib-resources.patch
OBS-URL: https://build.opensuse.org/request/show/1138689
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-authheaders?expand=0&rev=9
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e6272060293fb42dbb91939b2fefb34fa2774a1e0e0a4dadd0c7f2ed4104b7c3
|
||||
size 108353
|
||||
3
authheaders-0.16.0.tar.gz
Normal file
3
authheaders-0.16.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bc07214eac61bc54a145b113ddebc2c956621a68431b0534b9787ad584891d9f
|
||||
size 111904
|
||||
@@ -1,126 +0,0 @@
|
||||
From 6affef51c7d2efce4489c164aaed8e57437117c2 Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schneider <asn@cryptomilk.org>
|
||||
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 <asn@cryptomilk.org>
|
||||
---
|
||||
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 <gene@valimail.com>
|
||||
#
|
||||
|
||||
+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
|
||||
- # <https://publicsuffix.org/list/effective_tld_names.dat>
|
||||
-
|
||||
- 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)
|
||||
@@ -1,3 +1,28 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Jan 13 17:31:08 UTC 2024 - Andreas Schneider <asn@cryptomilk.org>
|
||||
|
||||
- Update to version 0.16.0
|
||||
* Switch from pkg_resources resource_filename to
|
||||
importlib_resources
|
||||
* Add initial doctests for dmarc_lookup.py
|
||||
* Correctly strip trailing backslash in parsed DMARC record
|
||||
components
|
||||
* Handle DMARC records containing empty quoted values (#26)
|
||||
* Add dmarc_lookup.DMARCException and raise it for missing
|
||||
tag/values (#27)
|
||||
* Catch DMARCException error and return DMARC permerror
|
||||
result (#27)
|
||||
* Set DMARC result to permerror if From domain cannot be
|
||||
extracted (#25)
|
||||
* Use dns.resolver.resolve instead of dns.resolver.query
|
||||
due to deprecation
|
||||
* Update PSL from upstream
|
||||
* Add new option for authenticate_message, dmarcbis to
|
||||
enable DMARC policy
|
||||
* discovery and alignment per draft-ietf-dmarc-dmarcbis
|
||||
(default is False)
|
||||
- Removed authheaders-importlib-resources.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 8 08:47:41 UTC 2024 - Andreas Schneider <asn@cryptomilk.org>
|
||||
|
||||
@@ -34,7 +59,7 @@ Sat Jan 15 16:55:40 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
- Include ARC result comment is A-R header field when ARC fails. Fixes
|
||||
Github #12
|
||||
- Handle the case where no valid From is found. Fixes Github #15
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Apr 12 08:49:13 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user