From 34b859255b225b15eb41d505a53f19e023300ba4 Mon Sep 17 00:00:00 2001
From: Yaroslav Halchenko <debian@onerussian.com>
Date: Thu, 8 Aug 2013 11:51:09 -0400
Subject: [PATCH] RF: simply do not build sphinx documentation on systems with
 older sphinx

backporting of recent sphinx release is a bit tedious.
---
 debian/changelog | 4 ++--
 debian/control   | 2 +-
 debian/rules     | 7 +++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 88e25f7b51..f9ef4d776f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,8 +10,8 @@ scikit-learn (0.14-1) unstable; urgency=low
       - dropped swig (not needed since awhile)
       - moved sphinx, PIL, and graphviz to Build-Depends-Indep since
         needed only for -doc package
-      - require sphinx 1.1.3 due to problems with unicode in earlier
-        present on older Debian/Ubuntu's versions
+      - do not build documentation when sphinx < 1.1.3 due to problems
+        with unicode in earlier present on older Debian/Ubuntu's versions
     - boosted policy to 3.9.4 (no further changes)
     - migrate from python-support to dh_python2
 
diff --git a/debian/control b/debian/control
index 0a3453c5af..16ed7d2800 100644
--- a/debian/control
+++ b/debian/control
@@ -13,7 +13,7 @@ Build-Depends: debhelper (>= 7.0.50),
                python-matplotlib,
                python-joblib (>= 0.4.5), python-support
 Build-Depends-Indep:
-               python-sphinx (>= 1.1.3~), python-imaging, graphviz,
+               python-sphinx (>= 1.0), python-imaging, graphviz,
 Standards-Version: 3.9.4
 XS-Python-Version: >= 2.6
 Homepage: http://scikit-learn.sourceforge.net
diff --git a/debian/rules b/debian/rules
index c769cfff14..eacf75a5dd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,6 +7,10 @@ PACKAGE_ROOT_DIR = debian/${PACKAGE_NAME}
 PYVERS = $(shell pyversions -vr)
 PYVER = $(shell pyversions  -vd)
 
+SPHINX_VER := $(shell python -c 'from sphinx import __version__; print __version__')
+NODOC = $(shell dpkg --compare-versions $(SPHINX_VER) lt 10.1.3 && echo "nodoc" || echo "")
+export DEB_BUILD_OPTIONS += $(NODOC)
+
 # Some tests are known to fail randomly so need to be excluded ATM
 NOSEARGS := 
 # --exclude='test_(sparse_svc_clone_with_callable_kernel|spectral_clustering_sparse|ovr_fit_predict)'
@@ -56,6 +60,9 @@ else
 	export MPLCONFIGDIR=$(CURDIR)/build HOME=$(CURDIR)/build; \
 	 cd doc; $(MAKE) html
 endif
+else
+	mkdir -p doc/_build/html
+	echo "<HTML><BODY><P>sklearn documentation was not built.<P>Please visit <A HREF='http://scikit-learn.org'>http://scikit-learn.org</A></BODY></HTML>" >| doc/_build/html/index.html
 endif
 	: # Use jquery from Debian package, so prune shipped one
 	-rm doc/_build/html/_static/jquery.js
-- 
GitLab