]>
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 | |
13 | Release: 1 | |
14 | License: Apache | |
15 | Group: Libraries/Python | |
16 | Source0: https://pypi.python.org/packages/8d/cb/1267d7294d97e9a3ef24bf1370791da4d2dc6abc0f67626f38f4bf25dfa3/%{pypi_name}-%{version}.tar.gz | |
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 | |
23 | BuildRequires: python-setuptools | |
24 | %endif | |
25 | %if %{with python3} | |
26 | BuildRequires: python3-modules | |
27 | BuildRequires: python3-setuptools | |
28 | %endif | |
29 | Requires: python-requests | |
30 | BuildArch: noarch | |
31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
32 | ||
33 | %description | |
34 | requests-mock provides a building block to stub out the HTTP requests | |
35 | portions of your testing code. | |
36 | ||
37 | %package -n python3-%{module} | |
38 | Summary: Mock out responses from the requests package | |
39 | Group: Libraries/Python | |
40 | Requires: python3-modules | |
41 | ||
42 | %description -n python3-%{module} | |
43 | requests-mock provides a building block to stub out the HTTP requests | |
44 | portions of your testing code. | |
45 | ||
46 | %prep | |
47 | %setup -q -n %{pypi_name}-%{version} | |
48 | ||
49 | %build | |
50 | %if %{with python2} | |
51 | %py_build %{?with_tests:test} | |
52 | %endif | |
53 | ||
54 | %if %{with python3} | |
55 | %py3_build %{?with_tests:test} | |
56 | %endif | |
57 | ||
58 | %install | |
59 | rm -rf $RPM_BUILD_ROOT | |
60 | ||
61 | %if %{with python2} | |
62 | %py_install | |
63 | ||
64 | %py_postclean | |
65 | %endif | |
66 | ||
67 | %if %{with python3} | |
68 | %py3_install | |
69 | %endif | |
70 | ||
71 | %clean | |
72 | rm -rf $RPM_BUILD_ROOT | |
73 | ||
74 | %if %{with python2} | |
75 | %files | |
76 | %defattr(644,root,root,755) | |
77 | %doc AUTHORS ChangeLog README.rst *.txt | |
78 | %{py_sitescriptdir}/%{module} | |
79 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
80 | %endif | |
81 | ||
82 | %if %{with python3} | |
83 | %files -n python3-%{module} | |
84 | %defattr(644,root,root,755) | |
85 | %doc AUTHORS ChangeLog README.rst *.txt | |
86 | %{py3_sitescriptdir}/%{module} | |
87 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
88 | %endif |