1
0

Accepting request 942919 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/942919
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-FormEncode?expand=0&rev=16
This commit is contained in:
Dominique Leuenberger 2021-12-30 14:55:16 +00:00 committed by Git OBS Bridge
commit b32970a982
8 changed files with 64 additions and 2504 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ada2f51792b1b484e5bb7b6cc14acfc1bc11fafc967cf015cd57e856053ca7f6
size 197305

BIN
FormEncode-2.0.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,38 +0,0 @@
From: Chris Lamb <lamby@debian.org>
Date: Mon, 6 Aug 2018 22:29:58 +0800
Subject: Use "alpha_2" over "alpha2" for compatibility with newer versions of
pycountry.
---
formencode/national.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/formencode/national.py b/formencode/national.py
index a8514ab..5a55fab 100644
--- a/formencode/national.py
+++ b/formencode/national.py
@@ -85,19 +85,19 @@ elif pycountry:
_l = lambda t: gettext.dgettext('iso639', t)
def get_countries():
- c1 = set([(e.alpha2, _c(e.name)) for e in pycountry.countries])
+ c1 = set([(e.alpha_2, _c(e.name)) for e in pycountry.countries])
ret = c1.union(country_additions + fuzzy_countrynames)
return ret
def get_country(code):
- return _c(pycountry.countries.get(alpha2=code).name)
+ return _c(pycountry.countries.get(alpha_2=code).name)
def get_languages():
- return [(e.alpha2, _l(e.name)) for e in pycountry.languages
- if e.name and getattr(e, 'alpha2', None)]
+ return [(e.alpha_2, _l(e.name)) for e in pycountry.languages
+ if e.name and getattr(e, 'alpha_2', None)]
def get_language(code):
- return _l(pycountry.languages.get(alpha2=code).name)
+ return _l(pycountry.languages.get(alpha_2=code).name)
############################################################

View File

