]>
Commit | Line | Data |
---|---|---|
969fefd6 | 1 | # |
969fefd6 JK |
2 | # Conditional build: |
3 | %bcond_with tests # do not perform "make test" | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
969fefd6 JK |
7 | %define module requests_mock |
8 | %define egg_name %{module} | |
9 | %define pypi_name requests-mock | |
10 | Summary: Mock out responses from the requests package | |
11 | Name: python-%{pypi_name} | |
12 | Version: 1.3.0 | |
233cb9ed | 13 | Release: 2 |
969fefd6 JK |
14 | License: Apache |
15 | Group: Libraries/Python | |
e14f920d | 16 | Source0: https://files.pythonhosted.org/packages/source/r/%{pypi_name}/%{pypi_name}-%{version}.tar.gz |
969fefd6 JK |
17 | # Source0-md5: d2efbaf16d19153b7d271628071b4d4b |
18 | URL: https://requests-mock.readthedocs.io | |
19 | BuildRequires: rpm-pythonprov | |
20 | BuildRequires: rpmbuild(macros) >= 1.714 | |
21 | %if %{with python2} | |
22 | BuildRequires: python-modules | |
0e3e6bf4 | 23 | BuildRequires: python-pbr |
969fefd6 JK |
24 | BuildRequires: python-setuptools |
25 | %endif | |
26 | %if %{with python3} | |
27 | BuildRequires: python3-modules | |
0e3e6bf4 | 28 | BuildRequires: python3-pbr |
969fefd6 JK |
29 | BuildRequires: python3-setuptools |
30 | %endif | |
31 | Requires: python-requests | |
32 | BuildArch: noarch | |
33 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
34 | ||
35 | %description | |
36 | requests-mock provides a building block to stub out the HTTP requests | |
37 | portions of your testing code. | |
38 | ||
233cb9ed | 39 | %package -n python3-%{pypi_name} |
969fefd6 JK |
40 | Summary: Mock out responses from the requests package |
41 | Group: Libraries/Python | |
42 | Requires: python3-modules | |
43 | ||
233cb9ed | 44 | %description -n python3-%{pypi_name} |
969fefd6 JK |
45 | requests-mock provides a building block to stub out the HTTP requests |
46 | portions of your testing code. | |
47 | ||
48 | %prep | |
49 | %setup -q -n %{pypi_name}-%{version} | |
50 | ||
51 | %build | |
52 | %if %{with python2} | |
53 | %py_build %{?with_tests:test} | |
54 | %endif | |
55 | ||
56 | %if %{with python3} | |
57 | %py3_build %{?with_tests:test} | |
58 | %endif | |
59 | ||
60 | %install | |
61 | rm -rf $RPM_BUILD_ROOT | |
62 | ||
63 | %if %{with python2} | |
64 | %py_install | |
65 | ||
66 | %py_postclean | |
67 | %endif | |
68 | ||
69 | %if %{with python3} | |
70 | %py3_install | |
71 | %endif | |
72 | ||
73 | %clean | |
74 | rm -rf $RPM_BUILD_ROOT | |
75 | ||
76 | %if %{with python2} | |
77 | %files | |
78 | %defattr(644,root,root,755) | |
79 | %doc AUTHORS ChangeLog README.rst *.txt | |
80 | %{py_sitescriptdir}/%{module} | |
81 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
82 | %endif | |
83 | ||
84 | %if %{with python3} | |
233cb9ed | 85 | %files -n python3-%{pypi_name} |
969fefd6 JK |
86 | %defattr(644,root,root,755) |
87 | %doc AUTHORS ChangeLog README.rst *.txt | |
88 | %{py3_sitescriptdir}/%{module} | |
89 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
90 | %endif |