]>
Commit | Line | Data |
---|---|---|
a24e9a34 ER |
1 | # |
2 | # Conditional build: | |
37b9d23d JB |
3 | %bcond_without python2 # CPython 2.x module |
4 | %bcond_without python3 # CPython 3.x module | |
34073edd JB |
5 | %bcond_without tests # pytest tests |
6 | %bcond_without doc # Sphinx documentation | |
a24e9a34 | 7 | |
d7cb1ebf JB |
8 | Summary: The modular source code checker: pycodestyle, pyflakes and co |
9 | Summary(pl.UTF-8): Modularne narzędzie do sprawdzania kodu źródłowego: pycodestyle, pyflakes itp. | |
abcf879e | 10 | Name: flake8 |
2fc1c087 | 11 | Version: 3.7.9 |
9c766400 | 12 | Release: 3 |
abcf879e AM |
13 | License: MIT |
14 | Group: Development/Tools | |
34073edd | 15 | #Source0Download: https://pypi.org/simple/flake8/ |
d7cb1ebf | 16 | Source0: https://files.pythonhosted.org/packages/source/f/flake8/%{name}-%{version}.tar.gz |
2fc1c087 | 17 | # Source0-md5: 7dc0ce36b6cf49b13b46bb37ddca80c5 |
7b99a73b | 18 | Patch0: %{name}-req.patch |
2fc1c087 | 19 | Patch1: %{name}-duplicate.patch |
d7cb1ebf | 20 | URL: https://gitlab.com/pycqa/flake8 |
37b9d23d | 21 | BuildRequires: rpmbuild(macros) >= 1.714 |
abcf879e | 22 | BuildRequires: rpm-pythonprov |
37b9d23d | 23 | %if %{with python2} |
d7cb1ebf | 24 | BuildRequires: python-modules >= 1:2.7 |
2fc1c087 | 25 | BuildRequires: python-setuptools >= 1:30 |
37b9d23d | 26 | %if %{with tests} |
9bc90c26 | 27 | BuildRequires: python-configparser |
18203870 JB |
28 | BuildRequires: python-entrypoints >= 0.3 |
29 | BuildRequires: python-entrypoints < 0.4 | |
d7cb1ebf | 30 | BuildRequires: python-enum34 |
18203870 | 31 | BuildRequires: python-functools32 |
d7cb1ebf JB |
32 | BuildRequires: python-mccabe >= 0.6.0 |
33 | BuildRequires: python-mccabe < 0.7.0 | |
972dfbb9 | 34 | BuildRequires: python-mock >= 2.0.0 |
18203870 JB |
35 | BuildRequires: python-pycodestyle >= 2.5.0 |
36 | BuildRequires: python-pycodestyle < 2.6.0 | |
37 | BuildRequires: python-pyflakes >= 2.1.0 | |
38 | BuildRequires: python-pyflakes < 2.2.0 | |
d7cb1ebf | 39 | BuildRequires: python-pytest |
18203870 | 40 | BuildRequires: python-typing |
37b9d23d JB |
41 | %endif |
42 | %endif | |
43 | %if %{with python3} | |
d7cb1ebf | 44 | BuildRequires: python3-modules >= 1:3.4 |
2fc1c087 | 45 | BuildRequires: python3-setuptools >= 1:30 |
a24e9a34 | 46 | %if %{with tests} |
18203870 JB |
47 | BuildRequires: python3-entrypoints >= 0.3 |
48 | BuildRequires: python3-entrypoints < 0.4 | |
d7cb1ebf JB |
49 | BuildRequires: python3-mccabe >= 0.6.0 |
50 | BuildRequires: python3-mccabe < 0.7.0 | |
18203870 JB |
51 | BuildRequires: python3-pycodestyle >= 2.5.0 |
52 | BuildRequires: python3-pycodestyle < 2.6.0 | |
53 | BuildRequires: python3-pyflakes >= 2.1.0 | |
54 | BuildRequires: python3-pyflakes < 2.2.0 | |
d7cb1ebf | 55 | BuildRequires: python3-pytest |
d7cb1ebf | 56 | BuildRequires: sed >= 4.0 |
a24e9a34 | 57 | %endif |
37b9d23d | 58 | %endif |
34073edd JB |
59 | %if %{with doc} |
60 | BuildRequires: python3-sphinx-prompt | |
18203870 | 61 | BuildRequires: sphinx-pdg-3 >= 1.3 |
34073edd | 62 | %endif |
37b9d23d JB |
63 | %if %{with python3} |
64 | Requires: python3-flake8 = %{version}-%{release} | |
65 | %else | |
66 | Requires: python-flake8 = %{version}-%{release} | |
67 | %endif | |
abcf879e AM |
68 | BuildArch: noarch |
69 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
70 | ||
71 | %description | |
72 | The modular source code checker. It is a wrapper around these tools: | |
73 | - PyFlakes | |
d7cb1ebf | 74 | - pycodestyle |
abcf879e AM |
75 | - Ned Batchelder's McCabe script |
76 | ||
37b9d23d JB |
77 | %description -l pl.UTF-8 |
78 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
79 | dla narzędzi: | |
80 | - PyFlakes | |
d7cb1ebf | 81 | - pycodestyle |
37b9d23d JB |
82 | - skrypt McCabe autorstwa Neda Batcheldera |
83 | ||
84 | %package -n python-flake8 | |
d7cb1ebf JB |
85 | Summary: The modular source code checker: pycodestyle, pyflakes and co |
86 | Summary(pl.UTF-8): Modularne narzędzie do sprawdzania kodu źródłowego: pycodestyle, pyflakes itp. | |
37b9d23d | 87 | Group: Libraries/Python |
9c766400 JP |
88 | Requires: python-entrypoints >= 0.3 |
89 | Requires: python-entrypoints < 0.4 | |
90 | Requires: python-mccabe >= 0.6.0 | |
91 | Requires: python-mccabe < 0.7.0 | |
d7cb1ebf | 92 | Requires: python-modules >= 1:2.7 |
9c766400 JP |
93 | Requires: python-pycodestyle >= 2.5.0 |
94 | Requires: python-pycodestyle < 2.6.0 | |
95 | Requires: python-pyflakes >= 2.1.0 | |
96 | Requires: python-pyflakes < 2.2.0 | |
37b9d23d JB |
97 | |
98 | %description -n python-flake8 | |
99 | The modular source code checker. It is a wrapper around these tools: | |
100 | - PyFlakes | |
d7cb1ebf | 101 | - pycodestyle |
37b9d23d JB |
102 | - Ned Batchelder's McCabe script |
103 | ||
104 | %description -n python-flake8 -l pl.UTF-8 | |
105 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
106 | dla narzędzi: | |
107 | - PyFlakes | |
d7cb1ebf | 108 | - pycodestyle |
37b9d23d JB |
109 | - skrypt McCabe autorstwa Neda Batcheldera |
110 | ||
111 | %package -n python3-flake8 | |
d7cb1ebf JB |
112 | Summary: The modular source code checker: pycodestyle, pyflakes and co |
113 | Summary(pl.UTF-8): Modularne narzędzie do sprawdzania kodu źródłowego: pycodestyle, pyflakes itp. | |
37b9d23d | 114 | Group: Libraries/Python |
9c766400 JP |
115 | Requires: python3-entrypoints >= 0.3 |
116 | Requires: python3-entrypoints < 0.4 | |
117 | Requires: python3-mccabe >= 0.6.0 | |
118 | Requires: python3-mccabe < 0.7.0 | |
d7cb1ebf | 119 | Requires: python3-modules >= 1:3.4 |
9c766400 JP |
120 | Requires: python3-pycodestyle >= 2.5.0 |
121 | Requires: python3-pycodestyle < 2.6.0 | |
122 | Requires: python3-pyflakes >= 2.1.0 | |
123 | Requires: python3-pyflakes < 2.2.0 | |
37b9d23d JB |
124 | |
125 | %description -n python3-flake8 | |
126 | The modular source code checker. It is a wrapper around these tools: | |
127 | - PyFlakes | |
d7cb1ebf | 128 | - pycodestyle |
37b9d23d JB |
129 | - Ned Batchelder's McCabe script |
130 | ||
131 | %description -n python3-flake8 -l pl.UTF-8 | |
132 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
133 | dla narzędzi: | |
134 | - PyFlakes | |
d7cb1ebf | 135 | - pycodestyle |
37b9d23d JB |
136 | - skrypt McCabe autorstwa Neda Batcheldera |
137 | ||
34073edd JB |
138 | %package -n python-flake8-apidocs |
139 | Summary: API documentation for Python flake8 module | |
140 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona flake8 | |
141 | Group: Documentation | |
142 | ||
143 | %description -n python-flake8-apidocs | |
144 | API documentation for Python flake8 module. | |
145 | ||
146 | %description -n python-flake8-apidocs -l pl.UTF-8 | |
147 | Dokumentacja API modułu Pythona flake8. | |
148 | ||
abcf879e AM |
149 | %prep |
150 | %setup -q | |
7b99a73b | 151 | %patch0 -p1 |
2fc1c087 | 152 | %patch1 -p1 |
abcf879e AM |
153 | |
154 | %build | |
37b9d23d | 155 | %if %{with python2} |
18203870 JB |
156 | %py_build |
157 | ||
158 | %if %{with tests} | |
159 | PYTHONPATH=$(pwd)/src \ | |
160 | %{__python} -m pytest -rw tests | |
161 | %endif | |
37b9d23d JB |
162 | %endif |
163 | ||
164 | %if %{with python3} | |
d7cb1ebf JB |
165 | # don't require standalone mock |
166 | %{__sed} -i -e 's/import mock/from unittest import mock/' $(grep 'import mock' tests/ -rl) | |
167 | ||
18203870 JB |
168 | %py3_build |
169 | ||
170 | %if %{with tests} | |
171 | PYTHONPATH=$(pwd)/src \ | |
172 | %{__python3} -m pytest -rw tests | |
173 | %endif | |
37b9d23d | 174 | %endif |
abcf879e | 175 | |
34073edd JB |
176 | %if %{with doc} |
177 | cd docs/source | |
178 | PYTHONPATH=$(pwd)/../../src \ | |
179 | sphinx-build-3 -b html . _build/html | |
180 | %endif | |
181 | ||
abcf879e AM |
182 | %install |
183 | rm -rf $RPM_BUILD_ROOT | |
37b9d23d JB |
184 | |
185 | %if %{with python2} | |
186 | %py_install | |
d7cb1ebf | 187 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-2} |
37b9d23d JB |
188 | %py_postclean |
189 | %endif | |
190 | ||
191 | %if %{with python3} | |
33643bb9 | 192 | %py3_install |
d7cb1ebf | 193 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-3} |
37b9d23d | 194 | %endif |
abcf879e | 195 | |
8b0b6706 ER |
196 | ln -s flake-%{!?with_python3:2}%{?with_python3:3} $RPM_BUILD_ROOT%{_bindir}/flake8 |
197 | ||
abcf879e AM |
198 | %clean |
199 | rm -rf $RPM_BUILD_ROOT | |
200 | ||
201 | %files | |
202 | %defattr(644,root,root,755) | |
abcf879e | 203 | %attr(755,root,root) %{_bindir}/flake8 |
37b9d23d JB |
204 | |
205 | %if %{with python2} | |
206 | %files -n python-flake8 | |
207 | %defattr(644,root,root,755) | |
34073edd | 208 | %doc CONTRIBUTORS.txt LICENSE README.rst |
37b9d23d JB |
209 | %attr(755,root,root) %{_bindir}/flake8-2 |
210 | %{py_sitescriptdir}/flake8 | |
211 | %{py_sitescriptdir}/flake8-%{version}-py*.egg-info | |
212 | %endif | |
213 | ||
214 | %if %{with python3} | |
215 | %files -n python3-flake8 | |
216 | %defattr(644,root,root,755) | |
34073edd | 217 | %doc CONTRIBUTORS.txt LICENSE README.rst |
37b9d23d JB |
218 | %attr(755,root,root) %{_bindir}/flake8-3 |
219 | %{py3_sitescriptdir}/flake8 | |
220 | %{py3_sitescriptdir}/flake8-%{version}-py*.egg-info | |
221 | %endif | |
34073edd JB |
222 | |
223 | %if %{with doc} | |
224 | %files -n python-flake8-apidocs | |
225 | %defattr(644,root,root,755) | |
226 | %doc docs/source/_build/html/{_modules,_static,internal,plugin-development,release-notes,user,*.html,*.js} | |
227 | %endif |