]>
Commit | Line | Data |
---|---|---|
ef9212ce | 1 | # |
8d099eee | 2 | # Conditional build: |
27c2bafe | 3 | %bcond_without tests # do not perform "make test" |
ef9212ce JB |
4 | %bcond_without python2 # CPython 2.x module |
5 | %bcond_without python3 # CPython 3.x module | |
27c2bafe | 6 | %bcond_without bundled # Bundle Libraries |
8d099eee | 7 | # |
8ba13116 | 8 | %define module requests |
ef9212ce JB |
9 | Summary: HTTP library for Python 2 |
10 | Summary(pl.UTF-8): Biblioteka HTTP dla Pythona 2 | |
8ba13116 | 11 | Name: python-%{module} |
27c2bafe AM |
12 | Version: 2.5.0 |
13 | Release: 1 | |
a8d01621 | 14 | License: Apache2 |
8ba13116 | 15 | Group: Development/Languages/Python |
a8d01621 | 16 | Source0: https://pypi.python.org/packages/source/r/requests/%{module}-%{version}.tar.gz |
27c2bafe | 17 | # Source0-md5: b8bf3ddca75e7ecf1b6776da1e6e3385 |
a8d01621 | 18 | URL: http://python-requests.org |
27c2bafe | 19 | # find . -name '*.py' -exec sed -i -e 's#requests\.packages\.urllib3#urllib3#g' "{}" ";" |
6b8cdf9f AM |
20 | # find . -name '*.py' -exec sed -i -e 's#\.packages\.urllib3#urllib3#g' "{}" ";" |
21 | # find . -name '*.py' -exec sed -i -e 's#from \.packages import chardet#import charade as chardet#g' "{}" ";" | |
22 | # + manual removal from setup.py | |
4a7ef446 ŁK |
23 | Patch0: system-charade-and-urllib3.patch |
24 | Patch1: system-cert.patch | |
a8d01621 ŁK |
25 | %if %{with python2} |
26 | BuildRequires: python-modules >= 1:2.6 | |
27c2bafe AM |
27 | %if %{without bundled} |
28 | BuildRequires: python-charade | |
9e57f9c2 | 29 | BuildRequires: python-urllib3 >= 1.9.1 |
a8d01621 | 30 | %endif |
27c2bafe | 31 | %endif |
a8d01621 | 32 | %if %{with python3} |
ef9212ce | 33 | BuildRequires: python3-modules >= 1:3.2 |
27c2bafe AM |
34 | %if %{without bundled} |
35 | BuildRequires: python3-charade | |
9e57f9c2 | 36 | BuildRequires: python3-urllib3 >= 1.9.1 |
a8d01621 | 37 | %endif |
27c2bafe | 38 | %endif |
8ba13116 MM |
39 | BuildRequires: rpm-pythonprov |
40 | BuildRequires: rpmbuild(macros) >= 1.219 | |
4a7ef446 | 41 | Requires: ca-certificates |
a8d01621 | 42 | Requires: python-modules >= 1:2.6 |
27c2bafe AM |
43 | %if %{without bundled} |
44 | Requires: python-charade | |
9e57f9c2 | 45 | Requires: python-urllib3 >= 1.9.1 |
27c2bafe | 46 | %endif |
e7d50ac0 AM |
47 | # for python2 only to get SNI working. python3 doesn't need this |
48 | Requires: python-ndg-httpsclient | |
49 | Requires: python-pyasn1 | |
50 | Requires: python-pyOpenSSL | |
8ba13116 MM |
51 | BuildArch: noarch |
52 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
53 | ||
54 | %description | |
a8d01621 | 55 | Requests is a HTTP library, written in Python, for human beings. |
8ba13116 MM |
56 | |
57 | Most existing Python modules for sending HTTP requests are extremely | |
58 | verbose and cumbersome. Python's builtin urllib2 module provides most | |
8d099eee | 59 | of the HTTP capabilities you should need, but the API is thoroughly |
8ba13116 | 60 | broken. It requires an enormous amount of work (even method overrides) |
8d099eee JB |
61 | to perform the simplest of tasks. Things shouldn't be this way. Not in |
62 | Python. | |
63 | ||
ef9212ce JB |
64 | This package contains Python 2.x module. |
65 | ||
8d099eee | 66 | %description -l pl.UTF-8 |
a8d01621 | 67 | Requests to napisana w Pythonie biblioteka HTTP dla ludzi. |
8ba13116 | 68 | |
8d099eee JB |
69 | Większość istniejących modułów Pythona do wysyłania żądań HTTP jest |
70 | zbyt gadatliwa i nieporęczna. Wbudowany w Pythona moduł urllib2 | |
71 | zapewnia większość wymaganych możliwości HTTP, ale API jest kiepskie - | |
72 | wymaga dużych nakładów pracy (nawet nadpisań metod) do wykonania | |
73 | najprostszych zadań. Nie powinno tak być. Nie w Pythonie. | |
8ba13116 | 74 | |
ef9212ce JB |
75 | Ten pakiet zawiera moduł dla Pythona 2.x. |
76 | ||
a0c91a8e | 77 | %package -n python3-requests |
ef9212ce JB |
78 | Summary: HTTP library for Python 3 |
79 | Summary(pl.UTF-8): Biblioteka HTTP dla Pythona 3 | |
a0c91a8e | 80 | Group: Development/Languages/Python |
4a7ef446 | 81 | Requires: ca-certificates |
ef9212ce | 82 | Requires: python3-modules >= 1:3.2 |
27c2bafe AM |
83 | %if %{without bundled} |
84 | Requires: python3-charade | |
9e57f9c2 | 85 | Requires: python3-urllib3 >= 1.9.1 |
27c2bafe | 86 | %endif |
a0c91a8e KK |
87 | |
88 | %description -n python3-requests | |
a8d01621 | 89 | Requests is a HTTP library, written in Python, for human beings. |
a0c91a8e KK |
90 | |
91 | Most existing Python modules for sending HTTP requests are extremely | |
92 | verbose and cumbersome. Python's builtin urllib2 module provides most | |
93 | of the HTTP capabilities you should need, but the api is thoroughly | |
94 | broken. It requires an enormous amount of work (even method overrides) | |
8d099eee JB |
95 | to perform the simplest of tasks. Things shouldn't be this way. Not in |
96 | Python. | |
97 | ||
ef9212ce JB |
98 | This package contains Python 3.x module. |
99 | ||
8d099eee | 100 | %description -n python3-requests -l pl.UTF-8 |
a8d01621 | 101 | Requests to napisana w Pythonie biblioteka HTTP dla ludzi. |
a0c91a8e | 102 | |
a8d01621 ŁK |
103 | Większość istniejących modułów Pythona do wysyłania żądań HTTP jest |
104 | zbyt gadatliwa i nieporęczna. Wbudowany w Pythona moduł urllib2 | |
105 | zapewnia większość wymaganych możliwości HTTP, ale API jest kiepskie - | |
106 | wymaga dużych nakładów pracy (nawet nadpisań metod) do wykonania | |
107 | najprostszych zadań. Nie powinno tak być. Nie w Pythonie. | |
a0c91a8e | 108 | |
ef9212ce JB |
109 | Ten pakiet zawiera moduł dla Pythona 3.x. |
110 | ||
8ba13116 | 111 | %prep |
a8d01621 | 112 | %setup -q -n %{module}-%{version} |
27c2bafe | 113 | %{!?with_bundled:%patch0 -p1} |
4a7ef446 | 114 | %patch1 -p1 |
e16ab944 | 115 | |
8ba13116 | 116 | %build |
a8d01621 | 117 | %if %{with python2} |
27c2bafe | 118 | %{__python} setup.py build -b py2 %{?with_tests:test} |
a8d01621 | 119 | %endif |
a0c91a8e | 120 | |
a8d01621 | 121 | %if %{with python3} |
27c2bafe | 122 | %{__python3} setup.py build -b py3 %{?with_tests:test} |
8d099eee | 123 | %endif |
8ba13116 MM |
124 | |
125 | %install | |
126 | rm -rf $RPM_BUILD_ROOT | |
a8d01621 ŁK |
127 | |
128 | %if %{with python2} | |
a0c91a8e | 129 | %{__python} setup.py \ |
a8d01621 ŁK |
130 | build -b py2 \ |
131 | install \ | |
8ba13116 MM |
132 | --skip-build \ |
133 | --optimize=2 \ | |
134 | --root=$RPM_BUILD_ROOT | |
4a7ef446 ŁK |
135 | %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} |
136 | %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
a8d01621 ŁK |
137 | %py_postclean |
138 | %endif | |
8ba13116 | 139 | |
a8d01621 | 140 | %if %{with python3} |
a0c91a8e | 141 | %{__python3} setup.py \ |
a8d01621 ŁK |
142 | build -b py3 \ |
143 | install \ | |
144 | --skip-build \ | |
145 | --optimize=2 \ | |
146 | --root=$RPM_BUILD_ROOT | |
147 | %endif | |
8ba13116 | 148 | |
27c2bafe AM |
149 | %{__rm} -rf $RPM_BUILD_ROOT{%{py_sitescriptdir},%{py3_sitescriptdir}}/%{module}/cacert.pem |
150 | %{!?with_bundled:%{__rm} -rf $RPM_BUILD_ROOT{%{py_sitescriptdir},%{py3_sitescriptdir}}/%{module}/packages} | |
4a7ef446 | 151 | |
8ba13116 MM |
152 | %clean |
153 | rm -rf $RPM_BUILD_ROOT | |
154 | ||
a8d01621 | 155 | %if %{with python2} |
8ba13116 MM |
156 | %files |
157 | %defattr(644,root,root,755) | |
a8d01621 | 158 | %doc HISTORY.rst README.rst |
8ba13116 | 159 | %{py_sitescriptdir}/%{module} |
8d099eee | 160 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info |
a8d01621 | 161 | %endif |
a0c91a8e | 162 | |
a8d01621 | 163 | %if %{with python3} |
a0c91a8e KK |
164 | %files -n python3-requests |
165 | %defattr(644,root,root,755) | |
a8d01621 | 166 | %doc HISTORY.rst README.rst |
a0c91a8e | 167 | %{py3_sitescriptdir}/%{module} |
8d099eee | 168 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info |
a8d01621 | 169 | %endif |