]>
Commit | Line | Data |
---|---|---|
d7c20982 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # Sphinx documentation | |
4 | %bcond_without tests # unit tests | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_without python3 # CPython 3.x module | |
7450344b | 7 | |
d7c20982 | 8 | %define module FormEncode |
7450344b | 9 | Summary: HTML form validation, generation, and convertion package |
b27f05d4 | 10 | Summary(pl.UTF-8): Moduł do walidacji, tworzenia i konwersji formularzy HTML |
7450344b | 11 | Name: python-%{module} |
d7c20982 | 12 | Version: 1.3.1 |
dc50037f | 13 | Release: 3 |
7450344b | 14 | License: PSF |
15 | Group: Development/Languages/Python | |
d7c20982 JB |
16 | #Source0Download: https://pypi.org/project/FormEncode/ |
17 | Source0: https://files.pythonhosted.org/packages/source/F/FormEncode/%{module}-%{version}.tar.gz | |
18 | # Source0-md5: 16fbefb206064eb93a6719f054a19b3b | |
19 | Patch0: %{name}-pycountry.patch | |
7450344b | 20 | URL: http://formencode.org/ |
d7c20982 JB |
21 | %if %{with python2} |
22 | BuildRequires: python-modules >= 1:2.6 | |
06f1cd37 | 23 | BuildRequires: python-setuptools |
d7c20982 JB |
24 | %if %{with tests} |
25 | BuildRequires: python-dns | |
26 | BuildRequires: python-nose | |
27 | BuildRequires: python-pycountry >= 16.10.23 | |
28 | %endif | |
29 | %endif | |
30 | %if %{with python3} | |
31 | BuildRequires: python3-2to3 >= 1:3.2 | |
32 | BuildRequires: python3-modules >= 1:3.2 | |
33 | BuildRequires: python3-setuptools | |
34 | %if %{with tests} | |
35 | BuildRequires: python3-dns | |
36 | BuildRequires: python3-nose | |
37 | BuildRequires: python3-pycountry >= 16.10.23 | |
38 | %endif | |
39 | %endif | |
ecaf0988 | 40 | BuildRequires: rpm-pythonprov |
d7c20982 | 41 | BuildRequires: rpmbuild(macros) >= 1.714 |
edc83feb | 42 | BuildRequires: sed >= 4.0 |
d7c20982 | 43 | Requires: python-modules >= 1:2.6 |
7450344b | 44 | BuildArch: noarch |
45 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
46 | ||
47 | %description | |
48 | FormEncode validates and converts nested structures. It allows for a | |
49 | declarative form of defining the validation, and decoupled processes | |
50 | for filling and generating forms. | |
51 | ||
b70689e2 JR |
52 | %description -l pl.UTF-8 |
53 | FormEncode służy do sprawdzania poprawności i konwersji zagnieżdżonych | |
d7c20982 JB |
54 | struktur. Pozwala na deklaratywny sposób definiowania reguł |
55 | poprawności i niezależne od nich wypełnianie i generowanie formularzy. | |
56 | ||
57 | %package -n python3-%{module} | |
58 | Summary: HTML form validation, generation, and convertion package | |
59 | Summary(pl.UTF-8): Moduł do walidacji, tworzenia i konwersji formularzy HTML | |
60 | Group: Libraries/Python | |
61 | Requires: python3-modules >= 1:3.2 | |
62 | ||
63 | %description -n python3-%{module} | |
64 | FormEncode validates and converts nested structures. It allows for a | |
65 | declarative form of defining the validation, and decoupled processes | |
66 | for filling and generating forms. | |
67 | ||
68 | %description -n python3-%{module} -l pl.UTF-8 | |
69 | FormEncode służy do sprawdzania poprawności i konwersji zagnieżdżonych | |
70 | struktur. Pozwala na deklaratywny sposób definiowania reguł | |
71 | poprawności i niezależne od nich wypełnianie i generowanie formularzy. | |
72 | ||
73 | %package apidocs | |
74 | Summary: API documentation for Python FormEncode module | |
75 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona FormEncode | |
76 | Group: Documentation | |
77 | ||
78 | %description apidocs | |
79 | API documentation for Python FormEncode module. | |
80 | ||
81 | %description apidocs -l pl.UTF-8 | |
82 | Dokumentacja API modułu Pythona FormEncode. | |
7450344b | 83 | |
84 | %prep | |
c8357c7d | 85 | %setup -q -n %{module}-%{version} |
d7c20982 JB |
86 | %patch0 -p1 |
87 | ||
88 | # uses network to validate domains (with one no longer valid anyway) | |
89 | %{__rm} formencode/tests/test_email.py | |
edc83feb JB |
90 | # validator doctests cover Email and URL validators which include DNS lookups |
91 | %{__sed} -i -e '/^modules / s/, validators//' formencode/tests/test_doctests.py | |
7450344b | 92 | |
93 | %build | |
d7c20982 | 94 | %if %{with python2} |
34134326 | 95 | %py_build |
7450344b | 96 | |
d7c20982 JB |
97 | %if %{with tests} |
98 | %{__python} -m nose build-2/lib/formencode/tests | |
99 | %endif | |
100 | %endif | |
101 | ||
102 | %if %{with python3} | |
103 | %py3_build | |
104 | ||
105 | %if %{with tests} | |
106 | %{__python3} -m nose build-3/lib/formencode/tests | |
107 | %endif | |
108 | %endif | |
109 | ||
7450344b | 110 | %install |
111 | rm -rf $RPM_BUILD_ROOT | |
7450344b | 112 | |
d7c20982 JB |
113 | %if %{with python2} |
114 | %py_install | |
115 | ||
116 | %{__mv} $RPM_BUILD_ROOT%{py_sitescriptdir}/docs built-docs | |
06f1cd37 | 117 | |
d7c20982 JB |
118 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/tests |
119 | %{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/i18n/FormEncode.pot | |
120 | %{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/i18n/*/LC_MESSAGES/FormEncode.po | |
06f1cd37 AM |
121 | %py_postclean |
122 | ||
d7c20982 JB |
123 | find $RPM_BUILD_ROOT%{py_sitescriptdir}/formencode/i18n -type d -maxdepth 1 | \ |
124 | %{__sed} -ne "s,$RPM_BUILD_ROOT\(.*i18n/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py2.lang | |
125 | %endif | |
126 | ||
127 | %if %{with python3} | |
128 | %py3_install | |
129 | ||
130 | %{__rm} -rf built-docs | |
131 | %{__mv} $RPM_BUILD_ROOT%{py3_sitescriptdir}/docs built-docs | |
132 | ||
133 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/tests | |
134 | %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n/FormEncode.pot | |
135 | %{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n/*/LC_MESSAGES/FormEncode.po | |
136 | ||
137 | find $RPM_BUILD_ROOT%{py3_sitescriptdir}/formencode/i18n -type d -maxdepth 1 | \ | |
138 | %{__sed} -ne "s,$RPM_BUILD_ROOT\(.*i18n/\([a-z]\+\(_[A-Z][A-Z]\)\?\).*\),%%lang(\2) \1,p" > py3.lang | |
139 | %endif | |
140 | ||
7450344b | 141 | %clean |
142 | rm -rf $RPM_BUILD_ROOT | |
143 | ||
d7c20982 JB |
144 | %if %{with python2} |
145 | %files -f py2.lang | |
146 | %defattr(644,root,root,755) | |
147 | %doc README.rst | |
148 | %dir %{py_sitescriptdir}/formencode | |
149 | %{py_sitescriptdir}/formencode/*.py[co] | |
150 | %dir %{py_sitescriptdir}/formencode/i18n | |
151 | %{py_sitescriptdir}/formencode/javascript | |
152 | %{py_sitescriptdir}/FormEncode-%{version}-py*.egg-info | |
153 | %endif | |
154 | ||
155 | %if %{with python3} | |
156 | %files -n python3-%{module} -f py3.lang | |
157 | %defattr(644,root,root,755) | |
158 | %doc README.rst | |
159 | %dir %{py3_sitescriptdir}/formencode | |
160 | %{py3_sitescriptdir}/formencode/*.py | |
161 | %{py3_sitescriptdir}/formencode/__pycache__ | |
162 | %dir %{py3_sitescriptdir}/formencode/i18n | |
163 | %{py3_sitescriptdir}/formencode/javascript | |
164 | %{py3_sitescriptdir}/FormEncode-%{version}-py*.egg-info | |
165 | %endif | |
166 | ||
167 | %files apidocs | |
7450344b | 168 | %defattr(644,root,root,755) |
d7c20982 | 169 | %doc built-docs/* |