]>
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 JB |
11 | Version: 3.7.9 |
12 | Release: 1 | |
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 |
d7cb1ebf | 88 | Requires: python-modules >= 1:2.7 |
37b9d23d JB |
89 | |
90 | %description -n python-flake8 | |
91 | The modular source code checker. It is a wrapper around these tools: | |
92 | - PyFlakes | |
d7cb1ebf | 93 | - pycodestyle |
37b9d23d JB |
94 | - Ned Batchelder's McCabe script |
95 | ||
96 | %description -n python-flake8 -l pl.UTF-8 | |
97 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
98 | dla narzędzi: | |
99 | - PyFlakes | |
d7cb1ebf | 100 | - pycodestyle |
37b9d23d JB |
101 | - skrypt McCabe autorstwa Neda Batcheldera |
102 | ||
103 | %package -n python3-flake8 | |
d7cb1ebf JB |
104 | Summary: The modular source code checker: pycodestyle, pyflakes and co |
105 | Summary(pl.UTF-8): Modularne narzędzie do sprawdzania kodu źródłowego: pycodestyle, pyflakes itp. | |
37b9d23d | 106 | Group: Libraries/Python |
d7cb1ebf | 107 | Requires: python3-modules >= 1:3.4 |
37b9d23d JB |
108 | |
109 | %description -n python3-flake8 | |
110 | The modular source code checker. It is a wrapper around these tools: | |
111 | - PyFlakes | |
d7cb1ebf | 112 | - pycodestyle |
37b9d23d JB |
113 | - Ned Batchelder's McCabe script |
114 | ||
115 | %description -n python3-flake8 -l pl.UTF-8 | |
116 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
117 | dla narzędzi: | |
118 | - PyFlakes | |
d7cb1ebf | 119 | - pycodestyle |
37b9d23d JB |
120 | - skrypt McCabe autorstwa Neda Batcheldera |
121 | ||
34073edd JB |
122 | %package -n python-flake8-apidocs |
123 | Summary: API documentation for Python flake8 module | |
124 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona flake8 | |
125 | Group: Documentation | |
126 | ||
127 | %description -n python-flake8-apidocs | |
128 | API documentation for Python flake8 module. | |
129 | ||
130 | %description -n python-flake8-apidocs -l pl.UTF-8 | |
131 | Dokumentacja API modułu Pythona flake8. | |
132 | ||
abcf879e AM |
133 | %prep |
134 | %setup -q | |
7b99a73b | 135 | %patch0 -p1 |
2fc1c087 | 136 | %patch1 -p1 |
abcf879e AM |
137 | |
138 | %build | |
37b9d23d | 139 | %if %{with python2} |
18203870 JB |
140 | %py_build |
141 | ||
142 | %if %{with tests} | |
143 | PYTHONPATH=$(pwd)/src \ | |
144 | %{__python} -m pytest -rw tests | |
145 | %endif | |
37b9d23d JB |
146 | %endif |
147 | ||
148 | %if %{with python3} | |
d7cb1ebf JB |
149 | # don't require standalone mock |
150 | %{__sed} -i -e 's/import mock/from unittest import mock/' $(grep 'import mock' tests/ -rl) | |
151 | ||
18203870 JB |
152 | %py3_build |
153 | ||
154 | %if %{with tests} | |
155 | PYTHONPATH=$(pwd)/src \ | |
156 | %{__python3} -m pytest -rw tests | |
157 | %endif | |
37b9d23d | 158 | %endif |
abcf879e | 159 | |
34073edd JB |
160 | %if %{with doc} |
161 | cd docs/source | |
162 | PYTHONPATH=$(pwd)/../../src \ | |
163 | sphinx-build-3 -b html . _build/html | |
164 | %endif | |
165 | ||
abcf879e AM |
166 | %install |
167 | rm -rf $RPM_BUILD_ROOT | |
37b9d23d JB |
168 | |
169 | %if %{with python2} | |
170 | %py_install | |
d7cb1ebf | 171 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-2} |
37b9d23d JB |
172 | %py_postclean |
173 | %endif | |
174 | ||
175 | %if %{with python3} | |
33643bb9 | 176 | %py3_install |
d7cb1ebf | 177 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-3} |
37b9d23d | 178 | %endif |
abcf879e | 179 | |
8b0b6706 ER |
180 | ln -s flake-%{!?with_python3:2}%{?with_python3:3} $RPM_BUILD_ROOT%{_bindir}/flake8 |
181 | ||
abcf879e AM |
182 | %clean |
183 | rm -rf $RPM_BUILD_ROOT | |
184 | ||
185 | %files | |
186 | %defattr(644,root,root,755) | |
abcf879e | 187 | %attr(755,root,root) %{_bindir}/flake8 |
37b9d23d JB |
188 | |
189 | %if %{with python2} | |
190 | %files -n python-flake8 | |
191 | %defattr(644,root,root,755) | |
34073edd | 192 | %doc CONTRIBUTORS.txt LICENSE README.rst |
37b9d23d JB |
193 | %attr(755,root,root) %{_bindir}/flake8-2 |
194 | %{py_sitescriptdir}/flake8 | |
195 | %{py_sitescriptdir}/flake8-%{version}-py*.egg-info | |
196 | %endif | |
197 | ||
198 | %if %{with python3} | |
199 | %files -n python3-flake8 | |
200 | %defattr(644,root,root,755) | |
34073edd | 201 | %doc CONTRIBUTORS.txt LICENSE README.rst |
37b9d23d JB |
202 | %attr(755,root,root) %{_bindir}/flake8-3 |
203 | %{py3_sitescriptdir}/flake8 | |
204 | %{py3_sitescriptdir}/flake8-%{version}-py*.egg-info | |
205 | %endif | |
34073edd JB |
206 | |
207 | %if %{with doc} | |
208 | %files -n python-flake8-apidocs | |
209 | %defattr(644,root,root,755) | |
210 | %doc docs/source/_build/html/{_modules,_static,internal,plugin-development,release-notes,user,*.html,*.js} | |
211 | %endif |