]> git.pld-linux.org Git - packages/python-ndg-httpsclient.git/commitdiff
- updated dependencies, added tests patch, allow tests to pass
authorJakub Bogusz <qboosh@pld-linux.org>
Sat, 4 Mar 2017 20:20:40 +0000 (21:20 +0100)
committerJakub Bogusz <qboosh@pld-linux.org>
Sat, 4 Mar 2017 20:20:40 +0000 (21:20 +0100)
python-ndg-httpsclient-tests.patch [new file with mode: 0644]
python-ndg-httpsclient.spec

diff --git a/python-ndg-httpsclient-tests.patch b/python-ndg-httpsclient-tests.patch
new file mode 100644 (file)
index 0000000..72cbe58
--- /dev/null
@@ -0,0 +1,7 @@
+Let background process PID stay the same as initial, so that we can could use pid=$! ... kill $pid
+--- ndg_httpsclient-0.4.2/ndg/httpsclient/test/scripts/openssl_https_server.sh.orig    2016-07-19 15:26:01.000000000 +0200
++++ ndg_httpsclient-0.4.2/ndg/httpsclient/test/scripts/openssl_https_server.sh 2017-03-04 18:28:11.383614685 +0100
+@@ -1,2 +1,2 @@
+ #!/bin/sh
+-openssl s_server -www -cert pki/localhost.crt -key pki/localhost.key -accept 4443
++exec openssl s_server -www -cert pki/localhost.crt -key pki/localhost.key -accept 4443
index 4b626c936ea9f5c5bd980585d18de9bfe47166a0..a9ed928a6e7688cb50d72e2ee6f1f71fc5ec0e5b 100644 (file)
@@ -1,6 +1,6 @@
 #
 # Conditional build:
-%bcond_without tests   # do not perform "make test"
+%bcond_with    tests   # tests [require localhost networking]
 %bcond_without python2 # CPython 2.x module
 %bcond_without python3 # CPython 3.x module
 
@@ -14,18 +14,21 @@ License:    BSD
 Group:         Libraries/Python
 Source0:       https://github.com/cedadev/ndg_httpsclient/archive/%{version}.tar.gz
 # Source0-md5: 08236101a72bb18f9f62c123d199420b
+Patch0:                %{name}-tests.patch
 URL:           http://ndg-security.ceda.ac.uk/wiki/ndg_httpsclient
 %if %{with python2}
-BuildRequires: python-distribute
+BuildRequires: python-modules >= 1:2.6
 BuildRequires: python-pyOpenSSL
+BuildRequires: python-setuptools
 %endif
 %if %{with python3}
-BuildRequires: python3-distribute
+BuildRequires: python3-modules >= 1:3.2
 BuildRequires: python3-pyOpenSSL
+BuildRequires: python3-setuptools
 %endif
 BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.710
-Requires:      python-modules
+BuildRequires: rpmbuild(macros) >= 1.714
+Requires:      python-modules >= 1:2.6
 Requires:      python-pyOpenSSL
 Requires:      python-pyasn1
 BuildArch:     noarch
@@ -47,7 +50,7 @@ pełną weryfikację drugiej strony połączenia SSL.
 Summary:       Enhanced HTTPS support for httplib and urllib2 using PyOpenSSL
 Summary(pl.UTF-8):     Rozszerzona obsługa HTTPS dla modułów httplib i urllib2 poprzez PyOpenSSL
 Group:         Libraries/Python
-Requires:      python3-modules
+Requires:      python3-modules >= 1:3.2
 Requires:      python3-pyOpenSSL
 Requires:      python3-pyasn1
 
@@ -65,14 +68,45 @@ pełną weryfikację drugiej strony połączenia SSL.
 
 %prep
 %setup -q -n ndg_httpsclient-%{version}
+%patch0 -p1
 
 %build
 %if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+TOPDIR=$(pwd)
+cd ndg/httpsclient/test
+./scripts/openssl_https_server.sh &
+HTTPDPID=$!
+sleep 1
+trap "kill $HTTPDPID" ERR
+for test in test_*.py ; do
+PYTHONPATH=$TOPDIR/build-2/lib %{__python} $test
+done
+kill $HTTPDPID
+trap - ERR
+cd ../../..
+%endif
 %endif
 
 %if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+TOPDIR=$(pwd)
+cd ndg/httpsclient/test
+./scripts/openssl_https_server.sh &
+HTTPDPID=$!
+sleep 1
+trap "kill $HTTPDPID" ERR
+for test in test_*.py ; do
+PYTHONPATH=$TOPDIR/build-3/lib %{__python3} $test
+done
+kill $HTTPDPID
+trap - ERR
+cd ../../..
+%endif
 %endif
 
 %install
@@ -81,14 +115,14 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %py_install
 
-%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
-%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
-
 %py_postclean
+%{__rm} -r $RPM_BUILD_ROOT%{py_sitescriptdir}/ndg/httpsclient/test
 %endif
 
 %if %{with python3}
 %py3_install
+
+%{__rm} -r $RPM_BUILD_ROOT%{py3_sitescriptdir}/ndg/httpsclient/test
 %endif
 
 %clean
@@ -97,6 +131,7 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %files
 %defattr(644,root,root,755)
+%doc README.md ndg/httpsclient/LICENSE
 %attr(755,root,root) %{_bindir}/ndg_httpclient
 %{py_sitescriptdir}/ndg
 %if "%{py_ver}" > "2.4"
@@ -108,8 +143,8 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python3}
 %files -n python3-%{module}
 %defattr(644,root,root,755)
+%doc README.md ndg/httpsclient/LICENSE
 %{py3_sitescriptdir}/ndg
 %{py3_sitescriptdir}/ndg_httpsclient-%{version}-py*.egg-info
 %{py3_sitescriptdir}/ndg_httpsclient-%{version}-py*-nspkg.pth
 %endif
-
This page took 0.103231 seconds and 4 git commands to generate.