From be9be315ff0b64f1b0664793370b831b6fbe6981d4ee866f48353d59cf471075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 4 Mar 2019 16:26:44 +0000 Subject: [PATCH] - Remove online tests: * remove-online-tests.patch - Work with new pycountry: * new-pycountry.patch - Run tests - Fix fdupes call - Update to 1.3.1: * no obvious changelog OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-FormEncode?expand=0&rev=20 --- FormEncode-1.3.0.zip | 3 - FormEncode-1.3.1.tar.gz | 3 + FormEncode-doc-infrastructure.tar.gz | 3 - new-pycountry.patch | 38 ++++++++++++ python-FormEncode.changes | 16 +++++ python-FormEncode.spec | 53 +++++++--------- remove-online-tests.patch | 90 ++++++++++++++++++++++++++++ 7 files changed, 169 insertions(+), 37 deletions(-) delete mode 100644 FormEncode-1.3.0.zip create mode 100644 FormEncode-1.3.1.tar.gz delete mode 100644 FormEncode-doc-infrastructure.tar.gz create mode 100644 new-pycountry.patch create mode 100644 remove-online-tests.patch diff --git a/FormEncode-1.3.0.zip b/FormEncode-1.3.0.zip deleted file mode 100644 index 513ef2f..0000000 --- a/FormEncode-1.3.0.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e6757280244a0d04e9cef51beeeafb4124087c27b7944c7d41341d0a30f7af78 -size 347674 diff --git a/FormEncode-1.3.1.tar.gz b/FormEncode-1.3.1.tar.gz new file mode 100644 index 0000000..cad332e --- /dev/null +++ b/FormEncode-1.3.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ada2f51792b1b484e5bb7b6cc14acfc1bc11fafc967cf015cd57e856053ca7f6 +size 197305 diff --git a/FormEncode-doc-infrastructure.tar.gz b/FormEncode-doc-infrastructure.tar.gz deleted file mode 100644 index bfb7df0..0000000 --- a/FormEncode-doc-infrastructure.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9ce55ab4cbf3c284e1a3d8f0e2340b5c9201c106e1b34f15eae669143885452a -size 16730 diff --git a/new-pycountry.patch b/new-pycountry.patch new file mode 100644 index 0000000..689b4db --- /dev/null +++ b/new-pycountry.patch @@ -0,0 +1,38 @@ +From: Chris Lamb +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) + + + ############################################################ diff --git a/python-FormEncode.changes b/python-FormEncode.changes index 086ff9a..edc0ea8 100644 --- a/python-FormEncode.changes +++ b/python-FormEncode.changes @@ -1,3 +1,19 @@ +------------------------------------------------------------------- +Mon Mar 4 16:23:43 UTC 2019 - Tomáš Chvátal + +- Remove online tests: + * remove-online-tests.patch +- Work with new pycountry: + * new-pycountry.patch +- Run tests + +------------------------------------------------------------------- +Mon Dec 10 14:55:26 UTC 2018 - Tomáš Chvátal + +- Fix fdupes call +- Update to 1.3.1: + * no obvious changelog + ------------------------------------------------------------------- Tue Dec 4 12:48:11 UTC 2018 - Matej Cepl diff --git a/python-FormEncode.spec b/python-FormEncode.spec index cd435da..3fb1d69 100644 --- a/python-FormEncode.spec +++ b/python-FormEncode.spec @@ -1,7 +1,7 @@ # # spec file for package python-FormEncode # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,21 +19,22 @@ %define oldpython python %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-FormEncode -Version: 1.3.0 +Version: 1.3.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}.zip -Source1: FormEncode-doc-infrastructure.tar.gz -# Documentation requirements: +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 +BuildRequires: %{python_module nose} +BuildRequires: %{python_module pycountry} BuildRequires: %{python_module setuptools} +BuildRequires: dos2unix BuildRequires: fdupes BuildRequires: python-rpm-macros -BuildRequires: python3-Sphinx -BuildRequires: unzip -BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: python2-dnspython BuildArch: noarch %ifpython2 Provides: %{oldpython}-formencode = %{version} @@ -46,40 +47,30 @@ FormEncode validates and converts nested structures. It allows for a declarative form of defining the validation, and decoupled processes for filling and generating forms. -%package -n %{name}-doc -Summary: HTML form validation, generation, and conversion package -Group: Development/Libraries/Python -Provides: %{python_module FormEncode-doc = %{version}} - -%description -n %{name}-doc -This package contains documentation files for %{name}. - %prep -%setup -q -n FormEncode-%{version} -a1 -find . -name \*.txt -exec sed -i 's/\r$//g' {} \; -sed -i 's/\r$//g' PKG-INFO README.rst -sed -i '/^:date:/d' docs/*.txt # fix build-compare +%setup -q -n FormEncode-%{version} +%patch0 -p1 +%patch1 -p1 +dos2unix README.rst %build %python_build -%{_python_use_flavor python3} -python3 setup.py build_sphinx && rm build/sphinx/html/.buildinfo && mv build/sphinx/html html %install %python_install -# install documentation -rm -r %{buildroot}%{python_sitelib}/docs # remove misplaced documentation +# remove misplaced documentation +%python_expand rm -r %{buildroot}%{$python_sitelib}/docs -%fdupes %{buildroot}%{_prefix} +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export LANG=en_US.UTF-8 +# excluded tests poll dns +%python_expand PYTHONPATH=%{buildroot}%{python_sitelib} nosetests-%{python_bin_suffix} -v -e '(test_cyrillic_email|test_unicode_ascii_subgroup)' formencode/tests %files %{python_files} -%defattr(-,root,root,-) %doc README.rst %{python_sitelib}/* -%files -n %{name}-doc -%defattr(-,root,root,-) -%doc html - %changelog diff --git a/remove-online-tests.patch b/remove-online-tests.patch new file mode 100644 index 0000000..07191c8 --- /dev/null +++ b/remove-online-tests.patch @@ -0,0 +1,90 @@ +From: Stefano Rivera +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" +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@письмо.рф')