[statsmodels] 17/21: Use Python 3 for documentation building, and enable building notebook examples as jupyter components are now available in stable.

Diane Trout diane at moszumanska.debian.org
Mon Sep 25 06:39:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

diane pushed a commit to branch detrout-python3-try2
in repository statsmodels.

commit f0e940f80c7ebf2095a3314c9d0ad821b3f8ad93
Author: Diane Trout <diane at ghic.org>
Date:   Sun Sep 24 23:27:12 2017 -0700

    Use Python 3 for documentation building, and enable building notebook examples as jupyter components are now available in stable.
---
 debian/changelog                         |  2 ++
 debian/patches/deb_no_nbformat_for_now   | 31 -------------------------------
 debian/patches/series                    |  2 +-
 debian/patches/use-python3-for-doc-build | 16 ++++++++++++++++
 debian/rules                             | 20 +++++++++++++-------
 5 files changed, 32 insertions(+), 39 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0dbdc30..92c000e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,8 @@ statsmodels (0.8.0-4) UNRELEASED; urgency=medium
     Added those packages to the -doc package suggests list
   * Let dh_sphinxdoc manage jquery dependencies.
     Add libjs-requirejs for building notebooks.
+  * Use Python 3 for documentation building, and enable building notebook
+    examples as jupyter components are now available in stable.
 
  -- Andreas Tille <tille at debian.org>  Wed, 06 Sep 2017 17:32:07 +0200
 
