]>
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 | |
bde5aaa8 | 5 | %bcond_with tests # pytest tests |
34073edd | 6 | %bcond_without doc # Sphinx documentation |
a24e9a34 | 7 | |
e6703bef | 8 | Summary: The modular source code checker: pycodestyle, pyflakes and co. |
d7cb1ebf | 9 | Summary(pl.UTF-8): Modularne narzędzie do sprawdzania kodu źródłowego: pycodestyle, pyflakes itp. |
abcf879e | 10 | Name: flake8 |
e6703bef JB |
11 | # before updating to 4.x fork python-flake8.spec with last 3.x version |
12 | Version: 3.9.2 | |
1ae44535 | 13 | Release: 3 |
abcf879e AM |
14 | License: MIT |
15 | Group: Development/Tools | |
34073edd | 16 | #Source0Download: https://pypi.org/simple/flake8/ |
d7cb1ebf | 17 | Source0: https://files.pythonhosted.org/packages/source/f/flake8/%{name}-%{version}.tar.gz |
e6703bef JB |
18 | # Source0-md5: 5c102972d3d0f35255c56a20613fcec5 |
19 | Patch0: %{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 |
d7cb1ebf | 28 | BuildRequires: python-enum34 |
18203870 | 29 | BuildRequires: python-functools32 |
e6703bef | 30 | BuildRequires: python-importlib_metadata |
d7cb1ebf JB |
31 | BuildRequires: python-mccabe >= 0.6.0 |
32 | BuildRequires: python-mccabe < 0.7.0 | |
972dfbb9 | 33 | BuildRequires: python-mock >= 2.0.0 |
e6703bef JB |
34 | BuildRequires: python-pycodestyle >= 2.7.0 |
35 | BuildRequires: python-pycodestyle < 2.8.0 | |
36 | BuildRequires: python-pyflakes >= 2.3.0 | |
37 | BuildRequires: python-pyflakes < 2.4.0 | |
d7cb1ebf | 38 | BuildRequires: python-pytest |
18203870 | 39 | BuildRequires: python-typing |
37b9d23d JB |
40 | %endif |
41 | %endif | |
42 | %if %{with python3} | |
e6703bef | 43 | BuildRequires: python3-modules >= 1:3.5 |
2fc1c087 | 44 | BuildRequires: python3-setuptools >= 1:30 |
a24e9a34 | 45 | %if %{with tests} |
e6703bef JB |
46 | %if "%{py3_ver}" < "3.8" |
47 | BuildRequires: python3-importlib_metadata | |
48 | %endif | |
d7cb1ebf JB |
49 | BuildRequires: python3-mccabe >= 0.6.0 |
50 | BuildRequires: python3-mccabe < 0.7.0 | |
e6703bef JB |
51 | BuildRequires: python3-pycodestyle >= 2.7.0 |
52 | BuildRequires: python3-pycodestyle < 2.8.0 | |
53 | BuildRequires: python3-pyflakes >= 2.3.0 | |
54 | BuildRequires: python3-pyflakes < 2.4.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 | |
e6703bef | 85 | Summary: The modular source code checker: pycodestyle, pyflakes and co. |
d7cb1ebf | 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-mccabe >= 0.6.0 |
89 | Requires: python-mccabe < 0.7.0 | |
d7cb1ebf | 90 | Requires: python-modules >= 1:2.7 |
e6703bef JB |
91 | Requires: python-pycodestyle >= 2.7.0 |
92 | Requires: python-pycodestyle < 2.8.0 | |
93 | Requires: python-pyflakes >= 2.3.0 | |
94 | Requires: python-pyflakes < 2.4.0 | |
37b9d23d JB |
95 | |
96 | %description -n python-flake8 | |
97 | The modular source code checker. It is a wrapper around these tools: | |
98 | - PyFlakes | |
d7cb1ebf | 99 | - pycodestyle |
37b9d23d JB |
100 | - Ned Batchelder's McCabe script |
101 | ||
102 | %description -n python-flake8 -l pl.UTF-8 | |
103 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
104 | dla narzędzi: | |
105 | - PyFlakes | |
d7cb1ebf | 106 | - pycodestyle |
37b9d23d JB |
107 | - skrypt McCabe autorstwa Neda Batcheldera |
108 | ||
109 | %package -n python3-flake8 | |
d7cb1ebf JB |
110 | Summary: The modular source code checker: pycodestyle, pyflakes and co |
111 | Summary(pl.UTF-8): Modularne narzędzie do sprawdzania kodu źródłowego: pycodestyle, pyflakes itp. | |
37b9d23d | 112 | Group: Libraries/Python |
9c766400 JP |
113 | Requires: python3-mccabe >= 0.6.0 |
114 | Requires: python3-mccabe < 0.7.0 | |
d7cb1ebf | 115 | Requires: python3-modules >= 1:3.4 |
e6703bef JB |
116 | Requires: python3-pycodestyle >= 2.7.0 |
117 | Requires: python3-pycodestyle < 2.8.0 | |
118 | Requires: python3-pyflakes >= 2.3.0 | |
119 | Requires: python3-pyflakes < 2.4.0 | |
37b9d23d JB |
120 | |
121 | %description -n python3-flake8 | |
122 | The modular source code checker. It is a wrapper around these tools: | |
123 | - PyFlakes | |
d7cb1ebf | 124 | - pycodestyle |
37b9d23d JB |
125 | - Ned Batchelder's McCabe script |
126 | ||
127 | %description -n python3-flake8 -l pl.UTF-8 | |
128 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
129 | dla narzędzi: | |
130 | - PyFlakes | |
d7cb1ebf | 131 | - pycodestyle |
37b9d23d JB |
132 | - skrypt McCabe autorstwa Neda Batcheldera |
133 | ||
34073edd JB |
134 | %package -n python-flake8-apidocs |
135 | Summary: API documentation for Python flake8 module | |
136 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona flake8 | |
137 | Group: Documentation | |
138 | ||
139 | %description -n python-flake8-apidocs | |
140 | API documentation for Python flake8 module. | |
141 | ||
142 | %description -n python-flake8-apidocs -l pl.UTF-8 | |
143 | Dokumentacja API modułu Pythona flake8. | |
144 | ||
abcf879e AM |
145 | %prep |
146 | %setup -q | |
7b99a73b | 147 | %patch0 -p1 |
abcf879e AM |
148 | |
149 | %build | |
37b9d23d | 150 | %if %{with python2} |
18203870 JB |
151 | %py_build |
152 | ||
153 | %if %{with tests} | |
e6703bef | 154 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
18203870 JB |
155 | PYTHONPATH=$(pwd)/src \ |
156 | %{__python} -m pytest -rw tests | |
157 | %endif | |
37b9d23d JB |
158 | %endif |
159 | ||
160 | %if %{with python3} | |
d7cb1ebf JB |
161 | # don't require standalone mock |
162 | %{__sed} -i -e 's/import mock/from unittest import mock/' $(grep 'import mock' tests/ -rl) | |
163 | ||
18203870 JB |
164 | %py3_build |
165 | ||
166 | %if %{with tests} | |
e6703bef | 167 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
18203870 JB |
168 | PYTHONPATH=$(pwd)/src \ |
169 | %{__python3} -m pytest -rw tests | |
170 | %endif | |
37b9d23d | 171 | %endif |
abcf879e | 172 | |
34073edd JB |
173 | %if %{with doc} |
174 | cd docs/source | |
175 | PYTHONPATH=$(pwd)/../../src \ | |
176 | sphinx-build-3 -b html . _build/html | |
177 | %endif | |
178 | ||
abcf879e AM |
179 | %install |
180 | rm -rf $RPM_BUILD_ROOT | |
37b9d23d JB |
181 | |
182 | %if %{with python2} | |
183 | %py_install | |
d7cb1ebf | 184 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-2} |
37b9d23d JB |
185 | %py_postclean |
186 | %endif | |
187 | ||
188 | %if %{with python3} | |
33643bb9 | 189 | %py3_install |
d7cb1ebf | 190 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-3} |
37b9d23d | 191 | %endif |
abcf879e | 192 | |
8b0b6706 ER |
193 | ln -s flake-%{!?with_python3:2}%{?with_python3:3} $RPM_BUILD_ROOT%{_bindir}/flake8 |
194 | ||
abcf879e AM |
195 | %clean |
196 | rm -rf $RPM_BUILD_ROOT | |
197 | ||
198 | %files | |
199 | %defattr(644,root,root,755) | |
abcf879e | 200 | %attr(755,root,root) %{_bindir}/flake8 |
37b9d23d JB |
201 | |
202 | %if %{with python2} | |
203 | %files -n python-flake8 | |
204 | %defattr(644,root,root,755) | |
34073edd | 205 | %doc CONTRIBUTORS.txt LICENSE README.rst |
37b9d23d JB |
206 | %attr(755,root,root) %{_bindir}/flake8-2 |
207 | %{py_sitescriptdir}/flake8 | |
208 | %{py_sitescriptdir}/flake8-%{version}-py*.egg-info | |
209 | %endif | |
210 | ||
211 | %if %{with python3} | |
212 | %files -n python3-flake8 | |
213 | %defattr(644,root,root,755) | |
34073edd | 214 | %doc CONTRIBUTORS.txt LICENSE README.rst |
37b9d23d JB |
215 | %attr(755,root,root) %{_bindir}/flake8-3 |
216 | %{py3_sitescriptdir}/flake8 | |
217 | %{py3_sitescriptdir}/flake8-%{version}-py*.egg-info | |
218 | %endif | |
34073edd JB |
219 | |
220 | %if %{with doc} | |
221 | %files -n python-flake8-apidocs | |
222 | %defattr(644,root,root,755) | |
223 | %doc docs/source/_build/html/{_modules,_static,internal,plugin-development,release-notes,user,*.html,*.js} | |
224 | %endif |