[packages/python-FormEncode] - updated to 1.3.1 - added pycountry patch (adapt for pycountry 16.10.23 API change) - added python3

qboosh qboosh at pld-linux.org
Tue Jun 9 19:20:47 CEST 2020


commit d7c209827d0a91021240366041a35c8d2adbb07d
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Jun 9 19:21:37 2020 +0200

    - updated to 1.3.1
    - added pycountry patch (adapt for pycountry 16.10.23 API change)
    - added python3- and -apidocs packages

 python-FormEncode-pycountry.patch |  27 +++++++
 python-FormEncode.spec            | 150 +++++++++++++++++++++++++++++++++-----
 2 files changed, 157 insertions(+), 20 deletions(-)
---
diff --git a/python-FormEncode.spec b/python-FormEncode.spec
index 34f60b0..2610e98 100644
--- a/python-FormEncode.spec
+++ b/python-FormEncode.spec
@@ -1,20 +1,45 @@
-%define module FormEncode
+#
+# Conditional build:
+%bcond_without	doc	# Sphinx documentation
+%bcond_without	tests	# unit tests
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
 
+%define	module	FormEncode
 Summary:	HTML form validation, generation, and convertion package
 Summary(pl.UTF-8):	Moduł do walidacji, tworzenia i konwersji formularzy HTML
 Name:		python-%{module}
-Version:	1.2.4
-Release:	2
+Version:	1.3.1
+Release:	1
 License:	PSF
 Group:		Development/Languages/Python
-Source0:	http://cheeseshop.python.org/packages/source/F/FormEncode/%{module}-%{version}.tar.gz
-# Source0-md5:	6bc17fb9aed8aea198975e888e2077f4
+#Source0Download: https://pypi.org/project/FormEncode/
+Source0:	https://files.pythonhosted.org/packages/source/F/FormEncode/%{module}-%{version}.tar.gz
+# Source0-md5:	16fbefb206064eb93a6719f054a19b3b
+Patch0:		%{name}-pycountry.patch
 URL:		http://formencode.org/
-BuildRequires:	python >= 1:2.4
+%if %{with python2}
+BuildRequires:	python-modules >= 1:2.6
 BuildRequires:	python-setuptools
+%if %{with tests}
+BuildRequires:	python-dns
+BuildRequires:	python-nose
+BuildRequires:	python-pycountry >= 16.10.23
+%endif
+%endif
+%if %{with python3}
+BuildRequires:	python3-2to3 >= 1:3.2
+BuildRequires:	python3-modules >= 1:3.2
+BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-dns
+BuildRequires:	python3-nose
+BuildRequires:	python3-pycountry >= 16.10.23
+%endif
+%endif
 BuildRequires:	rpm-pythonprov
-BuildRequires:	rpmbuild(macros) >= 1.710
-%pyrequires_eq	python-modules
+BuildRequires:	rpmbuild(macros) >= 1.714
+Requires:	python-modules >= 1:2.6
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -25,32 +50,117 @@ for filling and generating forms.
 
 %description -l pl.UTF-8
 FormEncode służy do sprawdzania poprawności i konwersji zagnieżdżonych
-struktur. Pozwala na deklaratywny sposób definiowania reguł poprawności
-i niezależne od nich wypełnianie i generowanie formularzy.
+struktur. Pozwala na deklaratywny sposób definiowania reguł
+poprawności i niezależne od nich wypełnianie i generowanie formularzy.
+
+%package -n python3-%{module}
+Summary:	HTML form validation, generation, and convertion package
+Summary(pl.UTF-8):	Moduł do walidacji, tworzenia i konwersji formularzy HTML
+Group:		Libraries/Python
+Requires:	python3-modules >= 1:3.2
+
+%description -n python3-%{module}
+FormEncode validates and converts nested structures. It allows for a
+declarative form of defining the validation, and decoupled processes
+for filling and generating forms.
+
+%description -n python3-%{module} -l pl.UTF-8
+FormEncode służy do sprawdzania poprawności i konwersji zagnieżdżonych
+struktur. Pozwala na deklaratywny sposób definiowania reguł
+poprawności i niezależne od nich wypełnianie i generowanie formularzy.
+
+%package apidocs
+Summary:	API documentation for Python FormEncode module
+Summary(pl.UTF-8):	Dokumentacja API modułu Pythona FormEncode
+Group:		Documentation
+
+%description apidocs
+API documentation for Python FormEncode module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułu Pythona FormEncode.
 
 %prep
 %setup -q -n %{module}-%{version}