diff --git a/debian/patches/deb_no_nbformat_for_now b/debian/patches/deb_no_nbformat_for_now
deleted file mode 100644
index cf0f324..0000000
--- a/debian/patches/deb_no_nbformat_for_now
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/docs/Makefile
-+++ b/docs/Makefile
-@@ -55,7 +55,8 @@ cleancache:
- 
- notebooks:
- 	@echo "Generating notebooks from examples/notebooks folder"
--	$(TOOLSPATH)$(NOTEBOOKBUILD) --execute=True --allow_errors=True
-+	: # unfortunately no nbformat in debian yet (only experimental, depends on jupyter)
-+	#$(TOOLSPATH)$(NOTEBOOKBUILD) --execute=True --allow_errors=True
- 
- html:
-     # make directories for images
-@@ -66,13 +67,13 @@ html:
- 	#$(TOOLSPATH)$(EXAMPLEBUILD)
- 	@echo "Generating datasets from installed statsmodels.datasets"
- 	$(TOOLSPATH)$(DATASETBUILD)
--	@echo "Generating notebooks from examples/notebooks folder"
--	$(TOOLSPATH)$(NOTEBOOKBUILD) --execute=True --allow_errors=True
-+	#@echo "Generating notebooks from examples/notebooks folder"
-+	#$(TOOLSPATH)$(NOTEBOOKBUILD) --execute=True --allow_errors=True
- 	@echo "Running sphinx-build"
- 	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
--	@echo "Copying rendered example notebooks"
--	mkdir -p $(BUILDDIR)/html/examples/notebooks/generated
--	cp source/examples/notebooks/generated/*html $(BUILDDIR)/html/examples/notebooks/generated
-+	#@echo "Copying rendered example notebooks"
-+	#mkdir -p $(BUILDDIR)/html/examples/notebooks/generated
-+	#cp source/examples/notebooks/generated/*html $(BUILDDIR)/html/examples/notebooks/generated
- 	#$(TOOLSPATH)$(EXAMPLEBUILD)
- 	$(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/index.html
- 	#$(TOOLSPATH)$(FOLDTOC) $(BUILDDIR)/html/examples/index.html ../_static
diff --git a/debian/patches/series b/debian/patches/series
index 68a4921..36e3ec4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,7 +3,7 @@
 deb_use_internal_ipythonsphinx_extensions
 up_reduce_test_precision
 deb_skip_test_ons390
-deb_no_nbformat_for_now
 skip_tests_failing_due_to_panda_issue.patch
 fix_numpydoc_issue.patch
+use-python3-for-doc-build
 use-system-inventory
diff --git a/debian/patches/use-python3-for-doc-build b/debian/patches/use-python3-for-doc-build
new file mode 100644
index 0000000..15a1aec
--- /dev/null
+++ b/debian/patches/use-python3-for-doc-build
@@ -0,0 +1,16 @@
+Index: statsmodels-0.8.0/docs/Makefile
+===================================================================
+--- statsmodels-0.8.0.orig/docs/Makefile
++++ statsmodels-0.8.0/docs/Makefile
+@@ -65,9 +65,9 @@ html:
+ 	@echo "Generating reST from examples folder"
+ 	#$(TOOLSPATH)$(EXAMPLEBUILD)
+ 	@echo "Generating datasets from installed statsmodels.datasets"
+-	$(TOOLSPATH)$(DATASETBUILD)
++	python3 $(TOOLSPATH)$(DATASETBUILD)
+ 	@echo "Generating notebooks from examples/notebooks folder"
+-	$(TOOLSPATH)$(NOTEBOOKBUILD) --execute=True --allow_errors=True
++	python3 $(TOOLSPATH)$(NOTEBOOKBUILD) --execute=True --allow_errors=True
+ 	@echo "Running sphinx-build"
+ 	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ 	@echo "Copying rendered example notebooks"
diff --git a/debian/rules b/debian/rules
index 6905f46..0564c18 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,6 +6,8 @@
 export HOME=$(CURDIR)/build
 export MPLCONFIGDIR=$(HOME)
 
+export PY3VER=$(shell py3versions -vd)
+
 export PYBUILD_NAME=statsmodels
 export PYBUILD_INSTALL_ARGS=--install-layout=deb
 export PYBUILD_TEST_ARGS=--exclude='(test_sarimax)|(test_structural)|(test_dynamic_factor)|(test_varmax)'
@@ -29,18 +31,25 @@ override_dh_auto_build: $(HOME)
 	echo "backend : Agg" >| $(MPLCONFIGDIR)/matplotlibrc
 
 # Build docs during build
-override_dh_auto_build-indep: $(HOME)
+override_dh_installdocs:
 	: # I: Generate documentation
 	: # Build Documentation -- assure existence of build/html for nodoc
 	mkdir -p build/html
 ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
-	PYTHONPATH=`/bin/ls -d $(CURDIR)/debian/python3-statsmodels/usr/lib/python3/*/` \
-	 $(MAKE) -C docs html
+	PYTHONPATH=$(CURDIR)/.pybuild/pythonX.Y_${PY3VER}/build \
+	BUILDDIR=$(CURDIR)/build \
+	 make -C docs html
 	mv docs/build/* build/
 	: # Fix up links to MathJax to be local
 	grep -l '/mathjax/' -R build/html/examples/notebooks \
-	| xargs -r sed -i -e 's,https://\S*.com/mathjax/latest/MathJax.js,file:///usr/share/javascript/mathjax/MathJax.js,g'
+	| xargs -r sed -i -e 's,https://\S*.org/mathjax/latest/MathJax.js,file:///usr/share/javascript/mathjax/MathJax.js,g'
+	: # Replace require
+	grep -l '/requirejs/' -R build/html/examples/notebooks \
+	| xargs -r sed -i -e 's,https://\S*.com/ajax/libs/require.js/.*/require.min.js,file:///usr/share/javascript/requirejs/require.min.js,g'
+	grep -l '/jquery/' -R build/html/examples/notebooks \
+	| xargs -r sed -i -e 's,https://\S*.com/ajax/libs/jquery/.*/jquery.min.js,file:///usr/share/javascript/jquery/jquery.min.js,g'
 	rm -rf docs/source/generated/
+	dh_installdocs
 endif
 
 override_dh_auto_clean:
@@ -71,9 +80,6 @@ override_dh_compress:
 	dh_compress -X.py -X.html -X.pdf -X.css -X.jpg -X.txt -X.js -X.json -X.rtc -X.inv -Xobjects.inv
 
 
-override_dh_installdocs:
-	dh_installdocs
-
 
 ## move binary libraries into -lib
 override_dh_auto_install:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/statsmodels.git



More information about the debian-science-commits mailing list