Sync from SUSE:ALP:Source:Standard:1.0 python-email-validator revision 2cc59c58316eec294729f3846508ee88

This commit is contained in:
Adrian Schröter 2023-10-19 00:18:18 +02:00
commit 68b258072e
6 changed files with 369 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

View File

@ -0,0 +1,59 @@
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) Normal file

Binary file not shown.

View File

@ -0,0 +1,11 @@
Index: python-email-validator-2.0.0/setup.cfg
===================================================================
--- python-email-validator-2.0.0.orig/setup.cfg
+++ python-email-validator-2.0.0/setup.cfg
@@ -43,5 +43,6 @@ max-line-length = 120
testpaths = tests
filterwarnings =
error
+ ignore:.*urllib3.contrib.pyopenssl.*:DeprecationWarning
markers =
network: mark a test as requiring Internet access.

View File

@ -0,0 +1,178 @@
-------------------------------------------------------------------
Thu May 25 08:23:47 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Add dont-require-resolv-tests.patch to make tests run without an
existing /etc/resolv.conf file
- Update to 2.0.0:
This is a major update to the library, but since email address specs
haven't changed there should be no significant changes to which
email addresses are considered valid or invalid with default
options. There are new options for accepting unusual email addresses
that were previously always rejected, some changes to how DNS errors
are handled, many changes in error message text, and major internal
improvements including the addition of type annotations. Python 3.7+
is now required. Details follow:
* Python 2.x and 3.x versions through 3.6, and dnspython 1.x, are no
longer supported. Python 3.7+ with dnspython 2.x are now required.
* The dnspython package is no longer required if DNS checks are not
used, although it will install automatically.
* NoNameservers and NXDOMAIN DNS errors are now handled differently:
NoNameservers no longer fails validation, and NXDOMAIN now skips
checking for an A/AAAA fallback and goes straight to failing
validation.
* Some syntax error messages have changed because they are now
checked explicitly rather than as a part of other checks.
* The quoted-string local part syntax (e.g. multiple @-signs,
spaces, etc. if surrounded by quotes) and domain-literal addresses
(e.g. @[192.XXX...] or @[IPv6:...]) are now parsed but not
considered valid by default. Better error messages are now given
for these addresses since it can be confusing for a technically
valid address to be rejected, and new allow_quoted_local and
allow_domain_literal options are added to allow these addresses if
you really need them.
* Some other error messages have changed to not repeat the email
address in the error message.
* The email field on the returned ValidatedEmail object has been
renamed to normalized to be clearer about its importance, but
access via .email is also still supported.
* Some mailbox names like postmaster are now normalized to lowercase
per RFC 2142.
* The library has been reorganized internally into smaller modules.
* The tests have been reorganized and expanded. Deliverability tests
now mostly use captured DNS responses so they can be run off-line.
* The main tool now reads options to validate_email from environment
variables.
* Type annotations have been added to the exported methods and the
ValidatedEmail class and some internal methods.
* The old dict-like pattern for the return value of validate_email
is deprecated.
Versions 2.0.0.post1 and 2.0.0.post2 corrected some packaging
issues. 2.0.0.post2 also added a check for an invalid combination of
arguments.
-------------------------------------------------------------------
Thu May 25 07:18:27 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Sat Jan 28 13:39:59 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 1.3.1:
* The new SPF 'v=spf1 -all' (reject-all) deliverability check is removed
in most cases. It now is performed only for domains that do not have MX
records but do have an A/AAAA fallback record.
-------------------------------------------------------------------
Tue Oct 4 08:06:34 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Update to 1.3.0:
* Deliverability checks now check for 'v=spf1 -all' SPF records as a way to reject more bad domains.
* Special use domain names now raise EmailSyntaxError instead of EmailUndeliverableError since they are performed even if check_deliverability is off.
* New module-level attributes are added to override the default values of the keyword arguments and the special-use domains list.
* The keyword arguments of the public methods are now marked as keyword-only.
* pyIsEmail's test cases are added to the tests.
* Recommend that check_deliverability be set to False for validation on login pages.
* Added an undocumented globally_deliverable option.
-------------------------------------------------------------------
Thu Sep 8 07:24:18 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.2.1:
* Rejecting domains with NULL MX records (when deliverability checks are
turned on).
* Rejecting unsafe unicode characters. (Some of these checks you should be
doing on all of your user inputs already!)
* Rejecting most special-use reserved domain names. A new test_environment
option is added for using @*.test domains.
* example and example.com/net/org are removed from the special-use domains
list.
* SPECIAL_USE_DOMAIN_NAMES is now a documented part of the API (and it is a
list instead of a tuple)
* New module-level attributes ALLOW_SMTPUTF8, CHECK_DELIVERABILITY,
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.
-------------------------------------------------------------------
Tue Apr 19 17:42:44 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Fix the name of the package (it should be email-validator, not
email_validator).
-------------------------------------------------------------------
Mon Aug 16 09:14:16 UTC 2021 - Fusion Future <qydwhotmail@gmail.com>
- Update to 1.1.3:
* Add possibility to cache dns lookups (#58)
* Add py39 and setup_py to setup_cfg (#57)
- Changes from 1.1.2:
* Refactor: Main refactored, tests added for main (#52)
* Simplify email equality check into return statement (#51)
* Dedupe length reason logic and declare magic numbers as
constants (#50)
* Fix: ValidatedEmail is not JSON serializable (#49)
* Use dnspython's resolve method when available (#46)
* Package name should have a dash not an underscore
* Mention Punycode normalization, re-do fields as a table
- Drop fix-tests-strings.patch which is not needed.
- Move skipped tests to spec file, drop skip-tests-using-network.patch.
-------------------------------------------------------------------
Thu Sep 17 11:02:14 UTC 2020 - Dirk Mueller <dmueller@suse.com>
- update to 1.1.1:
* Fix exception on DNS timeout
* Mention Punycode in the README
* Flake8 fixes
-------------------------------------------------------------------
Tue May 26 06:34:06 UTC 2020 - Petr Gajdos <pgajdos@suse.com>
- %python3_only -> %python_alternative
-------------------------------------------------------------------
Mon May 11 07:38:24 UTC 2020 - Antonio Larrosa <alarrosa@suse.com>
- Do not build python2 version
- Add patch to fix error messages being compared in tests to match
error messages in Leap/SLE:
* fix-tests-strings.patch
-------------------------------------------------------------------
Thu May 7 12:03:47 UTC 2020 - Antonio Larrosa <alarrosa@suse.com>
- version update to 1.1.0
* no upstream changelog
- version update to 1.0.5
* no upstream changelog
- Use pytest
- Add patch to skip tests that try to check MX records of domains:
* skip-tests-using-network.patch
-------------------------------------------------------------------
Tue May 7 10:28:10 UTC 2019 - pgajdos@suse.com
- version update to 1.0.4
* no upstream changelog
-------------------------------------------------------------------
Thu Mar 14 15:48:48 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 1.0.3:
* metadata fixes
-------------------------------------------------------------------
Tue Dec 4 12:47:37 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Wed Sep 6 16:48:08 UTC 2017 - toddrme2178@gmail.com
- Initial version

View File

@ -0,0 +1,95 @@
#
# spec file for package python-email-validator
#
# Copyright (c) 2023 SUSE LLC
#
# 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/
#
%{?sle15_python_module_pythons}
%define skip_python2 1
Name: python-email-validator
Version: 2.0.0
Release: 0
Summary: A robust email syntax and deliverability validation library for Python
License: CC0-1.0
URL: https://github.com/JoshData/python-email-validator
Source: https://github.com/JoshData/python-email-validator/archive/refs/tags/v%{version}.tar.gz#/email_validator-%{version}.tar.gz
# 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 dnspython >= 1.15.0}
BuildRequires: %{python_module idna >= 2.0.0}
BuildRequires: %{python_module pytest >= 5.0}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-dnspython >= 1.15.0
Requires: python-idna >= 2.0.0
Requires: python-setuptools
Requires(post): update-alternatives
Requires(postun):update-alternatives
Provides: python-email_validator = %{version}-%{release}
Obsoletes: python-email_validator < %{version}-%{release}
BuildArch: noarch
%python_subpackages
%description
A robust email address syntax and deliverability validation library
for Python 2.7/3.4 by Joshua Tauberer.
This library validates that address are of the form ``x@y.com``. This is
the sort of validation you would want for a login form on a website.
Key features:
* Good for validating email addresses used for logins/identity.
* Friendly error messages when validation fails (appropriate to show to end users).
* (optionally) Checks deliverability: Does the domain name resolve?
* Supports internationalized domain names and (optionally) internationalized local parts.
* Normalizes email addresses (super important for internationalized addresses! see below).
%prep
%autosetup -p1 -n python-email-validator-%{version}
%build
%python_build
%install
%python_install
%python_clone -a %{buildroot}%{_bindir}/email_validator
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
echo "nameserver 1.1.1.1" > resolv.conf
export RESOLV_FILE=$PWD/resolv.conf
# test_caching_dns_resolver fails when running with kvm
donttest="test_caching_dns_resolver"
%pytest tests -k "not ($donttest)"
%post
%python_install_alternative email_validator
%postun
%python_uninstall_alternative email_validator
%files %{python_files}
%license LICENSE
%doc README.md
%python_alternative %{_bindir}/email_validator
%{python_sitelib}/email_validator
%{python_sitelib}/email_validator-%{version}*-info
%changelog