]>
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 |
34073edd JB |
11 | Version: 3.5.0 |
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 |
34073edd | 17 | # Source0-md5: 7e5fe39d578a2c2d0962b61b35b8c3fc |
d7cb1ebf JB |
18 | Patch0: %{name}-mock.patch |
19 | URL: https://gitlab.com/pycqa/flake8 | |
37b9d23d | 20 | BuildRequires: rpmbuild(macros) >= 1.714 |
abcf879e | 21 | BuildRequires: rpm-pythonprov |
37b9d23d | 22 | %if %{with python2} |
d7cb1ebf | 23 | BuildRequires: python-modules >= 1:2.7 |
34073edd | 24 | BuildRequires: python-setuptools >= 30 |
37b9d23d | 25 | %if %{with tests} |
9bc90c26 | 26 | BuildRequires: python-configparser |
d7cb1ebf JB |
27 | BuildRequires: python-enum34 |
28 | BuildRequires: python-mccabe >= 0.6.0 | |
29 | BuildRequires: python-mccabe < 0.7.0 | |
972dfbb9 | 30 | BuildRequires: python-mock >= 2.0.0 |
53123676 | 31 | BuildRequires: python-pycodestyle >= 2.0.0 |
d7cb1ebf JB |
32 | BuildRequires: python-pycodestyle < 2.4.0 |
33 | BuildRequires: python-pyflakes >= 1.5.0 | |
34073edd | 34 | BuildRequires: python-pyflakes < 1.7.0 |
d7cb1ebf JB |
35 | BuildRequires: python-pytest |
36 | BuildRequires: python-pytest-runner | |
37b9d23d JB |
37 | %endif |
38 | %endif | |
39 | %if %{with python3} | |
d7cb1ebf | 40 | BuildRequires: python3-modules >= 1:3.4 |
34073edd | 41 | BuildRequires: python3-setuptools >= 30 |
a24e9a34 | 42 | %if %{with tests} |
d7cb1ebf JB |
43 | BuildRequires: python3-mccabe >= 0.6.0 |
44 | BuildRequires: python3-mccabe < 0.7.0 | |
53123676 | 45 | BuildRequires: python3-pycodestyle >= 2.0.0 |
d7cb1ebf JB |
46 | BuildRequires: python3-pycodestyle < 2.4.0 |
47 | BuildRequires: python3-pyflakes >= 1.5.0 | |
34073edd | 48 | BuildRequires: python3-pyflakes < 1.7.0 |
d7cb1ebf JB |
49 | BuildRequires: python3-pytest |
50 | BuildRequires: python3-pytest-runner | |
51 | BuildRequires: sed >= 4.0 | |
a24e9a34 | 52 | %endif |
37b9d23d | 53 | %endif |
34073edd JB |
54 | %if %{with doc} |
55 | BuildRequires: python3-sphinx-prompt | |
56 | BuildRequires: sphinx-pdg-3 | |
57 | %endif | |
37b9d23d JB |
58 | %if %{with python3} |
59 | Requires: python3-flake8 = %{version}-%{release} | |
60 | %else | |
61 | Requires: python-flake8 = %{version}-%{release} | |
62 | %endif | |
abcf879e AM |
63 | BuildArch: noarch |
64 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
65 | ||
66 | %description | |
67 | The modular source code checker. It is a wrapper around these tools: | |
68 | - PyFlakes | |
d7cb1ebf | 69 | - pycodestyle |
abcf879e AM |
70 | - Ned Batchelder's McCabe script |
71 | ||
37b9d23d JB |
72 | %description -l pl.UTF-8 |
73 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
74 | dla narzędzi: | |
75 | - PyFlakes | |
d7cb1ebf | 76 | - pycodestyle |
37b9d23d JB |
77 | - skrypt McCabe autorstwa Neda Batcheldera |
78 | ||
79 | %package -n python-flake8 | |
d7cb1ebf JB |
80 | Summary: The modular source code checker: pycodestyle, pyflakes and co |
81 | Summary(pl.UTF-8): Modularne narzędzie do sprawdzania kodu źródłowego: pycodestyle, pyflakes itp. | |
37b9d23d | 82 | Group: Libraries/Python |
d7cb1ebf | 83 | Requires: python-modules >= 1:2.7 |
37b9d23d JB |
84 | |
85 | %description -n python-flake8 | |
86 | The modular source code checker. It is a wrapper around these tools: | |
87 | - PyFlakes | |
d7cb1ebf | 88 | - pycodestyle |
37b9d23d JB |
89 | - Ned Batchelder's McCabe script |
90 | ||
91 | %description -n python-flake8 -l pl.UTF-8 | |
92 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
93 | dla narzędzi: | |
94 | - PyFlakes | |
d7cb1ebf | 95 | - pycodestyle |
37b9d23d JB |
96 | - skrypt McCabe autorstwa Neda Batcheldera |
97 | ||
98 | %package -n python3-flake8 | |
d7cb1ebf JB |
99 | Summary: The modular source code checker: pycodestyle, pyflakes and co |
100 | Summary(pl.UTF-8): Modularne narzędzie do sprawdzania kodu źródłowego: pycodestyle, pyflakes itp. | |
37b9d23d | 101 | Group: Libraries/Python |
d7cb1ebf | 102 | Requires: python3-modules >= 1:3.4 |
37b9d23d JB |
103 | |
104 | %description -n python3-flake8 | |
105 | The modular source code checker. It is a wrapper around these tools: | |
106 | - PyFlakes | |
d7cb1ebf | 107 | - pycodestyle |
37b9d23d JB |
108 | - Ned Batchelder's McCabe script |
109 | ||
110 | %description -n python3-flake8 -l pl.UTF-8 | |
111 | Modularne narzędzie do sprawdzania kodu źródłowego. Jest to opakowanie | |
112 | dla narzędzi: | |
113 | - PyFlakes | |
d7cb1ebf | 114 | - pycodestyle |
37b9d23d JB |
115 | - skrypt McCabe autorstwa Neda Batcheldera |
116 | ||
34073edd JB |
117 | %package -n python-flake8-apidocs |
118 | Summary: API documentation for Python flake8 module | |
119 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona flake8 | |
120 | Group: Documentation | |
121 | ||
122 | %description -n python-flake8-apidocs | |
123 | API documentation for Python flake8 module. | |
124 | ||
125 | %description -n python-flake8-apidocs -l pl.UTF-8 | |
126 | Dokumentacja API modułu Pythona flake8. | |
127 | ||
abcf879e AM |
128 | %prep |
129 | %setup -q | |
d7cb1ebf | 130 | %patch0 -p1 |
abcf879e AM |
131 | |
132 | %build | |
37b9d23d JB |
133 | %if %{with python2} |
134 | %py_build %{?with_tests:test} | |
135 | %endif | |
136 | ||
137 | %if %{with python3} | |
d7cb1ebf JB |
138 | # don't require standalone mock |
139 | %{__sed} -i -e 's/import mock/from unittest import mock/' $(grep 'import mock' tests/ -rl) | |
140 | ||
33643bb9 | 141 | %py3_build %{?with_tests:test} |
37b9d23d | 142 | %endif |
abcf879e | 143 | |
34073edd JB |
144 | %if %{with doc} |
145 | cd docs/source | |
146 | PYTHONPATH=$(pwd)/../../src \ | |
147 | sphinx-build-3 -b html . _build/html | |
148 | %endif | |
149 | ||
abcf879e AM |
150 | %install |
151 | rm -rf $RPM_BUILD_ROOT | |
37b9d23d JB |
152 | |
153 | %if %{with python2} | |
154 | %py_install | |
d7cb1ebf | 155 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-2} |
37b9d23d JB |
156 | %py_postclean |
157 | %endif | |
158 | ||
159 | %if %{with python3} | |
33643bb9 | 160 | %py3_install |
d7cb1ebf | 161 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/flake8{,-3} |
34073edd JB |
162 | |
163 | # avoid dependencies on python3egg(configparser), python3egg(enum34) | |
164 | %{__sed} -i -e "/^\[:python_version *< *'3\.2']/,/^$/ d" \ | |
165 | -e "/^\[:python_version *< *'3\.4']/,/^$/ d" \ | |
166 | $RPM_BUILD_ROOT%{py3_sitescriptdir}/flake8-%{version}-py*.egg-info/requires.txt | |
37b9d23d | 167 | %endif |
abcf879e | 168 | |
8b0b6706 ER |
169 | ln -s flake-%{!?with_python3:2}%{?with_python3:3} $RPM_BUILD_ROOT%{_bindir}/flake8 |
170 | ||
abcf879e AM |
171 | %clean |
172 | rm -rf $RPM_BUILD_ROOT | |
173 | ||
174 | %files | |
175 | %defattr(644,root,root,755) | |
abcf879e | 176 | %attr(755,root,root) %{_bindir}/flake8 |
37b9d23d JB |
177 | |
178 | %if %{with python2} | |
179 | %files -n python-flake8 | |
180 | %defattr(644,root,root,755) | |
34073edd | 181 | %doc CONTRIBUTORS.txt LICENSE README.rst |
37b9d23d JB |
182 | %attr(755,root,root) %{_bindir}/flake8-2 |
183 | %{py_sitescriptdir}/flake8 | |
184 | %{py_sitescriptdir}/flake8-%{version}-py*.egg-info | |
185 | %endif | |
186 | ||
187 | %if %{with python3} | |
188 | %files -n python3-flake8 | |
189 | %defattr(644,root,root,755) | |
34073edd | 190 | %doc CONTRIBUTORS.txt LICENSE README.rst |
37b9d23d JB |
191 | %attr(755,root,root) %{_bindir}/flake8-3 |
192 | %{py3_sitescriptdir}/flake8 | |
193 | %{py3_sitescriptdir}/flake8-%{version}-py*.egg-info | |
194 | %endif | |
34073edd JB |
195 | |
196 | %if %{with doc} | |
197 | %files -n python-flake8-apidocs | |
198 | %defattr(644,root,root,755) | |
199 | %doc docs/source/_build/html/{_modules,_static,internal,plugin-development,release-notes,user,*.html,*.js} | |
200 | %endif |