3 %bcond_without python2 # CPython 2.x module
4 %bcond_without python3 # CPython 3.x module
5 %bcond_without tests # pytest tests
6 %bcond_without doc # Sphinx documentation
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.
11 # before updating to 4.x fork python-flake8.spec with last 3.x version
15 Group: Development/Tools
16 #Source0Download: https://pypi.org/simple/flake8/
17 Source0: https://files.pythonhosted.org/packages/source/f/flake8/%{name}-%{version}.tar.gz
18 # Source0-md5: 5c102972d3d0f35255c56a20613fcec5
19 Patch0: %{name}-duplicate.patch
20 URL: https://gitlab.com/pycqa/flake8
21 BuildRequires: rpmbuild(macros) >= 1.714
22 BuildRequires: rpm-pythonprov
24 BuildRequires: python-modules >= 1:2.7
25 BuildRequires: python-setuptools >= 1:30
27 BuildRequires: python-configparser
28 BuildRequires: python-enum34
29 BuildRequires: python-functools32
30 BuildRequires: python-importlib_metadata
31 BuildRequires: python-mccabe >= 0.6.0
32 BuildRequires: python-mccabe < 0.7.0
33 BuildRequires: python-mock >= 2.0.0
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
38 BuildRequires: python-pytest
39 BuildRequires: python-typing
43 BuildRequires: python3-modules >= 1:3.5
44 BuildRequires: python3-setuptools >= 1:30
46 %if "%{py3_ver}" < "3.8"
47 BuildRequires: python3-importlib_metadata
49 BuildRequires: python3-mccabe >= 0.6.0
50 BuildRequires: python3-mccabe < 0.7.0
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
55 BuildRequires: python3-pytest
56 BuildRequires: sed >= 4.0
60 BuildRequires: python3-sphinx-prompt
61 BuildRequires: sphinx-pdg-3 >= 1.3
64 Requires: python3-flake8 = %{version}-%{release}
66 Requires: python-flake8 = %{version}-%{release}
69 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
72 The modular source code checker. It is a wrapper around these tools:
75 - Ned Batchelder's McCabe script
77 %description -l pl.UTF-8
78 Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie
82 - skrypt McCabe autorstwa Neda Batcheldera
84 %package -n python-flake8
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.
87 Group: Libraries/Python
88 Requires: python-mccabe >= 0.6.0
89 Requires: python-mccabe < 0.7.0
90 Requires: python-modules >= 1:2.7
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
96 %description -n python-flake8
97 The modular source code checker. It is a wrapper around these tools:
100 - Ned Batchelder's McCabe script
102 %description -n python-flake8 -l pl.UTF-8
103 Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie
107 - skrypt McCabe autorstwa Neda Batcheldera
109 %package -n python3-flake8
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.
112 Group: Libraries/Python
113 Requires: python3-mccabe >= 0.6.0
114 Requires: python3-mccabe < 0.7.0
115 Requires: python3-modules >= 1:3.4
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
121 %description -n python3-flake8
122 The modular source code checker. It is a wrapper around these tools:
125 - Ned Batchelder's McCabe script
127 %description -n python3-flake8 -l pl.UTF-8
128 Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie
132 - skrypt McCabe autorstwa Neda Batcheldera
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
139 %description -n python-flake8-apidocs
140 API documentation for Python flake8 module.
142 %description -n python-flake8-apidocs -l pl.UTF-8
143 Dokumentacja API modułu Pythona flake8.
154 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
155 PYTHONPATH=$(pwd)/src \
156 %{__python} -m pytest -rw tests
161 # don't require standalone mock
162 %{__sed} -i -e 's/import mock/from unittest import mock/' $(grep 'import mock' tests/ -rl)
167 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
168 PYTHONPATH=$(pwd)/src \
169 %{__python3} -m pytest -rw tests
175 PYTHONPATH=$(pwd)/../../src \
176 sphinx-build-3 -b html . _build/html
180 rm -rf $RPM_BUILD_ROOT
184 %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-2}
190 %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-3}
193 ln -s flake-%{!?with_python3:2}%{?with_python3:3} $RPM_BUILD_ROOT%{_bindir}/flake8
196 rm -rf $RPM_BUILD_ROOT
199 %defattr(644,root,root,755)
200 %attr(755,root,root) %{_bindir}/flake8
203 %files -n python-flake8
204 %defattr(644,root,root,755)
205 %doc CONTRIBUTORS.txt LICENSE README.rst
206 %attr(755,root,root) %{_bindir}/flake8-2
207 %{py_sitescriptdir}/flake8
208 %{py_sitescriptdir}/flake8-%{version}-py*.egg-info
212 %files -n python3-flake8
213 %defattr(644,root,root,755)
214 %doc CONTRIBUTORS.txt LICENSE README.rst
215 %attr(755,root,root) %{_bindir}/flake8-3
216 %{py3_sitescriptdir}/flake8
217 %{py3_sitescriptdir}/flake8-%{version}-py*.egg-info
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}