]>
Commit | Line | Data |
---|---|---|
969fefd6 | 1 | # |
969fefd6 | 2 | # Conditional build: |
4eaa4b3c JB |
3 | %bcond_without doc # API documentation |
4 | %bcond_without tests # unit tests | |
969fefd6 JK |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
969fefd6 JK |
8 | %define module requests_mock |
9 | %define egg_name %{module} | |
10 | %define pypi_name requests-mock | |
11 | Summary: Mock out responses from the requests package | |
4eaa4b3c | 12 | Summary(pl.UTF-8): Podstawianie atrap odpowiedzi z pakietu requests |
969fefd6 | 13 | Name: python-%{pypi_name} |
4eaa4b3c | 14 | Version: 1.8.0 |
aeb5d8b2 | 15 | Release: 3 |
4eaa4b3c | 16 | License: Apache v2.0 |
969fefd6 | 17 | Group: Libraries/Python |
4eaa4b3c JB |
18 | #Source0Download: https://pypi.org/simple/requests-mock/ |
19 | Source0: https://files.pythonhosted.org/packages/source/r/requests-mock/%{pypi_name}-%{version}.tar.gz | |
20 | # Source0-md5: f09403c1d05ae2d3a72cac6aeb74c40d | |
21 | Patch0: %{name}-mock.patch | |
22 | Patch1: %{name}-no-git.patch | |
23 | URL: https://requests-mock.readthedocs.io/ | |
969fefd6 JK |
24 | BuildRequires: rpm-pythonprov |
25 | BuildRequires: rpmbuild(macros) >= 1.714 | |
26 | %if %{with python2} | |
27 | BuildRequires: python-modules | |
0e3e6bf4 | 28 | BuildRequires: python-pbr |
969fefd6 | 29 | BuildRequires: python-setuptools |
4eaa4b3c JB |
30 | %if %{with tests} |
31 | BuildRequires: python-fixtures | |
32 | BuildRequires: python-mock | |
33 | BuildRequires: python-purl | |
34 | BuildRequires: python-pytest | |
35 | BuildRequires: python-requests >= 2.3 | |
36 | BuildRequires: python-six | |
ade0efbe | 37 | BuildRequires: python-subunit |
4eaa4b3c JB |
38 | BuildRequires: python-testrepository >= 0.0.18 |
39 | BuildRequires: python-testtools | |
ade0efbe | 40 | BuildRequires: subunit-python2 |
4eaa4b3c | 41 | %endif |
969fefd6 JK |
42 | %endif |
43 | %if %{with python3} | |
44 | BuildRequires: python3-modules | |
0e3e6bf4 | 45 | BuildRequires: python3-pbr |
969fefd6 | 46 | BuildRequires: python3-setuptools |
4eaa4b3c JB |
47 | %if %{with tests} |
48 | BuildRequires: python3-fixtures | |
49 | BuildRequires: python3-purl | |
50 | BuildRequires: python3-pytest | |
51 | BuildRequires: python3-requests >= 2.3 | |
52 | BuildRequires: python3-six | |
ade0efbe | 53 | BuildRequires: python3-subunit |
4eaa4b3c JB |
54 | BuildRequires: python3-testrepository >= 0.0.18 |
55 | BuildRequires: python3-testtools | |
ade0efbe | 56 | BuildRequires: subunit-python3 |
4eaa4b3c JB |
57 | %endif |
58 | %endif | |
59 | %if %{with doc} | |
60 | BuildRequires: python3-reno | |
61 | BuildRequires: sphinx-pdg-3 | |
969fefd6 | 62 | %endif |
969fefd6 JK |
63 | BuildArch: noarch |
64 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
65 | ||
66 | %description | |
67 | requests-mock provides a building block to stub out the HTTP requests | |
68 | portions of your testing code. | |
69 | ||
4eaa4b3c JB |
70 | %description -l pl.UTF-8 |
71 | Pakiet requests-mock udostępnia blok do tworzenia zaślepek żądań HTTP | |
72 | w kodzie testowym. | |
73 | ||
233cb9ed | 74 | %package -n python3-%{pypi_name} |
969fefd6 | 75 | Summary: Mock out responses from the requests package |
4eaa4b3c | 76 | Summary(pl.UTF-8): Podstawianie atrap odpowiedzi z pakietu requests |
969fefd6 JK |
77 | Group: Libraries/Python |
78 | Requires: python3-modules | |
79 | ||
233cb9ed | 80 | %description -n python3-%{pypi_name} |
969fefd6 JK |
81 | requests-mock provides a building block to stub out the HTTP requests |
82 | portions of your testing code. | |
83 | ||
4eaa4b3c JB |
84 | %description -n python3-%{pypi_name} -l pl.UTF-8 |
85 | Pakiet requests-mock udostępnia blok do tworzenia zaślepek żądań HTTP | |
86 | w kodzie testowym. | |
87 | ||
88 | %package apidocs | |
89 | Summary: API documentation for requests_mock module | |
90 | Summary(pl.UTF-8): Dokumentacja API modułu requests_mock | |
91 | Group: Documentation | |
92 | ||
93 | %description apidocs | |
94 | API documentation for requests_mock module. | |
95 | ||
96 | %description apidocs -l pl.UTF-8 | |
97 | Dokumentacja API modułu requests_mock. | |
98 | ||
969fefd6 JK |
99 | %prep |
100 | %setup -q -n %{pypi_name}-%{version} | |
4eaa4b3c JB |
101 | %patch0 -p1 |
102 | %patch1 -p1 | |
969fefd6 JK |
103 | |
104 | %build | |
105 | %if %{with python2} | |
4eaa4b3c JB |
106 | %py_build |
107 | ||
108 | %if %{with tests} | |
109 | PYTHONPATH=$(pwd) \ | |
110 | %{__python} -m pytest tests/pytest | |
111 | ||
112 | %{__python} -m subunit.run discover | subunit2pyunit-2 | |
113 | %endif | |
969fefd6 JK |
114 | %endif |
115 | ||
116 | %if %{with python3} | |
4eaa4b3c JB |
117 | %py3_build |
118 | ||
119 | %if %{with tests} | |
120 | PYTHONPATH=$(pwd) \ | |
121 | %{__python3} -m pytest tests/pytest | |
122 | ||
123 | %{__python3} -m subunit.run discover | subunit2pyunit-3 | |
124 | %endif | |
969fefd6 JK |
125 | %endif |
126 | ||
127 | %install | |
128 | rm -rf $RPM_BUILD_ROOT | |
129 | ||
130 | %if %{with python2} | |
131 | %py_install | |
132 | ||
133 | %py_postclean | |
134 | %endif | |
135 | ||
136 | %if %{with python3} | |
137 | %py3_install | |
138 | %endif | |
139 | ||
4eaa4b3c JB |
140 | %if %{with doc} |
141 | #%{__make} -C doc html \ | |
142 | # SPHINXBUILD=sphinx-build-3 | |
143 | # broken Makefile (specifies . instead of "source" as source dir), so invoke directly: | |
144 | PYTHONPATH=$(pwd) \ | |
145 | sphinx-build-3 -b html doc/source doc/_build/html | |
146 | %endif | |
147 | ||
969fefd6 JK |
148 | %clean |
149 | rm -rf $RPM_BUILD_ROOT | |
150 | ||
151 | %if %{with python2} | |
152 | %files | |
153 | %defattr(644,root,root,755) | |
4eaa4b3c | 154 | %doc AUTHORS ChangeLog README.rst |
969fefd6 JK |
155 | %{py_sitescriptdir}/%{module} |
156 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
157 | %endif | |
158 | ||
159 | %if %{with python3} | |
233cb9ed | 160 | %files -n python3-%{pypi_name} |
969fefd6 | 161 | %defattr(644,root,root,755) |
4eaa4b3c | 162 | %doc AUTHORS ChangeLog README.rst |
969fefd6 JK |
163 | %{py3_sitescriptdir}/%{module} |
164 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
165 | %endif | |
4eaa4b3c JB |
166 | |
167 | %if %{with doc} | |
168 | %files apidocs | |
169 | %defattr(644,root,root,755) | |
170 | %doc doc/_build/html/{_static,*.html,*.js} | |
171 | %endif |