]>
Commit | Line | Data |
---|---|---|
bd571570 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # HTML documentation build | |
e4983238 ER |
4 | %bcond_without python3 # CPython 3.x module |
5 | ||
6 | %define pylib_version 1.4.12 | |
7 | %define module pytest | |
bd571570 JB |
8 | Summary: Simple and popular testing tool for Python |
9 | Summary(pl.UTF-8): Proste i popularne narzędzie testujące dla Pythona | |
e4983238 ER |
10 | Name: python-%{module} |
11 | Version: 2.3.4 | |
bd571570 JB |
12 | Release: 1 |
13 | License: MIT | |
14 | Group: Development/Languages/Python | |
15 | Source0: http://pypi.python.org/packages/source/p/pytest/pytest-%{version}.zip | |
e4983238 | 16 | # Source0-md5: db319fef9c310dc46798b285d3da3aa1 |
bd571570 JB |
17 | URL: http://pytest.org/ |
18 | BuildRequires: python-devel >= 2.4 | |
e4983238 | 19 | BuildRequires: python-py >= %{pylib_version} |
bd571570 JB |
20 | BuildRequires: rpm-pythonprov |
21 | BuildRequires: rpmbuild(macros) >= 1.219 | |
e4983238 | 22 | BuildRequires: sed >= 4.0 |
bd571570 | 23 | %if %{with doc} |
bd571570 JB |
24 | BuildRequires: sphinx-pdg >= 1.0 |
25 | %endif | |
e4983238 ER |
26 | %if %{with python3} |
27 | BuildRequires: python3-devel | |
6b847094 | 28 | BuildRequires: python3-distribute |
e4983238 ER |
29 | BuildRequires: python3-modules |
30 | BuildRequires: python3-py >= %{pylib_version} | |
e4983238 ER |
31 | %endif |
32 | Requires: python-py >= %{pylib_version} | |
bd571570 JB |
33 | BuildArch: noarch |
34 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
35 | ||
36 | %description | |
37 | py.test is a simple and popular testing tool for Python. | |
38 | ||
39 | %description -l pl.UTF-8 | |
40 | py.test to proste i popularne narzędzie testujące dla Pythona. | |
41 | ||
e4983238 ER |
42 | %package -n python3-pytest |
43 | Summary: Simple powerful testing with Python | |
6b847094 | 44 | Summary(pl.UTF-8): Proste, ale funkcjonalne narzędzie testujące dla Pythona |
e4983238 ER |
45 | Group: Development/Languages |
46 | Requires: python3-py >= %{pylib_version} | |
6b847094 | 47 | Suggests: python3-setuptools |
e4983238 ER |
48 | |
49 | %description -n python3-pytest | |
50 | py.test provides simple, yet powerful testing for Python. | |
51 | ||
6b847094 JB |
52 | %description -n python3-pytest -l pl.UTF-8 |
53 | py.test to proste, ale bardzo funkcjonalne narzędzie testujące dla | |
54 | Pythona. | |
55 | ||
bd571570 | 56 | %prep |
e4983238 ER |
57 | %setup -q -n %{module}-%{version} |
58 | ||
59 | %if %{with python3} | |
60 | rm -rf build-3 | |
61 | set -- * | |
62 | install -d build-3 | |
63 | cp -a "$@" build-3 | |
64 | find build-3 -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' | |
65 | %endif | |
bd571570 JB |
66 | |
67 | %build | |
68 | %{__python} setup.py build | |
69 | ||
e4983238 ER |
70 | %if %{with python3} |
71 | %{__python3} setup.py \ | |
72 | build -b build-3 | |
73 | %endif | |
74 | ||
bd571570 | 75 | %if %{with doc} |
e4983238 ER |
76 | install -d _htmldocs/html |
77 | for l in doc/*; do | |
78 | PYTHONPATH=$(pwd) \ | |
79 | %{__make} -C $l html | |
80 | # remove hidden file | |
81 | rm $l/_build/html/.buildinfo | |
82 | mv $l/_build/html _htmldocs/html/${l##doc/} | |
83 | done | |
bd571570 JB |
84 | %endif |
85 | ||
86 | %install | |
87 | rm -rf $RPM_BUILD_ROOT | |
e4983238 ER |
88 | %{__python3} -- setup.py \ |
89 | build -b build-3 \ | |
90 | install \ | |
91 | --root=$RPM_BUILD_ROOT \ | |
92 | --optimize=2 | |
93 | ||
bd571570 JB |
94 | %{__python} setup.py install \ |
95 | --optimize=2 \ | |
96 | --root=$RPM_BUILD_ROOT | |
97 | ||
98 | %py_postclean | |
99 | ||
100 | %clean | |
101 | rm -rf $RPM_BUILD_ROOT | |
102 | ||
103 | %files | |
104 | %defattr(644,root,root,755) | |
e4983238 | 105 | %doc CHANGELOG LICENSE README.txt %{?with_doc:_htmldocs/html} |
bd571570 JB |
106 | %attr(755,root,root) %{_bindir}/py.test |
107 | %attr(755,root,root) %{_bindir}/py.test-%{py_ver} | |
108 | %{py_sitescriptdir}/pytest.py[co] | |
109 | %{py_sitescriptdir}/_pytest | |
110 | %{py_sitescriptdir}/pytest-%{version}-py*.egg-info | |
e4983238 ER |
111 | |
112 | %if %{with python3} | |
113 | %files -n python3-pytest | |
114 | %defattr(644,root,root,755) | |
115 | %doc CHANGELOG LICENSE README.txt %{?with_doc:_htmldocs/html} | |
116 | %attr(755,root,root) %{_bindir}/py.test-%{py3_ver} | |
6b847094 | 117 | %{py3_sitescriptdir}/pytest.py |
e4983238 | 118 | %{py3_sitescriptdir}/_pytest |
6b847094 | 119 | %{py3_sitescriptdir}/__pycache__/pytest.*.py[co] |
e4983238 ER |
120 | %{py3_sitescriptdir}/pytest-%{version}-py*.egg-info |
121 | %endif |