@ -1,172 +0,0 @@
Index: FormEncode-1.3.1/formencode/tests/test_context.py
===================================================================
--- FormEncode-1.3.1.orig/formencode/tests/test_context.py 2020-07-10 13:21:48.125612252 +0200
+++ FormEncode-1.3.1/formencode/tests/test_context.py 2020-07-10 14:11:53.460309142 +0200
@@ -1,55 +1,55 @@
from __future__ import absolute_import
-from nose.tools import assert_raises
+import unittest
from formencode.context import Context, ContextRestoreError
c1 = Context(default=None)
c2 = Context()
+class TestContext(unittest.TestCase):
-def test_one():
- state = c1.set(foo=1)
- assert_is(c1, 'foo', 1)
- state.restore()
- assert_is(c1, 'foo', None)
- state = c1.set(foo=2)
- state2 = c2.set(foo='test')
- assert_is(c1, 'foo', 2)
- assert_is(c2, 'foo', 'test')
- change_state(c1, assert_is, c1, 'foo', 3, foo=3)
- assert_is(c1, 'foo', 2)
- state.restore()
- state2.restore()
-
-
-def change_state(context, func, *args, **change):
- state = context.set(**change)
- try:
- return func(*args)
- finally:
+ def change_state(self, context, func, *args, **change):
+ state = context.set(**change)
+ try:
+ return func(*args)
+ finally:
+ state.restore()
+
+ def assert_is(self, ob, attr, value):
+ assert getattr(ob, attr) == value
+
+
+ def test_fail(self):
+ c3 = Context()
+ res1 = c3.set(a=1)
+ res2 = c3.set(b=2)
+ with self.assertRaises(ContextRestoreError):
+ res1.restore()
+ assert c3.b == 2
+ assert c3.a == 1
+ res2.restore()
+ res1.restore()
+
+ def test_default(self):
+ con = Context()
+ res = con.set(a=2)
+ con.set_default(a=4, b=1)
+ assert con.b == 1
+ assert con.a == 2
+ res.restore()
+ assert con.a == 4
+
+ def test_one(self):
+ state = c1.set(foo=1)
+ self.assert_is(c1, 'foo', 1)
state.restore()
+ self.assert_is(c1, 'foo', None)
+ state = c1.set(foo=2)
+ state2 = c2.set(foo='test')
+ self.assert_is(c1, 'foo', 2)
+ self.assert_is(c2, 'foo', 'test')
+ self.change_state(c1, self.assert_is, c1, 'foo', 3, foo=3)
+ self.assert_is(c1, 'foo', 2)
+ state.restore()
+ state2.restore()
-
-def test_fail():
- c3 = Context()
- res1 = c3.set(a=1)
- res2 = c3.set(b=2)
- assert_raises(ContextRestoreError, res1.restore)
- assert c3.b == 2
- assert c3.a == 1
- res2.restore()
- res1.restore()
-
-
-def assert_is(ob, attr, value):
- assert getattr(ob, attr) == value
-
-
-def test_default():
- con = Context()
- res = con.set(a=2)
- con.set_default(a=4, b=1)
- assert con.b == 1
- assert con.a == 2
- res.restore()
- assert con.a == 4
Index: FormEncode-1.3.1/formencode/tests/test_validators.py
===================================================================
--- FormEncode-1.3.1.orig/formencode/tests/test_validators.py 2020-07-10 13:21:48.125612252 +0200
+++ FormEncode-1.3.1/formencode/tests/test_validators.py 2020-07-10 14:12:08.540402950 +0200
@@ -4,7 +4,6 @@ from __future__ import unicode_literals
import datetime
import unittest
-from nose.plugins.skip import SkipTest
from formencode import validators
from formencode.validators import Invalid
Index: FormEncode-1.3.1/FormEncode.egg-info/requires.txt
===================================================================
--- FormEncode-1.3.1.orig/FormEncode.egg-info/requires.txt 2016-08-09 04:22:09.000000000 +0200
+++ FormEncode-1.3.1/FormEncode.egg-info/requires.txt 2020-07-10 14:14:06.917139411 +0200
@@ -1,5 +1,4 @@
[testing]
-nose
pycountry
dnspython
Index: FormEncode-1.3.1/formencode/tests/test_doctests.py
===================================================================
--- FormEncode-1.3.1.orig/formencode/tests/test_doctests.py 2020-07-10 13:21:48.125612252 +0200
+++ FormEncode-1.3.1/formencode/tests/test_doctests.py 2020-07-10 14:15:09.813530701 +0200
@@ -66,7 +66,7 @@ def doctest_module(document, verbose, ra
def set_func_description(fn, description):
- """Wrap function and set description attr for nosetests to display."""
+ """Wrap function and set description attr to display."""
def _wrapper(*a_test_args):
fn(*a_test_args)
_wrapper.description = description
@@ -75,7 +75,6 @@ def set_func_description(fn, description
def test_doctests():
"""Generate each doctest."""
- # TODO Can we resolve this from nose?
verbose = False
raise_error = True
for document in text_files + modules:
Index: FormEncode-1.3.1/setup.cfg
===================================================================
--- FormEncode-1.3.1.orig/setup.cfg 2016-08-09 04:22:10.000000000 +0200
+++ FormEncode-1.3.1/setup.cfg 2020-07-10 14:13:28.028897479 +0200
@@ -1,6 +1,3 @@
-[nosetests]
-detailed-errors = 1
-
[compile_catalog]
domain = FormEncode
directory = formencode/i18n
Index: FormEncode-1.3.1/setup.py
===================================================================
--- FormEncode-1.3.1.orig/setup.py 2020-07-10 13:21:48.129612276 +0200
+++ FormEncode-1.3.1/setup.py 2020-07-10 14:13:43.116991345 +0200
@@ -15,7 +15,7 @@ version = '1.3.1'
if not '2.6' <= sys.version < '3.0' and not '3.2' <= sys.version:
raise ImportError('Python version not supported')
-tests_require = ['nose', 'pycountry',
+tests_require = ['pycountry',
'dnspython' if sys.version < '3.0' else 'dnspython3']
doctests = ['docs/htmlfill.txt', 'docs/Validator.txt',

View File

@ -1,3 +1,44 @@
-------------------------------------------------------------------
Thu Dec 23 14:17:15 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Update to 2.0.1
* Add support for 3.10
* use Pytest instead of Nose and Github Actions instead of Travis
for tests
* Documentation updates
* Note this will be the last version to support Python 2.7. The
next version will be 2.1 to signal this change. If you want to
keep support for Python 2.7 update your dependencies spec to be
below 2.1
- Release 2.0.0
* FormEncode can now run on Python 3.6 and higher without needing
to run 2to3 first.
* FormEncode 2.0 is no longer compatible with Python 2.6 and 3.2
to 3.5. If you need Python 2.6 or 3.2 to 3.5 compatibility
please use FormEncode 1.3. You might also try FormEncode
2.0.0a1 which supports Python 2.6 and Python 3.3-3.5.
* This will be the last major version to support Python 2.7
* Add strict flag to USPostalCode to raise error on postal codes
that has too many digits instead of just truncating
* Various Python 3 fixes
* Serbian latin translation
* Changed License to MIT
* Dutch, UK, Greek and South Korean postal code format fixes
* Add postal code formats for Switzerland, Cyprus, Faroe Islands,
San Marino, Ukraine and Vatican City.
* Add ISODateTimeConverter validator
* Add ability to target htmlfill to particular form or ignore a
form
* Fix format errors in some translations
* The version of the library can be checked using
formencode.__version__
- Drop patches
* new-pycountry.patch
* python-FormEncode-remove-nose.patch
* remove-online-tests.patch
* six.patch
- Find lang files
-------------------------------------------------------------------
Fri Jul 10 12:51:17 UTC 2020 - pgajdos@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package python-FormEncode
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -18,29 +18,24 @@
%define oldpython python
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%bcond_without python2
Name: python-FormEncode
Version: 1.3.1
Version: 2.0.1
Release: 0
Summary: HTML form validation, generation, and conversion package
License: Python-2.0
Group: Development/Languages/Python
URL: http://formencode.org
Source: https://files.pythonhosted.org/packages/source/F/FormEncode/FormEncode-%{version}.tar.gz
Patch0: remove-online-tests.patch
Patch1: new-pycountry.patch
Patch2: six.patch
# https://github.com/formencode/formencode/pull/154
Patch3: python-FormEncode-remove-nose.patch
BuildRequires: %{python_module dnspython}
BuildRequires: %{python_module pycountry}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools_scm_git_archive}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-dnspython
Requires: python-pycountry
Requires: python-six
BuildArch: noarch
%ifpython2
@ -56,30 +51,35 @@ for filling and generating forms.
%prep
%setup -q -n FormEncode-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
dos2unix README.rst
%build
%python_build
%install
%python_install
rm %{buildroot}%{_prefix}/LICENSE.txt
# trick find-lang.sh into finding the translation files
%python_expand mv %{buildroot}%{$python_sitelib}/formencode/{i18n,locale}
%python_find_lang FormEncode
sed -i s/locale/i18n/ python*-FormEncode.lang
%python_expand mv %{buildroot}%{$python_sitelib}/formencode/{locale,i18n}
# remove misplaced documentation
%python_expand rm -r %{buildroot}%{$python_sitelib}/docs
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
export LANG=en_US.UTF-8
# excluded tests poll dns
%pytest -k 'not (test_cyrillic_email or test_unicode_ascii_subgroup)' formencode/tests
donttest="(test_doctests and _wrapper-formencode.validators-False-True)"
donttest+=" or test_unicode_ascii_subgroup"
# 15.3 cannot fulfill test suite requirements with old versions; don't test on python2
python2_flags="--version"
%pytest -k "not ($donttest)" ${$python_flags}
%files %{python_files}
%files %{python_files} -f %{python_prefix}-FormEncode.lang
%license LICENSE.txt
%doc README.rst
%{python_sitelib}/*
%{python_sitelib}/formencode
%{python_sitelib}/FormEncode-%{version}*-info
%changelog

View File

@ -1,90 +0,0 @@
From: Stefano Rivera <stefanor@debian.org>
Date: Sun, 11 Oct 2015 22:20:17 +0200
Subject: remove-dns-tests.diff
Tests that require network (DNS) access
Patch-Name: remove-dns-tests.diff
---
formencode/validators.py | 30 ------------------------------
1 file changed, 30 deletions(-)
diff --git a/formencode/validators.py b/formencode/validators.py
index c332ec9..cfba7c8 100644
--- a/formencode/validators.py
+++ b/formencode/validators.py
@@ -1288,20 +1288,6 @@ class Email(FancyValidator):
'nobody@xn--m7r7ml7t24h.com'
>>> e.to_python('o*reilly@test.com')
'o*reilly@test.com'
- >>> e = Email(resolve_domain=True)
- >>> e.resolve_domain
- True
- >>> e.to_python('doesnotexist@colorstudy.com')
- 'doesnotexist@colorstudy.com'
- >>> e.to_python('test@nyu.edu')
- 'test@nyu.edu'
- >>> # NOTE: If you do not have dnspython installed this example won't work:
- >>> e.to_python('test@thisdomaindoesnotexistithinkforsure.com')
- Traceback (most recent call last):
- ...
- Invalid: The domain of the email address does not exist (the portion after the @: thisdomaindoesnotexistithinkforsure.com)
- >>> e.to_python(u'test@google.com')
- u'test@google.com'
>>> e = Email(not_empty=False)
>>> e.to_python('')
@@ -1429,22 +1415,6 @@ class URL(FancyValidator):
Traceback (most recent call last):
...
Invalid: That is not a valid URL
- >>> u = URL(add_http=False, check_exists=True)
- >>> u.to_python('http://google.com')
- 'http://google.com'
- >>> u.to_python('google.com')
- Traceback (most recent call last):
- ...
- Invalid: You must start your URL with http://, https://, etc
- >>> u.to_python('http://www.formencode.org/does/not/exist/page.html')
- Traceback (most recent call last):
- ...
- Invalid: The server responded that the page could not be found
- >>> u.to_python('http://this.domain.does.not.exist.example.org/test.html')
- ... # doctest: +ELLIPSIS
- Traceback (most recent call last):
- ...
- Invalid: An error occured when trying to connect to the server: ...
If you want to allow addresses without a TLD (e.g., ``localhost``) you can do::
From: "drnlmuller+debian@gmail.com" <drnlmuller+debian@gmail.com>
Date: Tue, 14 Jun 2016 14:40:12 +0200
Subject: Remove tests from test_email that require dns.
Some of the new tests in test_email also require dns. This patch
removes them so the build does not require network access.
---
formencode/tests/test_email.py | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/formencode/tests/test_email.py b/formencode/tests/test_email.py
index 3ebf120..2305454 100644
--- a/formencode/tests/test_email.py
+++ b/formencode/tests/test_email.py
@@ -65,17 +65,3 @@ class TestEmail(unittest.TestCase):
for email, expected in valid_email_addresses:
self.assertEqual(self.validate(email), expected)
-
-
-class TestUnicodeEmailWithResolveDomain(unittest.TestCase):
-
- def setUp(self):
- self.validator = Email(resolve_domain=True)
-
- def test_unicode_ascii_subgroup(self):
- self.assertEqual(self.validator.to_python(
- u'foo@yandex.com'), 'foo@yandex.com')
-
- def test_cyrillic_email(self):
- self.assertEqual(self.validator.to_python(
- u'me@письмо.рф'), u'me@письмо.рф')

2181
six.patch

File diff suppressed because it is too large Load Diff