]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_with tests # pytest tests (one test fails with pytest-httpbin 1.0.0) | |
4 | %bcond_without python2 # CPython 2.x module | |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
7 | %define urllib3_ver 1.21.1 | |
8 | %define module requests | |
9 | %define egg_name requests | |
10 | Summary: HTTP library for Python 2 | |
11 | Summary(pl.UTF-8): Biblioteka HTTP dla Pythona 2 | |
12 | Name: python-%{module} | |
13 | # keep 2.27.x here for python2 support | |
14 | Version: 2.27.1 | |
15 | Release: 1 | |
16 | License: Apache v2.0 | |
17 | Group: Development/Languages/Python | |
18 | #Source0Download: https://pypi.org/simple/requests/ | |
19 | Source0: https://files.pythonhosted.org/packages/source/r/requests/%{module}-%{version}.tar.gz | |
20 | # Source0-md5: bcc01b73974a305cc7c5b092e7d07004 | |
21 | Patch0: system-cert.patch | |
22 | Patch1: %{name}-reqs.patch | |
23 | Patch2: %{name}-disable-xdist.patch | |
24 | URL: https://docs.python-requests.org/ | |
25 | BuildRequires: rpm-pythonprov | |
26 | BuildRequires: rpmbuild(macros) >= 1.713 | |
27 | %if %{with python2} | |
28 | BuildRequires: python-modules >= 1:2.7 | |
29 | BuildRequires: python-setuptools | |
30 | %if %{with tests} | |
31 | BuildRequires: python-PySocks >= 1.5.8 | |
32 | BuildRequires: python-certifi >= 2017.4.17 | |
33 | BuildRequires: python-chardet >= 3.0.2 | |
34 | BuildRequires: python-chardet < 5 | |
35 | # idna 3 not supported for python2 | |
36 | BuildRequires: python-idna >= 2.5 | |
37 | BuildRequires: python-idna < 3 | |
38 | BuildRequires: python-pytest >= 3 | |
39 | BuildRequires: python-pytest-cov | |
40 | BuildRequires: python-pytest-httpbin >= 0.0.7 | |
41 | BuildRequires: python-pytest-mock >= 2.0.0 | |
42 | BuildRequires: python-pytest-xdist | |
43 | BuildRequires: python-urllib3 >= %{urllib3_ver} | |
44 | BuildRequires: python-urllib3 < 1.27 | |
45 | %endif | |
46 | %endif | |
47 | %if %{with python3} | |
48 | BuildRequires: python3-modules >= 1:3.6 | |
49 | BuildRequires: python3-setuptools | |
50 | %if %{with tests} | |
51 | BuildRequires: python3-PySocks >= 1.5.8 | |
52 | BuildRequires: python3-certifi >= 2017.4.17 | |
53 | BuildRequires: python3-charset_normalizer >= 2 | |
54 | BuildRequires: python3-charset_normalizer < 2.1 | |
55 | BuildRequires: python3-idna >= 2.5 | |
56 | BuildRequires: python3-idna < 4 | |
57 | BuildRequires: python3-pytest >= 3 | |
58 | BuildRequires: python3-pytest-cov | |
59 | BuildRequires: python3-pytest-httpbin >= 0.0.7 | |
60 | BuildRequires: python3-pytest-mock >= 2.0.0 | |
61 | BuildRequires: python3-pytest-xdist | |
62 | BuildRequires: python3-urllib3 >= %{urllib3_ver} | |
63 | BuildRequires: python3-urllib3 < 1.27 | |
64 | %endif | |
65 | %endif | |
66 | Suggests: ca-certificates | |
67 | # for python2 only to get SNI working. python3 doesn't need this | |
68 | Requires: python-cryptography >= 1.3.4 | |
69 | Requires: python-pyOpenSSL >= 0.14 | |
70 | Requires: python-urllib3 >= 1.22-2 | |
71 | BuildArch: noarch | |
72 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
73 | ||
74 | %description | |
75 | Requests is a HTTP library, written in Python, for human beings. | |
76 | ||
77 | Most existing Python modules for sending HTTP requests are extremely | |
78 | verbose and cumbersome. Python's builtin urllib2 module provides most | |
79 | of the HTTP capabilities you should need, but the API is thoroughly | |
80 | broken. It requires an enormous amount of work (even method overrides) | |
81 | to perform the simplest of tasks. Things shouldn't be this way. Not in | |
82 | Python. | |
83 | ||
84 | This package contains Python 2.x module. | |
85 | ||
86 | %description -l pl.UTF-8 | |
87 | Requests to napisana w Pythonie biblioteka HTTP dla ludzi. | |
88 | ||
89 | Większość istniejących modułów Pythona do wysyłania żądań HTTP jest | |
90 | zbyt gadatliwa i nieporęczna. Wbudowany w Pythona moduł urllib2 | |
91 | zapewnia większość wymaganych możliwości HTTP, ale API jest kiepskie - | |
92 | wymaga dużych nakładów pracy (nawet nadpisań metod) do wykonania | |
93 | najprostszych zadań. Nie powinno tak być. Nie w Pythonie. | |
94 | ||
95 | Ten pakiet zawiera moduł dla Pythona 2.x. | |
96 | ||
97 | %package -n python3-requests | |
98 | Summary: HTTP library for Python 3 | |
99 | Summary(pl.UTF-8): Biblioteka HTTP dla Pythona 3 | |
100 | Group: Development/Languages/Python | |
101 | Requires: python3-modules >= 1:3.6 | |
102 | Requires: python3-charset_normalizer >= 2 | |
103 | # for https | |
104 | Requires: python3-cryptography >= 1.3.4 | |
105 | Requires: python3-idna >= 2.5 | |
106 | Requires: python3-pyOpenSSL >= 0.14 | |
107 | Requires: python3-urllib3 >= 1.22-2 | |
108 | Suggests: ca-certificates | |
109 | ||
110 | %description -n python3-requests | |
111 | Requests is a HTTP library, written in Python, for human beings. | |
112 | ||
113 | Most existing Python modules for sending HTTP requests are extremely | |
114 | verbose and cumbersome. Python's builtin urllib2 module provides most | |
115 | of the HTTP capabilities you should need, but the api is thoroughly | |
116 | broken. It requires an enormous amount of work (even method overrides) | |
117 | to perform the simplest of tasks. Things shouldn't be this way. Not in | |
118 | Python. | |
119 | ||
120 | This package contains Python 3.x module. | |
121 | ||
122 | %description -n python3-requests -l pl.UTF-8 | |
123 | Requests to napisana w Pythonie biblioteka HTTP dla ludzi. | |
124 | ||
125 | Większość istniejących modułów Pythona do wysyłania żądań HTTP jest | |
126 | zbyt gadatliwa i nieporęczna. Wbudowany w Pythona moduł urllib2 | |
127 | zapewnia większość wymaganych możliwości HTTP, ale API jest kiepskie - | |
128 | wymaga dużych nakładów pracy (nawet nadpisań metod) do wykonania | |
129 | najprostszych zadań. Nie powinno tak być. Nie w Pythonie. | |
130 | ||
131 | Ten pakiet zawiera moduł dla Pythona 3.x. | |
132 | ||
133 | %prep | |
134 | %setup -q -n %{module}-%{version} | |
135 | %patch0 -p1 | |
136 | %patch1 -p1 | |
137 | %patch2 -p1 | |
138 | ||
139 | %build | |
140 | %if %{with python2} | |
141 | %py_build | |
142 | ||
143 | %if %{with tests} | |
144 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
145 | PYTEST_PLUGINS="pytest_httpbin.plugin,pytest_mock" \ | |
146 | %{__python} -m pytest tests | |
147 | %endif | |
148 | %endif | |
149 | ||
150 | %if %{with python3} | |
151 | %py3_build | |
152 | ||
153 | %if %{with tests} | |
154 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
155 | PYTEST_PLUGINS="pytest_httpbin.plugin,pytest_mock" \ | |
156 | %{__python3} -m pytest tests | |
157 | %endif | |
158 | %endif | |
159 | ||
160 | %install | |
161 | rm -rf $RPM_BUILD_ROOT | |
162 | ||
163 | %if %{with python2} | |
164 | %py_install | |
165 | ||
166 | %py_postclean | |
167 | %endif | |
168 | ||
169 | %if %{with python3} | |
170 | %py3_install | |
171 | %endif | |
172 | ||
173 | %clean | |
174 | rm -rf $RPM_BUILD_ROOT | |
175 | ||
176 | %if %{with python2} | |
177 | %files | |
178 | %defattr(644,root,root,755) | |
179 | %doc HISTORY.md README.md | |
180 | %{py_sitescriptdir}/%{module} | |
181 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
182 | %endif | |
183 | ||
184 | %if %{with python3} | |
185 | %files -n python3-requests | |
186 | %defattr(644,root,root,755) | |
187 | %doc HISTORY.md README.md | |
188 | %{py3_sitescriptdir}/%{module} | |
189 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
190 | %endif |