Sync from SUSE:SLFO:Main python-email-validator revision a81d826b496063a8ba7992980dfe5072

This commit is contained in:
Adrian Schröter 2024-12-13 11:22:52 +01:00
parent 119fe09162
commit a3c77c45b9
5 changed files with 84 additions and 69 deletions

View File

@ -1,59 +0,0 @@
Index: python-email-validator-2.0.0/email_validator/deliverability.py
===================================================================
--- python-email-validator-2.0.0.orig/email_validator/deliverability.py
+++ python-email-validator-2.0.0/email_validator/deliverability.py
@@ -6,11 +6,11 @@ import dns.resolver
import dns.exception
-def caching_resolver(*, timeout: Optional[int] = None, cache=None):
+def caching_resolver(*, timeout: Optional[int] = None, cache=None, resolv=None):
if timeout is None:
from . import DEFAULT_TIMEOUT
timeout = DEFAULT_TIMEOUT
- resolver = dns.resolver.Resolver()
+ resolver = dns.resolver.Resolver(filename=resolv or '/etc/resolv.conf')
resolver.cache = cache or dns.resolver.LRUCache() # type: ignore
resolver.lifetime = timeout # type: ignore # timeout, in seconds
return resolver
Index: python-email-validator-2.0.0/tests/mocked_dns_response.py
===================================================================
--- python-email-validator-2.0.0.orig/tests/mocked_dns_response.py
+++ python-email-validator-2.0.0/tests/mocked_dns_response.py
@@ -1,5 +1,6 @@
import dns.resolver
import json
+import os
import os.path
import pytest
@@ -32,7 +33,8 @@ class MockedDnsResponseData:
# Return a new dns.resolver.Resolver configured for caching
# using the singleton instance.
- return caching_resolver(cache=MockedDnsResponseData.INSTANCE)
+ return caching_resolver(cache=MockedDnsResponseData.INSTANCE,
+ resolv=os.environ.get('RESOLV_FILE'))
def __init__(self):
self.data = {}
Index: python-email-validator-2.0.0/tests/test_deliverability.py
===================================================================
--- python-email-validator-2.0.0.orig/tests/test_deliverability.py
+++ python-email-validator-2.0.0/tests/test_deliverability.py
@@ -1,5 +1,6 @@
import pytest
import re
+import os
from email_validator import EmailUndeliverableError, \
validate_email, caching_resolver
@@ -73,7 +74,7 @@ def test_caching_dns_resolver():
self.cache[key] = value
cache = TestCache()
- resolver = caching_resolver(timeout=1, cache=cache)
+ resolver = caching_resolver(timeout=1, cache=cache, resolv=os.environ.get('RESOLV_FILE'))
validate_email("test@gmail.com", dns_resolver=resolver)
assert len(cache.cache) == 1

BIN
email_validator-2.0.0.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
email_validator-2.2.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,79 @@
-------------------------------------------------------------------
Sat Jun 29 16:02:19 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 2.2.0:
* Email addresses with internationalized local parts could,
with rare Unicode characters, be returned as valid but
actually be invalid in their normalized form (returned in the
`normalized` field). Local parts now re-validated after
Unicode NFC normalization to ensure that invalid characters
cannot be injected into the normalized address and that
characters with length-increasing NFC normalizations cannot
cause a local part to exceed the maximum length after
normalization.
* The length check for email addresses with internationalized
local parts is now also applied to the original address
string prior to Unicode NFC normalization, which may be
longer and could exceed the maximum email address length, to
protect callers who do not use the returned normalized
address.
* Improved error message for IDNA domains that are too long or
have invalid characters after Unicode normalization.
* A new option to parse `My Name <address@domain>` strings,
i.e. a display name plus an email address in angle brackets,
is now available. It is off by default.
* Improvements to Python typing.
* Some additional tests added.
-------------------------------------------------------------------
Wed Jun 19 07:08:36 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 2.1.2:
* The domain name length limit is corrected from 255 to 253
IDNA ASCII characters. I misread the RFCs.
* When a domain name has no MX record but does have an A or
AAAA record, if none of the IP addresses in the response are
globally reachable (i.e. not Private-Use, Loopback, etc.),
the response is treated as if there was no A/AAAA response
and the email address will fail the deliverability check.
* When a domain name has no MX record but does have an A or
AAAA record, the mx field in the object returned by
validate_email incorrectly held the IP addresses rather than
the domain itself.
* Fixes in tests.
-------------------------------------------------------------------
Thu Jun 6 07:38:28 UTC 2024 - Dirk Müller <dmueller@suse.com>
- update to 2.1.1:
* Fixed typo 'marking' instead of 'marketing' in case-
insensitive mailbox name list.
* When DNS-based deliverability checks fail, in some cases
exceptions are now thrown with `raise ... from` for better
nested exception tracking.
* Fixed tests to work when no local resolver can be configured.
* This project is now licensed under the Unlicense (instead of
CC0).
* Minor improvements to tests.
* Minor improvements to code style.
- drop dont-require-resolv-tests.patch: obsolete
-------------------------------------------------------------------
Thu Nov 16 10:02:55 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 2.1.0:
* Python 3.8+ is now required (support for Python 3.7 was
dropped).
* The old `email` field on the returned `ValidatedEmail`
object, which in the previous version was superseded by
`normalized`, will now raise a deprecation warning if used.
See https://stackoverflow.com/q/879173 for strategies to
suppress the DeprecationWarning.
* A `__version__` module attribute is added.
* The email address argument to validate_email is now marked as
positional-only to better reflect the documented usage using
the new Python 3.8 feature.
-------------------------------------------------------------------
Thu May 25 08:23:47 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
@ -95,7 +171,7 @@ Thu Sep 8 07:24:18 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
TEST_ENVIRONMENT, and DEFAULT_TIMEOUT can be used to change the default
values of the keyword arguments.
- Add patch ignore-urllib3-pyopenssl-warning.patch:
* Ignore warning as error from requests-toolbelt via dnspython.
* Ignore warning as error from requests-toolbelt via dnspython.
-------------------------------------------------------------------
Tue Apr 19 17:42:44 UTC 2022 - Matej Cepl <mcepl@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-email-validator
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,9 +17,8 @@
%{?sle15_python_module_pythons}
%define skip_python2 1
Name: python-email-validator
Version: 2.0.0
Version: 2.2.0
Release: 0
Summary: A robust email syntax and deliverability validation library for Python
License: CC0-1.0
@ -28,8 +27,7 @@ Source: https://github.com/JoshData/python-email-validator/archive/refs/
# PATCH-FIX-OPENSUSE Ignore DeprecationWarning until requests-toolbelt is fixed
# (Pulled in by dnspython)
Patch0: ignore-urllib3-pyopenssl-warning.patch
# PATCH-FIX-OPENSUSE do not require /etc/resolv.conf for testing
Patch1: dont-require-resolv-tests.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module dnspython >= 1.15.0}
BuildRequires: %{python_module idna >= 2.0.0}
BuildRequires: %{python_module pytest >= 5.0}
@ -40,7 +38,7 @@ Requires: python-dnspython >= 1.15.0
Requires: python-idna >= 2.0.0
Requires: python-setuptools
Requires(post): update-alternatives
Requires(postun):update-alternatives
Requires(postun): update-alternatives
Provides: python-email_validator = %{version}-%{release}
Obsoletes: python-email_validator < %{version}-%{release}
BuildArch: noarch