]>
Commit | Line | Data |
---|---|---|
f980972e ŁK |
1 | # Conditional build: |
2 | %bcond_without python2 # build python 2 module | |
3 | %bcond_without python3 # build python 3 module | |
4 | # | |
5 | %define module urllib3 | |
6 | Summary: HTTP library with thread-safe connection pooling, file post, and more | |
7 | Name: python-%{module} | |
8 | Version: 1.6 | |
9 | Release: 1 | |
10 | License: MIT | |
11 | Group: Development/Languages/Python | |
12 | Source0: https://pypi.python.org/packages/source/u/urllib3/%{module}-%{version}.tar.gz | |
13 | # Source0-md5: 8ee95b963e151aba80de90ad1cc55487 | |
14 | URL: http://urllib3.readthedocs.org/ | |
15 | %if %{with python2} | |
16 | BuildRequires: python-modules >= 1:2.7 | |
17 | %endif | |
18 | %if %{with python3} | |
19 | BuildRequires: python3-modules >= 3.2 | |
20 | %endif | |
21 | BuildRequires: rpm-pythonprov | |
22 | BuildRequires: rpmbuild(macros) >= 1.219 | |
23 | Requires: python-modules >= 1:2.7 | |
24 | BuildArch: noarch | |
25 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
26 | ||
27 | %description | |
28 | Python HTTP module with connection pooling and file POST abilities. | |
29 | Features are: | |
30 | - Re-use the same socket connection for multiple requests (with | |
31 | optional client-side certificate verification). | |
32 | - File posting (encode_multipart_formdata). | |
33 | - Built-in redirection and retries (optional). | |
34 | - Supports gzip and deflate decoding. | |
35 | - Thread-safe and sanity-safe. | |
36 | ||
37 | %package -n python3-urllib3 | |
38 | Summary: HTTP library with thread-safe connection pooling, file post, and more | |
39 | Group: Development/Languages/Python | |
40 | Requires: python3-modules >= 3.2 | |
41 | ||
42 | %description -n python3-urllib3 | |
43 | Python HTTP module with connection pooling and file POST abilities. | |
44 | Features are: | |
45 | - Re-use the same socket connection for multiple requests (with | |
46 | optional client-side certificate verification). | |
47 | - File posting (encode_multipart_formdata). | |
48 | - Built-in redirection and retries (optional). | |
49 | - Supports gzip and deflate decoding. | |
50 | - Thread-safe and sanity-safe. | |
51 | ||
52 | %prep | |
53 | %setup -q -n %{module}-%{version} | |
54 | ||
55 | %build | |
56 | %if %{with python2} | |
57 | %{__python} setup.py build -b py2 | |
58 | %endif | |
59 | ||
60 | %if %{with python3} | |
61 | %{__python3} setup.py build -b py3 | |
62 | %endif | |
63 | ||
64 | %install | |
65 | rm -rf $RPM_BUILD_ROOT | |
66 | ||
67 | %if %{with python2} | |
68 | %{__python} setup.py \ | |
69 | build -b py2 \ | |
70 | install \ | |
71 | --skip-build \ | |
72 | --optimize=2 \ | |
73 | --root=$RPM_BUILD_ROOT | |
74 | %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
75 | %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir} | |
76 | %py_postclean | |
77 | %endif | |
78 | ||
79 | %if %{with python3} | |
80 | %{__python3} setup.py \ | |
81 | build -b py3 \ | |
82 | install \ | |
83 | --skip-build \ | |
84 | --optimize=2 \ | |
85 | --root=$RPM_BUILD_ROOT | |
86 | %endif | |
87 | ||
88 | # dummyserver is a part of unitstests | |
89 | %{__rm} -rf $RPM_BUILD_ROOT%{py_sitescriptdir}/dummyserver \ | |
90 | $RPM_BUILD_ROOT%{py3_sitescriptdir}/dummyserver | |
91 | ||
92 | %clean | |
93 | rm -rf $RPM_BUILD_ROOT | |
94 | ||
95 | %if %{with python2} | |
96 | %files | |
97 | %defattr(644,root,root,755) | |
98 | %doc CHANGES.rst CONTRIBUTORS.txt README.rst | |
99 | %{py_sitescriptdir}/%{module} | |
100 | %if "%{py_ver}" > "2.4" | |
101 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
102 | %endif | |
103 | %endif | |
104 | ||
105 | %if %{with python3} | |
106 | %files -n python3-urllib3 | |
107 | %defattr(644,root,root,755) | |
108 | %doc CHANGES.rst CONTRIBUTORS.txt README.rst | |
109 | %{py3_sitescriptdir}/%{module} | |
110 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
111 | %endif |