]>
Commit | Line | Data |
---|---|---|
550f5c2e ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # do not perform "make test" | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define module chai | |
8 | Summary: Easy to use mocking/stub/spy framework | |
9 | Name: python-%{module} | |
10 | Version: 1.0.0 | |
8f0ebfd3 | 11 | Release: 12 |
550f5c2e ER |
12 | License: BSD |
13 | Group: Development/Libraries | |
14 | Source0: http://pypi.python.org/packages/source/c/%{module}/%{module}-%{version}.tar.gz | |
15 | # Source0-md5: fce8d1deb08ef6c1fb2b56eea7ae7b67 | |
16 | URL: http://pypi.python.org/pypi/chai | |
d2a01302 | 17 | BuildRequires: rpmbuild(macros) >= 1.710 |
550f5c2e ER |
18 | BuildRequires: python-devel |
19 | BuildRequires: python-nose | |
405a6452 ER |
20 | BuildRequires: python-setuptools |
21 | BuildRequires: rpm-pythonprov | |
550f5c2e ER |
22 | %if %{with python3} |
23 | BuildRequires: python3-devel | |
24 | BuildRequires: python3-nose | |
405a6452 | 25 | BuildRequires: python3-setuptools |
550f5c2e | 26 | %endif |
405a6452 | 27 | BuildArch: noarch |
550f5c2e ER |
28 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
29 | ||
30 | %description | |
31 | Chai provides a very easy to use API for mocking/stubbing your Python | |
32 | objects, patterned after the Mocha <http://mocha.rubyforge.org/> | |
33 | library for Ruby. | |
34 | ||
35 | %package -n python3-%{module} | |
36 | Summary: Easy to use mocking/stub framework | |
37 | Group: Development/Libraries | |
38 | ||
39 | %description -n python3-%{module} | |
40 | Chai provides a very easy to use API for mocking/stubbing your python | |
41 | objects, patterned after the Mocha <http://mocha.rubyforge.org/> | |
42 | library for Ruby. | |
43 | ||
44 | %prep | |
45 | %setup -q -n %{module}-%{version} | |
46 | ||
47 | # Remove bundled egg-info in case it exists | |
48 | rm -r %{module}.egg-info | |
49 | ||
50 | %build | |
51 | %if %{with python2} | |
8c05cfe8 | 52 | %py_build %{?with_tests:test} |
550f5c2e ER |
53 | %endif |
54 | ||
55 | %if %{with python3} | |
56 | # Remove python2 compatibility files | |
57 | # Makes tests fail and are not needed on python3 | |
58 | rm chai/python2.py | |
59 | rm tests/comparator_py2.py | |
60 | # signature mismatch | |
61 | rm tests/stub_test.py | |
62 | ||
8c05cfe8 | 63 | %py3_build %{?with_tests:test} |
550f5c2e ER |
64 | %endif |
65 | ||
66 | %install | |
67 | rm -rf $RPM_BUILD_ROOT | |
68 | %if %{with python2} | |
8c05cfe8 | 69 | %py_install |
550f5c2e ER |
70 | |
71 | %py_postclean | |
72 | %endif | |
73 | ||
74 | %if %{with python3} | |
8c05cfe8 | 75 | %py3_install |
550f5c2e ER |
76 | %endif |
77 | ||
78 | %clean | |
79 | rm -rf $RPM_BUILD_ROOT | |
80 | ||
81 | %files | |
82 | %defattr(644,root,root,755) | |
83 | %doc README.rst LICENSE.txt | |
84 | %{py_sitescriptdir}/chai | |
85 | %{py_sitescriptdir}/chai-%{version}-py*.egg-info | |
86 | ||
87 | %if %{with python3} | |
88 | %files -n python3-%{module} | |
89 | %defattr(644,root,root,755) | |
90 | %doc README.rst LICENSE.txt | |
91 | %{py3_sitescriptdir}/chai | |
92 | %{py3_sitescriptdir}/chai-%{version}-py*.egg-info | |
93 | %endif |