]>
Commit | Line | Data |
---|---|---|
008761e8 JP |
1 | # |
2 | # Conditional build: | |
a32f3f91 AF |
3 | %bcond_without python2 |
4 | %bcond_without python3 | |
008761e8 JP |
5 | |
6 | %define module mockito | |
7 | Summary: Spying framework | |
8 | Name: python-%{module} | |
9 | Version: 0.5.1 | |
6eedfeeb | 10 | Release: |
008761e8 JP |
11 | License: MIT |
12 | Group: Development/Languages/Python | |
13 | Source0: http://mockito-python.googlecode.com/files/%{module}-python-%{version}.tar.gz | |
14 | # Source0-md5: 814669d5a6f1dc051f409d8c3521da64 | |
15 | URL: http://code.google.com/p/mockito-python | |
a32f3f91 | 16 | %if %{with python2} |
008761e8 | 17 | BuildRequires: python-distribute |
a32f3f91 AF |
18 | Requires: python-modules |
19 | %endif | |
20 | %if %{with python3} | |
21 | BuildRequires: python3 | |
22 | BuildRequires: python3-2to3 >= 1:3.1.1-3 | |
a32f3f91 AF |
23 | BuildRequires: python3-modules |
24 | %endif | |
008761e8 JP |
25 | BuildRequires: rpm-pythonprov |
26 | BuildRequires: rpmbuild(macros) >= 1.219 | |
008761e8 JP |
27 | BuildArch: noarch |
28 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
29 | ||
30 | %description | |
31 | Mockito is a spying framework based on Java library with the same | |
32 | name. | |
33 | ||
a32f3f91 AF |
34 | %package -n python3-%{module} |
35 | Summary: Spying framework | |
36 | Group: Development/Languages/Python | |
37 | ||
38 | %description -n python3-%{module} | |
39 | Mockito is a spying framework based on Java library with the same | |
40 | name. | |
41 | ||
008761e8 JP |
42 | %prep |
43 | %setup -q -n %{module}-python | |
44 | ||
45 | find . -name '*.py' -type f | xargs %{__sed} -i -e '1s,^#!.*python,#!%{__python},' | |
46 | ||
47 | %build | |
a32f3f91 AF |
48 | %if %{with python2} |
49 | %{__python} setup.py \ | |
50 | build -b build-2 | |
51 | ||
52 | %endif | |
53 | ||
54 | %if %{with python3} | |
55 | %{__python3} setup.py \ | |
56 | build -b build-3 | |
57 | %endif | |
008761e8 JP |
58 | |
59 | %install | |
60 | rm -rf $RPM_BUILD_ROOT | |
a32f3f91 AF |
61 | %if %{with python2} |
62 | %{__python} -- setup.py \ | |
63 | build -b build-2 \ | |
64 | install \ | |
65 | --root=$RPM_BUILD_ROOT \ | |
66 | --optimize=2 | |
008761e8 | 67 | |
a32f3f91 | 68 | # shutup check-files |
008761e8 | 69 | %py_postclean |
a32f3f91 AF |
70 | %endif |
71 | ||
72 | %if %{with python3} | |
73 | %{__python3} -- setup.py \ | |
74 | build -b build-3 \ | |
75 | install \ | |
76 | --root=$RPM_BUILD_ROOT \ | |
77 | --optimize=2 | |
78 | ||
79 | # shutup check-files | |
80 | %py3_postclean | |
81 | %endif | |
008761e8 JP |
82 | |
83 | %clean | |
84 | rm -rf $RPM_BUILD_ROOT | |
85 | ||
a32f3f91 | 86 | %if %{with python2} |
008761e8 JP |
87 | %files |
88 | %defattr(644,root,root,755) | |
89 | %doc README | |
90 | %dir %{py_sitescriptdir}/mockito | |
91 | %{py_sitescriptdir}/mockito/*.py[co] | |
92 | %dir %{py_sitescriptdir}/mockito_test | |
93 | %{py_sitescriptdir}/mockito_test/*.py[co] | |
94 | %dir %{py_sitescriptdir}/mockito_util | |
95 | %{py_sitescriptdir}/mockito_util/*.py[co] | |
96 | %if "%{py_ver}" > "2.4" | |
97 | %{py_sitescriptdir}/mockito-*.egg-info | |
98 | %endif | |
a32f3f91 AF |
99 | %endif |
100 | ||
101 | %if %{with python3} | |
102 | %files -n python3-%{module} | |
103 | %defattr(644,root,root,755) | |
104 | %dir %{py3_sitescriptdir}/mockito | |
105 | %{py3_sitescriptdir}/mockito/*.py[co] | |
106 | %dir %{py3_sitescriptdir}/mockito_test | |
107 | %{py3_sitescriptdir}/mockito_test/*.py[co] | |
108 | %dir %{py3_sitescriptdir}/mockito_util | |
109 | %{py3_sitescriptdir}/mockito_util/*.py[co] | |
110 | %{py3_sitescriptdir}/mockito-*.egg-info | |
111 | %endif |