]>
Commit | Line | Data |
---|---|---|
f02af86f 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 | |
7 | ||
8 | Summary: Container class boilerplate killer | |
9 | Summary(pl.UTF-8): Zabójca ramowego kodu klas kontenerów | |
10 | Name: python-fields | |
11 | Version: 5.0.0 | |
14315fb4 | 12 | Release: 7 |
f02af86f JB |
13 | License: BSD |
14 | Group: Libraries/Python | |
15 | #Source0Download: https://pypi.org/simple/fields/ | |
16 | Source0: https://files.pythonhosted.org/packages/source/f/fields/fields-%{version}.tar.gz | |
17 | # Source0-md5: 4b3a60ddaad146f698979cf4da2639d4 | |
18 | Patch0: %{name}-docs.patch | |
19 | Patch1: %{name}-tests.patch | |
20 | URL: https://github.com/ionelmc/python-fields | |
21 | BuildRequires: rpm-pythonprov | |
22 | BuildRequires: rpmbuild(macros) >= 1.714 | |
23 | %if %{with python2} | |
24 | BuildRequires: python-modules >= 1:2.6 | |
25 | BuildRequires: python-setuptools | |
26 | %if %{with tests} | |
150e957b | 27 | BuildRequires: python-characteristic |
f02af86f JB |
28 | BuildRequires: python-pytest |
29 | BuildRequires: python-pytest-benchmark | |
30 | %endif | |
31 | %endif | |
32 | %if %{with python3} | |
33 | BuildRequires: python3-modules >= 1:3.3 | |
34 | BuildRequires: python3-setuptools | |
35 | %if %{with tests} | |
150e957b | 36 | BuildRequires: python3-characteristic |
f02af86f JB |
37 | BuildRequires: python3-pytest |
38 | BuildRequires: python3-pytest-benchmark | |
39 | %endif | |
40 | %endif | |
41 | %if %{with doc} | |
42 | BuildRequires: python3-sphinx_py3doc_enhanced_theme | |
43 | # with sphinx.ext.napoleon | |
44 | BuildRequires: sphinx-pdg-3 >= 1.3 | |
45 | %endif | |
46 | Requires: python-modules >= 1:2.6 | |
47 | BuildArch: noarch | |
48 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
49 | ||
50 | %description | |
51 | Container class boilerplate killer. Features: | |
52 | - Human-readable __repr__ | |
53 | - Complete set of comparison methods | |
54 | - Keyword and positional argument support. Works like a normal class - | |
55 | you can override just about anything in the subclass (eg: a custom | |
56 | __init__). | |
57 | ||
58 | %description -l pl.UTF-8 | |
59 | Zabójca ramowego kodu klas kontenerów. Możliwości: | |
60 | - __repr__ czytelne dla człowieka | |
61 | - pełny zbiór metod porównujących | |
62 | - obsługa argumentów pozycyjnych i słownikowych; działa jak zwykła | |
63 | klasa - można przeciążać prawie wszystko w podklasie (np. własny | |
64 | __init__). | |
65 | ||
66 | %package -n python3-fields | |
67 | Summary: Container class boilerplate killer | |
68 | Summary(pl.UTF-8): Zabójca ramowego kodu klas kontenerów | |
69 | Group: Libraries/Python | |
70 | Requires: python3-modules >= 1:3.3 | |
71 | ||
72 | %description -n python3-fields | |
73 | Container class boilerplate killer. Features: | |
74 | - Human-readable __repr__ | |
75 | - Complete set of comparison methods | |
76 | - Keyword and positional argument support. Works like a normal class - | |
77 | you can override just about anything in the subclass (eg: a custom | |
78 | __init__). | |
79 | ||
80 | %description -n python3-fields -l pl.UTF-8 | |
81 | Zabójca ramowego kodu klas kontenerów. Możliwości: | |
82 | - __repr__ czytelne dla człowieka | |
83 | - pełny zbiór metod porównujących | |
84 | - obsługa argumentów pozycyjnych i słownikowych; działa jak zwykła | |
85 | klasa - można przeciążać prawie wszystko w podklasie (np. własny | |
86 | __init__). | |
87 | ||
88 | %package apidocs | |
89 | Summary: API documentation for Python fields module | |
90 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona fields | |
91 | Group: Documentation | |
92 | ||
93 | %description apidocs | |
94 | API documentation for Python fields module. | |
95 | ||
96 | %description apidocs -l pl.UTF-8 | |
97 | Dokumentacja API modułu Pythona fields. | |
98 | ||
99 | %prep | |
100 | %setup -q -n fields-%{version} | |
101 | %patch0 -p1 | |
102 | %patch1 -p1 | |
103 | ||
104 | %build | |
105 | %if %{with python2} | |
106 | %py_build | |
107 | ||
108 | %if %{with tests} | |
67278804 JB |
109 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
110 | PYTEST_PLUGINS="pytest_benchmark.plugin" \ | |
f02af86f JB |
111 | PYTHONPATH=$(pwd)/src \ |
112 | %{__python} -m pytest tests | |
113 | %endif | |
114 | %endif | |
115 | ||
116 | %if %{with python3} | |
117 | %py3_build | |
118 | ||
119 | %if %{with tests} | |
67278804 JB |
120 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
121 | PYTEST_PLUGINS="pytest_benchmark.plugin" \ | |
f02af86f JB |
122 | PYTHONPATH=$(pwd)/src \ |
123 | %{__python3} -m pytest tests | |
124 | %endif | |
125 | %endif | |
126 | ||
127 | %if %{with doc} | |
128 | cd docs | |
129 | PYTHONPATH=$(pwd)/../src \ | |
130 | sphinx-build-3 -b html . _build/html | |
131 | %endif | |
132 | ||
133 | %install | |
134 | rm -rf $RPM_BUILD_ROOT | |
135 | ||
136 | %if %{with python2} | |
137 | %py_install | |
138 | ||
139 | %py_postclean | |
140 | %endif | |
141 | ||
142 | %if %{with python3} | |
143 | %py3_install | |
144 | %endif | |
145 | ||
146 | %clean | |
147 | rm -rf $RPM_BUILD_ROOT | |
148 | ||
149 | %if %{with python2} | |
150 | %files | |
151 | %defattr(644,root,root,755) | |
152 | %doc AUTHORS.rst CHANGELOG.rst LICENSE README.rst | |
153 | %{py_sitescriptdir}/fields | |
154 | %{py_sitescriptdir}/fields-%{version}-py*.egg-info | |
155 | %endif | |
156 | ||
157 | %if %{with python3} | |
158 | %files -n python3-fields | |
159 | %defattr(644,root,root,755) | |
160 | %doc AUTHORS.rst CHANGELOG.rst LICENSE README.rst | |
161 | %{py3_sitescriptdir}/fields | |
162 | %{py3_sitescriptdir}/fields-%{version}-py*.egg-info | |
163 | %endif | |
164 | ||
165 | %if %{with doc} | |
166 | %files apidocs | |
167 | %defattr(644,root,root,755) | |
168 | %doc docs/_build/html/{_modules,_static,reference,*.html,*.js} | |
169 | %endif |