]>
Commit | Line | Data |
---|---|---|
8ce4c2e0 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # don't build doc | |
4 | %bcond_without tests # do not perform "make test" | |
5 | %bcond_without python2 # CPython 2.x module | |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | Summary: Make mock available as unittest.mock regardless of Python version | |
9 | Summary(pl.UTF-8): Udostępnienie modułu mock jako unittest.mock niezależnie od wersji Pythona | |
10 | Name: python-backports.unittest_mock | |
11 | Version: 1.1.1 | |
12 | Release: 1 | |
13 | License: MIT | |
14 | Group: Libraries/Python | |
15 | #Source0Download: https://pypi.python.org/pypi/backports.unittest_mock | |
16 | Source0: https://pypi.python.org/packages/source/b/backports.unittest_mock/backports.unittest_mock-%{version}.tar.gz | |
17 | # Source0-md5: 6ee907f7d8e35df16a06268e65d28e5f | |
18 | URL: https://pypi.python.org/pypi/backports.unittest_mock | |
19 | BuildRequires: rpm-pythonprov | |
20 | BuildRequires: rpmbuild(macros) >= 1.714 | |
21 | %if %{with python2} | |
22 | BuildRequires: python-mock | |
23 | BuildRequires: python-modules >= 1:2.7 | |
24 | %if %{with tests} | |
25 | BuildRequires: python-pytest >= 2.8 | |
26 | BuildRequires: python-pytest-runner | |
27 | %endif | |
28 | BuildRequires: python-setuptools | |
29 | BuildRequires: python-setuptools_scm >= 1.9 | |
30 | %endif | |
31 | %if %{with python3} | |
32 | BuildRequires: python3-modules >= 1:3.3 | |
33 | %if %{with tests} | |
34 | BuildRequires: python3-pytest >= 2.8 | |
35 | BuildRequires: python3-pytest-runner | |
36 | %endif | |
37 | BuildRequires: python3-setuptools | |
38 | BuildRequires: python3-setuptools_scm >= 1.9 | |
1658328e | 39 | BuildRequires: sed >= 4.0 |
8ce4c2e0 | 40 | %endif |
1658328e | 41 | Requires: python-mock |
8ce4c2e0 JB |
42 | Requires: python-modules >= 1:2.7 |
43 | BuildArch: noarch | |
44 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
45 | ||
46 | %description | |
47 | This module provides a function "install()" which makes the "mock" | |
48 | module available as "unittest.mock" on Python 3.2 and earlier. | |
49 | ||
50 | Also advertises a pytest plugin which configures unittest.mock | |
51 | automatically. | |
52 | ||
53 | %description -l pl.UTF-8 | |
54 | Ten moduł udostępnia funkcję "install()", czyniącą moduł "mock" | |
55 | dostępny jako "unittest.mock" w Pythonie 3.2 i wcześniejszym. | |
56 | ||
57 | Udostępnia także wtyczkę pytest automatycznie konfigurującą | |
58 | unittest.mock. | |
59 | ||
60 | %package -n python3-backports.unittest_mock | |
61 | Summary: Make mock available as unittest.mock regardless of Python version | |
62 | Summary(pl.UTF-8): Udostępnienie modułu mock jako unittest.mock niezależnie od wersji Pythona | |
63 | Group: Libraries/Python | |
64 | Requires: python3-modules >= 1:3.3 | |
65 | ||
66 | %description -n python3-backports.unittest_mock | |
67 | This module provides a function "install()" which makes the "mock" | |
68 | module available as "unittest.mock" on Python 3.2 and earlier. | |
69 | ||
70 | Also advertises a pytest plugin which configures unittest.mock | |
71 | automatically. | |
72 | ||
73 | %description -n python3-backports.unittest_mock -l pl.UTF-8 | |
74 | Ten moduł udostępnia funkcję "install()", czyniącą moduł "mock" | |
75 | dostępny jako "unittest.mock" w Pythonie 3.2 i wcześniejszym. | |
76 | ||
77 | Udostępnia także wtyczkę pytest automatycznie konfigurującą | |
78 | unittest.mock. | |
79 | ||
80 | %package apidocs | |
81 | Summary: API documentation for backports.unittest_mock | |
82 | Summary(pl.UTF-8): Dokumentacja API modułu backports.unittest_mock | |
83 | Group: Documentation | |
84 | ||
85 | %description apidocs | |
86 | API documentation for backports.unittest_mock. | |
87 | ||
88 | %description apidocs -l pl.UTF-8 | |
89 | Dokumentacja API modułu backports.unittest_mock. | |
90 | ||
91 | %prep | |
92 | %setup -q -n backports.unittest_mock-%{version} | |
93 | ||
94 | %build | |
95 | %if %{with python2} | |
96 | %py_build %{?with_tests:test} | |
97 | %endif | |
98 | ||
99 | %if %{with python3} | |
100 | %py3_build %{?with_tests:test} | |
101 | %endif | |
102 | ||
103 | %if %{with doc} | |
104 | cd docs | |
105 | sphinx-build -b html . html | |
106 | %{__rm} -r html/_sources | |
107 | %endif | |
108 | ||
109 | %install | |
110 | rm -rf $RPM_BUILD_ROOT | |
111 | ||
112 | %if %{with python2} | |
113 | %py_install | |
114 | ||
115 | %py_postclean | |
116 | %endif | |
117 | ||
118 | %if %{with python3} | |
119 | %py3_install | |
1658328e JB |
120 | |
121 | # pythonegg dependency generator resolves dependencies using python version running | |
122 | # the generator; avoid unwanted python3egg(mock) dependency | |
123 | %{__sed} -i '/^\[:python_version=="2\.7"\]$/,/^mock$/ d' $RPM_BUILD_ROOT%{py3_sitescriptdir}/backports.unittest_mock-%{version}-py*.egg-info/requires.txt | |
8ce4c2e0 JB |
124 | %endif |
125 | ||
126 | %clean | |
127 | rm -rf $RPM_BUILD_ROOT | |
128 | ||
129 | %if %{with python2} | |
130 | %files | |
131 | %defattr(644,root,root,755) | |
132 | %doc CHANGES.rst README.rst | |
133 | %dir %{py_sitescriptdir}/backports | |
134 | %{py_sitescriptdir}/backports/unittest_mock | |
135 | %{py_sitescriptdir}/backports.unittest_mock-%{version}-py*-nspkg.pth | |
136 | %{py_sitescriptdir}/backports.unittest_mock-%{version}-py*.egg-info | |
137 | %endif | |
138 | ||
139 | %if %{with python3} | |
140 | %files -n python3-backports.unittest_mock | |
141 | %defattr(644,root,root,755) | |
142 | %doc CHANGES.rst README.rst | |
143 | %dir %{py3_sitescriptdir}/backports | |
144 | %{py3_sitescriptdir}/backports/unittest_mock | |
145 | %{py3_sitescriptdir}/backports.unittest_mock-%{version}-py*-nspkg.pth | |
146 | %{py3_sitescriptdir}/backports.unittest_mock-%{version}-py*.egg-info | |
147 | %endif | |
148 | ||
149 | %if %{with doc} | |
150 | %files apidocs | |
151 | %defattr(644,root,root,755) | |
152 | %doc docs/html/* | |
153 | %endif |