]>
Commit | Line | Data |
---|---|---|
7e4c0b75 AM |
1 | # |
2 | # Conditional build: | |
9624f30f | 3 | %bcond_with tests # tests [require localhost networking] |
a480d3fe AM |
4 | %bcond_without python2 # CPython 2.x module |
5 | %bcond_without python3 # CPython 3.x module | |
7e4c0b75 AM |
6 | |
7 | %define module ndg-httpsclient | |
3b152d9f JB |
8 | Summary: Enhanced HTTPS support for httplib and urllib2 using PyOpenSSL |
9 | Summary(pl.UTF-8): Rozszerzona obsługa HTTPS dla modułów httplib i urllib2 poprzez PyOpenSSL | |
7e4c0b75 | 10 | Name: python-%{module} |
97d009fc | 11 | Version: 0.4.2 |
ce83a7a3 | 12 | Release: 5 |
7e4c0b75 AM |
13 | License: BSD |
14 | Group: Libraries/Python | |
97d009fc AM |
15 | Source0: https://github.com/cedadev/ndg_httpsclient/archive/%{version}.tar.gz |
16 | # Source0-md5: 08236101a72bb18f9f62c123d199420b | |
9624f30f | 17 | Patch0: %{name}-tests.patch |
7e4c0b75 | 18 | URL: http://ndg-security.ceda.ac.uk/wiki/ndg_httpsclient |
a480d3fe | 19 | %if %{with python2} |
9624f30f | 20 | BuildRequires: python-modules >= 1:2.6 |
7e4c0b75 | 21 | BuildRequires: python-pyOpenSSL |
9624f30f | 22 | BuildRequires: python-setuptools |
a480d3fe AM |
23 | %endif |
24 | %if %{with python3} | |
9624f30f | 25 | BuildRequires: python3-modules >= 1:3.2 |
a480d3fe | 26 | BuildRequires: python3-pyOpenSSL |
9624f30f | 27 | BuildRequires: python3-setuptools |
a480d3fe | 28 | %endif |
7e4c0b75 | 29 | BuildRequires: rpm-pythonprov |
9624f30f JB |
30 | BuildRequires: rpmbuild(macros) >= 1.714 |
31 | Requires: python-modules >= 1:2.6 | |
7e4c0b75 AM |
32 | Requires: python-pyOpenSSL |
33 | Requires: python-pyasn1 | |
34 | BuildArch: noarch | |
35 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
36 | ||
37 | %description | |
38 | This is a HTTPS client implementation for httplib and urllib2 based on | |
39 | PyOpenSSL. PyOpenSSL provides a more fully featured SSL implementation | |
40 | over the default provided with Python and importantly enables full | |
41 | verification of the SSL peer. | |
42 | ||
3b152d9f JB |
43 | %description -l pl.UTF-8 |
44 | Ten moduł to implementacja klienta HTTPS dla modułów httplib i urllib2 | |
45 | oparta na module PyOpenSSL. PyOpenSSL udostępnia pełniejszą | |
46 | implementację SSL niż domyślnie dostarczana z Pythonem i umożliwia | |
47 | pełną weryfikację drugiej strony połączenia SSL. | |
48 | ||
a480d3fe AM |
49 | %package -n python3-%{module} |
50 | Summary: Enhanced HTTPS support for httplib and urllib2 using PyOpenSSL | |
51 | Summary(pl.UTF-8): Rozszerzona obsługa HTTPS dla modułów httplib i urllib2 poprzez PyOpenSSL | |
52 | Group: Libraries/Python | |
9624f30f | 53 | Requires: python3-modules >= 1:3.2 |
a480d3fe AM |
54 | Requires: python3-pyOpenSSL |
55 | Requires: python3-pyasn1 | |
56 | ||
57 | %description -n python3-%{module} | |
58 | This is a HTTPS client implementation for httplib and urllib2 based on | |
59 | PyOpenSSL. PyOpenSSL provides a more fully featured SSL implementation | |
60 | over the default provided with Python and importantly enables full | |
61 | verification of the SSL peer. | |
62 | ||
63 | %description -n python3-%{module} -l pl.UTF-8 | |
64 | Ten moduł to implementacja klienta HTTPS dla modułów httplib i urllib2 | |
65 | oparta na module PyOpenSSL. PyOpenSSL udostępnia pełniejszą | |
66 | implementację SSL niż domyślnie dostarczana z Pythonem i umożliwia | |
67 | pełną weryfikację drugiej strony połączenia SSL. | |
68 | ||
7e4c0b75 AM |
69 | %prep |
70 | %setup -q -n ndg_httpsclient-%{version} | |
9624f30f | 71 | %patch0 -p1 |
7e4c0b75 AM |
72 | |
73 | %build | |
a480d3fe | 74 | %if %{with python2} |
9624f30f JB |
75 | %py_build |
76 | ||
77 | %if %{with tests} | |
78 | TOPDIR=$(pwd) | |
79 | cd ndg/httpsclient/test | |
80 | ./scripts/openssl_https_server.sh & | |
81 | HTTPDPID=$! | |
82 | sleep 1 | |
83 | trap "kill $HTTPDPID" ERR | |
84 | for test in test_*.py ; do | |
85 | PYTHONPATH=$TOPDIR/build-2/lib %{__python} $test | |
86 | done | |
87 | kill $HTTPDPID | |
88 | trap - ERR | |
89 | cd ../../.. | |
90 | %endif | |
a480d3fe AM |
91 | %endif |
92 | ||
93 | %if %{with python3} | |
9624f30f JB |
94 | %py3_build |
95 | ||
96 | %if %{with tests} | |
97 | TOPDIR=$(pwd) | |
98 | cd ndg/httpsclient/test | |
99 | ./scripts/openssl_https_server.sh & | |
100 | HTTPDPID=$! | |
101 | sleep 1 | |
102 | trap "kill $HTTPDPID" ERR | |
103 | for test in test_*.py ; do | |
104 | PYTHONPATH=$TOPDIR/build-3/lib %{__python3} $test | |
105 | done | |
106 | kill $HTTPDPID | |
107 | trap - ERR | |
108 | cd ../../.. | |
109 | %endif | |
a480d3fe | 110 | %endif |
7e4c0b75 AM |
111 | |
112 | %install | |
113 | rm -rf $RPM_BUILD_ROOT | |
114 | ||
a480d3fe | 115 | %if %{with python2} |
d200588e | 116 | %py_install |
7e4c0b75 AM |
117 | |
118 | %py_postclean | |
9624f30f | 119 | %{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/ndg/httpsclient/test |
a480d3fe AM |
120 | %endif |
121 | ||
122 | %if %{with python3} | |
123 | %py3_install | |
9624f30f JB |
124 | |
125 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/ndg/httpsclient/test | |
a480d3fe | 126 | %endif |
7e4c0b75 AM |
127 | |
128 | %clean | |
129 | rm -rf $RPM_BUILD_ROOT | |
130 | ||
a480d3fe | 131 | %if %{with python2} |
7e4c0b75 AM |
132 | %files |
133 | %defattr(644,root,root,755) | |
9624f30f | 134 | %doc README.md ndg/httpsclient/LICENSE |
7e4c0b75 AM |
135 | %{py_sitescriptdir}/ndg |
136 | %if "%{py_ver}" > "2.4" | |
137 | %{py_sitescriptdir}/ndg_httpsclient-%{version}-py*.egg-info | |
df64dd2a | 138 | %{py_sitescriptdir}/ndg_httpsclient-%{version}-py*-nspkg.pth |
7e4c0b75 | 139 | %endif |
a480d3fe AM |
140 | %endif |
141 | ||
142 | %if %{with python3} | |
143 | %files -n python3-%{module} | |
144 | %defattr(644,root,root,755) | |
9624f30f | 145 | %doc README.md ndg/httpsclient/LICENSE |
80b32fe5 | 146 | %attr(755,root,root) %{_bindir}/ndg_httpclient |
a480d3fe AM |
147 | %{py3_sitescriptdir}/ndg |
148 | %{py3_sitescriptdir}/ndg_httpsclient-%{version}-py*.egg-info | |
149 | %{py3_sitescriptdir}/ndg_httpsclient-%{version}-py*-nspkg.pth | |
150 | %endif |