[packages/python-urllib3] - docs build requires mock module: ensure using python3, added mock patch to use unittest.mock modul

qboosh qboosh at pld-linux.org
Sun Dec 2 09:34:08 CET 2018


commit 70df93698869ff72a240368a38384f0e0c45ccab
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Dec 2 09:38:28 2018 +0100

    - docs build requires mock module: ensure using python3, added mock patch to use unittest.mock module

 python-urllib3-mock.patch | 14 ++++++++++++++
 python-urllib3.spec       |  6 +++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/python-urllib3.spec b/python-urllib3.spec
index 4349fc8..0c0dbf0 100644
--- a/python-urllib3.spec
+++ b/python-urllib3.spec
@@ -14,8 +14,10 @@ Version:	1.24.1
 Release:	1
 License:	MIT
 Group:		Development/Languages/Python
+#Source0Download: https://pypi.org/simple/urllib3/
 Source0:	https://files.pythonhosted.org/packages/source/u/urllib3/%{module}-%{version}.tar.gz
 # Source0-md5:	f3d8b1841539200c949a33e87e551d8e
+Patch0:		%{name}-mock.patch
 URL:		http://urllib3.readthedocs.org/
 %if %{with python2}
 BuildRequires:	python-modules >= 1:2.7
@@ -43,7 +45,7 @@ BuildRequires:	uname(release) >= 3.9
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.714
 %if %{with doc}
-BuildRequires:	sphinx-pdg
+BuildRequires:	sphinx-pdg-3
 %endif
 Requires:	python-modules >= 1:2.7
 BuildArch:	noarch
@@ -108,6 +110,7 @@ Dokumentacja API modułu Pythona urllib3.
 
 %prep
 %setup -q -n %{module}-%{version}
+%patch0 -p1
 
 %build
 %if %{with python2}
@@ -120,6 +123,7 @@ Dokumentacja API modułu Pythona urllib3.
 
 %if %{with doc}
 %{__make} -C docs html \
+	SPHINXBUILD=sphinx-build-3 \
 	SPHINXOPTS=
 %endif
 
diff --git a/python-urllib3-mock.patch b/python-urllib3-mock.patch
new file mode 100644
index 0000000..b869893
--- /dev/null
+++ b/python-urllib3-mock.patch
@@ -0,0 +1,14 @@
+--- urllib3-1.24.1/docs/conf.py.orig	2018-10-05 23:00:05.000000000 +0200
++++ urllib3-1.24.1/docs/conf.py	2018-12-02 09:35:52.593757249 +0100
+@@ -27,7 +27,10 @@
+ # Mock some expensive/platform-specific modules so build will work.
+ # (https://read-the-docs.readthedocs.io/en/latest/faq.html#\
+ #  i-get-import-errors-on-libraries-that-depend-on-c-modules)
+-import mock
++try:
++    import mock
++except ImportError:
++    from unittest import mock
+ 
+ 
+ class MockModule(mock.Mock):
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-urllib3.git/commitdiff/70df93698869ff72a240368a38384f0e0c45ccab



More information about the pld-cvs-commit mailing list