+%patch0 -p1
+
+# uses network to validate domains (with one no longer valid anyway)
+%{__rm} formencode/tests/test_email.py
 
 %build
+%if %{with python2}
 %py_build
 
+%if %{with tests}
+%{__python} -m nose build-2/lib/formencode/tests
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+%{__python3} -m nose build-3/lib/formencode/tests
+%endif
+%endif
+
 %install
 rm -rf $RPM_BUILD_ROOT
 
-%py_install \
-        --single-version-externally-managed \
-        --optimize=2 \
-        --root=$RPM_BUILD_ROOT
+%if %{with python2}
+%py_install
+
+%{__mv} $RPM_BUILD_ROOT%{py_sitescriptdir}/docs built-docs
 
-%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
-%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
+%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/tests
+%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/i18n/FormEncode.pot
+%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/i18n/*/LC_MESSAGES/FormEncode.po
 %py_postclean
 
+find $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/i18n -type d -maxdepth 1 | \
+	%{__sed} -ne "s,$RPM_BUILD_ROOT\(.*i18n/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py2.lang
+%endif
+
+%if %{with python3}
+%py3_install
+
+%{__rm} -rf built-docs
+%{__mv} $RPM_BUILD_ROOT%{py3_sitescriptdir}/docs built-docs
+
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/tests
+%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n/FormEncode.pot
+%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n/*/LC_MESSAGES/FormEncode.po
+
+find $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n -type d -maxdepth 1 | \
+	%{__sed} -ne "s,$RPM_BUILD_ROOT\(.*i18n/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py3.lang
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%files
+%if %{with python2}
+%files -f py2.lang
+%defattr(644,root,root,755)
+%doc README.rst
+%dir %{py_sitescriptdir}/formencode
+%{py_sitescriptdir}/formencode/*.py[co]
+%dir %{py_sitescriptdir}/formencode/i18n
+%{py_sitescriptdir}/formencode/javascript
+%{py_sitescriptdir}/FormEncode-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-%{module} -f py3.lang
+%defattr(644,root,root,755)
+%doc README.rst
+%dir %{py3_sitescriptdir}/formencode
+%{py3_sitescriptdir}/formencode/*.py
+%{py3_sitescriptdir}/formencode/__pycache__
+%dir %{py3_sitescriptdir}/formencode/i18n
+%{py3_sitescriptdir}/formencode/javascript
+%{py3_sitescriptdir}/FormEncode-%{version}-py*.egg-info
+%endif
+
+%files apidocs
 %defattr(644,root,root,755)
-%doc docs/*.txt
-%{py_sitescriptdir}/%{module}*
-%{py_sitescriptdir}/*formencode*
+%doc built-docs/*
diff --git a/python-FormEncode-pycountry.patch b/python-FormEncode-pycountry.patch
new file mode 100644
index 0000000..ed8a9ea
--- /dev/null
+++ b/python-FormEncode-pycountry.patch
@@ -0,0 +1,27 @@
+--- FormEncode-1.3.1/formencode/national.py.orig	2016-08-08 13:33:45.000000000 +0200
++++ FormEncode-1.3.1/formencode/national.py	2020-06-09 06:40:30.941129354 +0200
+@@ -85,19 +85,19 @@
+     _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)
+ 
+ 
+ ############################################################
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-FormEncode.git/commitdiff/d7c209827d0a91021240366041a35c8d2adbb07d



More information about the pld-cvs-commit mailing list