]>
Commit | Line | Data |
---|---|---|
997ac732 JR |
1 | # |
2 | # Conditional build: | |
3 | %bcond_with tests # do not perform "make test" | |
4 | %bcond_without doc # Build API documentation | |
77358bd0 AM |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
997ac732 JR |
7 | |
8 | %define module pep8 | |
9 | Summary: Python style guide checker | |
10 | Name: python-%{module} | |
77358bd0 | 11 | Version: 1.5.7 |
997ac732 JR |
12 | Release: 1 |
13 | License: MIT | |
14 | Group: Libraries/Python | |
15 | Source0: https://pypi.python.org/packages/source/p/pep8/%{module}-%{version}.tar.gz | |
77358bd0 | 16 | # Source0-md5: f6adbdd69365ecca20513c709f9b7c93 |
997ac732 JR |
17 | URL: https://pypi.python.org/pypi/pep8 |
18 | BuildRequires: rpm-pythonprov | |
19 | BuildRequires: rpmbuild(macros) >= 1.219 | |
77358bd0 | 20 | %if %{with python2} |
997ac732 JR |
21 | BuildRequires: python-Sphinx |
22 | BuildRequires: python-distribute | |
23 | Requires: python-modules | |
77358bd0 AM |
24 | %endif |
25 | %if %{with python3} | |
26 | BuildRequires: python3-Sphinx | |
27 | BuildRequires: python3-distribute | |
28 | %endif | |
997ac732 JR |
29 | BuildArch: noarch |
30 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
31 | ||
32 | %description | |
33 | pep8 is a tool to check your Python code against some of the style | |
34 | conventions in PEP 8. | |
35 | ||
77358bd0 AM |
36 | %package -n python3-%{module} |
37 | Summary: Python style guide checker | |
38 | Group: Libraries/Python | |
39 | Requires: python3-modules | |
40 | ||
41 | %description -n python3-%{module} | |
42 | pep8 is a tool to check your Python code against some of the style | |
43 | conventions in PEP 8. | |
44 | ||
997ac732 JR |
45 | %package apidocs |
46 | Summary: %{module} API documentation | |
47 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
48 | Group: Documentation | |
49 | ||
50 | %description apidocs | |
51 | API documentation for %{module}. | |
52 | ||
53 | %description apidocs -l pl.UTF-8 | |
54 | Dokumentacja API %{module}. | |
55 | ||
56 | %prep | |
57 | %setup -q -n %{module}-%{version} | |
58 | ||
59 | %build | |
77358bd0 | 60 | %if %{with python2} |
997ac732 | 61 | %{__python} setup.py build --build-base build-2 %{?with_tests:test} |
77358bd0 AM |
62 | %endif |
63 | ||
64 | %if %{with python3} | |
65 | %{__python3} setup.py build --build-base build-3 %{?with_tests:test} | |
66 | %endif | |
997ac732 JR |
67 | |
68 | %if %{with doc} | |
69 | cd docs | |
70 | %{__make} -j1 html | |
71 | rm -rf _build/html/_sources | |
72 | %endif | |
73 | ||
74 | %install | |
75 | rm -rf $RPM_BUILD_ROOT | |
76 | ||
77358bd0 | 77 | %if %{with python2} |
997ac732 | 78 | %{__python} setup.py \ |
77358bd0 AM |
79 | build --build-base build-2 \ |
80 | install --skip-build \ | |
81 | --optimize=2 \ | |
82 | --root=$RPM_BUILD_ROOT | |
997ac732 JR |
83 | |
84 | %py_postclean | |
77358bd0 AM |
85 | %endif |
86 | ||
87 | %if %{with python3} | |
88 | %{__python3} setup.py \ | |
89 | build --build-base build-3 \ | |
90 | install --skip-build \ | |
91 | --optimize=2 \ | |
92 | --root=$RPM_BUILD_ROOT | |
93 | %endif | |
997ac732 JR |
94 | |
95 | %clean | |
96 | rm -rf $RPM_BUILD_ROOT | |
97 | ||
77358bd0 | 98 | %if %{with python2} |
997ac732 JR |
99 | %files |
100 | %defattr(644,root,root,755) | |
101 | %doc CHANGES.txt README.rst | |
102 | %attr(755,root,root) %{_bindir}/pep8 | |
103 | %{py_sitescriptdir}/*.py[co] | |
104 | %if "%{py_ver}" > "2.4" | |
105 | %{py_sitescriptdir}/pep8-*.egg-info | |
106 | %endif | |
77358bd0 AM |
107 | %endif |
108 | ||
109 | %if %{with python3} | |
110 | %files -n python3-%{module} | |
111 | %defattr(644,root,root,755) | |
112 | %doc CHANGES.txt README.rst | |
113 | %{py3_sitescriptdir}/%{module}.py | |
114 | %{py3_sitescriptdir}/__pycache__/%{module}.cpython-*.py[co] | |
115 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
116 | %endif | |
997ac732 JR |
117 | |
118 | %if %{with doc} | |
119 | %files apidocs | |
120 | %defattr(644,root,root,755) | |
121 | %doc docs/_build/html/* | |
122 | %endif |