[sasview] 01/03: Update doc generation to include split off packages

Stuart Prescott stuart at debian.org
Sat Nov 4 13:35:05 UTC 2017


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

stuart pushed a commit to branch master
in repository sasview.

commit b2269cdd3f3d0ef0ebdc371a51743ade5626d5df
Author: Stuart Prescott <stuart at debian.org>
Date:   Sun Nov 5 00:00:02 2017 +1100

    Update doc generation to include split off packages
---
 debian/control                            |  5 ++-
 debian/fetchdocs                          | 52 +++++++++++++++++++++++++++++++
 debian/patches/batchgrid-image-path.patch | 14 ---------
 debian/patches/limit-docs-sasview.patch   | 38 +++++++++++++++-------
 debian/patches/series                     |  1 -
 debian/rules                              |  6 ++--
 6 files changed, 87 insertions(+), 29 deletions(-)

diff --git a/debian/control b/debian/control
index e7a9fae..caf95ba 100644
--- a/debian/control
+++ b/debian/control
@@ -13,6 +13,7 @@ Build-Depends:
  libpython-dev,
  python-all,
  python-bumps,
+ python-bumps-doc,
  python-h5py,
  python-lxml,
  python-matplotlib,
@@ -22,10 +23,12 @@ Build-Depends:
  python-pyparsing,
  python-pytest,
  python-sasmodels,
+ python-sasmodels-doc,
  python-scipy,
  python-setuptools,
- python-sphinx,
+ python-sphinx (>= 1.6~),
  python-wxgtk3.0,
+ rename,
  texinfo
 Standards-Version: 4.1.1
 Homepage: http://www.sasview.org/
diff --git a/debian/fetchdocs b/debian/fetchdocs
new file mode 100755
index 0000000..483b009
--- /dev/null
+++ b/debian/fetchdocs
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+set -e
+set -u
+
+mkdir -p otherdocs/sasmodels/build/lib otherdocs/bumps
+
+SASDOC=/usr/share/doc/python-sasmodels-doc/html
+cp -r $SASDOC/_sources otherdocs/sasmodels/doc
+cp -r $SASDOC/_images otherdocs/sasmodels/doc/images
+
+ln -s /usr/lib/python2.7/dist-packages/sasmodels otherdocs/sasmodels/build/lib/
+
+BUMPDOC=/usr/share/doc/python-bumps-doc/html
+cp -r $BUMPDOC/_sources otherdocs/bumps/doc
+cp -r $BUMPDOC/_images otherdocs/bumps/doc/images
+
+# fix up the extensions
+find otherdocs -name \*.rst.txt -exec \
+    file-rename 's/.rst.txt/.rst/' {} +
+
+# horrible hack to find the missing images and copy them back in
+
+# first make sure all figures are on a single rst line
+(
+    cd otherdocs/sasmodels/doc/guide/magnetism/
+    awk '/\.\. figure::$/{printf $0; next}; {print}' magnetism.rst > magnetism.rst.tmp
+    mv magnetism.rst.tmp magnetism.rst
+)
+
+fetchimages() {
+    srcdir=$1/doc
+    imgcache=$1/doc/images
+
+    for src in $(grep -r -e'\.\. figure::' -e'\.\. image::' -l $srcdir); do
+        echo "# Inspecting $src"
+        base=$(dirname $src)
+        for img in $(sed -rn 's@\.\. (figure|image):: (.*)@\2 at p' $src); do
+            echo "## Image $img"
+            path=$base/$(dirname $img)
+            fname=$(basename $img)
+            echo "   path=$path fname=$fname"
+            mkdir -p $path
+            if ! cp $imgcache/$fname $path; then
+              echo "ERROR: couldn't find $img in $path"
+            fi
+        done
+    done
+}
+
+fetchimages otherdocs/sasmodels
+fetchimages otherdocs/bumps
diff --git a/debian/patches/batchgrid-image-path.patch b/debian/patches/batchgrid-image-path.patch
deleted file mode 100644
index a077112..0000000
--- a/debian/patches/batchgrid-image-path.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Description: Fix image path to enable PDF documentation to be generated
-Author: Stuart Prescott <stuart at debian.org>
-Forwarded: https://github.com/SasView/sasview/pull/120
---- a/src/sas/sasgui/guiframe/data_processor.py
-+++ b/src/sas/sasgui/guiframe/data_processor.py
-@@ -13,7 +13,7 @@
- 
- .. note:: Path to image is: /sasview/src/sas/sasgui/guiframe/media/BatchGridClassLayout.png
- 
--.. image:: ../../user/sasgui/guiframe/BatchGridClassLayout.png
-+.. image:: ../../../../../src/sas/sasgui/guiframe/media/BatchGridClassLayout.png
-    :align: center
- 
- """
diff --git a/debian/patches/limit-docs-sasview.patch b/debian/patches/limit-docs-sasview.patch
index 615b10e..21c07ea 100644
--- a/debian/patches/limit-docs-sasview.patch
+++ b/debian/patches/limit-docs-sasview.patch
@@ -6,14 +6,30 @@ Description: Skip building documentation for external modules
 Author: Stuart Prescott <stuart at debian.org>
 --- a/docs/sphinx-docs/build_sphinx.py
 +++ b/docs/sphinx-docs/build_sphinx.py
-@@ -258,8 +258,8 @@
- def rebuild():
-     clean()
-     setup_source_temp()
--    retrieve_user_docs()
--    retrieve_bumps_docs()
-+    #retrieve_user_docs()
-+    #retrieve_bumps_docs()
-     #fetch_katex(version=KATEX_VERSION, destination=KATEX_PARENT)
-     #fetch_mathjax()
-     apidoc()
+@@ -40,7 +40,7 @@
+ SASVIEW_API_TARGET = joinpath(SPHINX_SOURCE, "dev", "sasview-api")
+ 
+ # sasmodels paths
+-SASMODELS_ROOT = joinpath(SASVIEW_ROOT, "..", "sasmodels")
++SASMODELS_ROOT = joinpath(SASVIEW_ROOT, "otherdocs", "sasmodels")
+ SASMODELS_DOCS = joinpath(SASMODELS_ROOT, "doc")
+ SASMODELS_BUILD = joinpath(SASMODELS_ROOT, "build", "lib")
+ SASMODELS_MODEL_SOURCE = joinpath(SASMODELS_DOCS, "model")
+@@ -56,7 +56,7 @@
+ ]
+ 
+ # bumps paths
+-BUMPS_DOCS = joinpath(SASVIEW_ROOT, "..", "bumps", "doc")
++BUMPS_DOCS = joinpath(SASVIEW_ROOT, "otherdocs", "bumps", "doc")
+ BUMPS_SOURCE = joinpath(BUMPS_DOCS, "guide")
+ BUMPS_TARGET = joinpath(SPHINX_PERSPECTIVES, "fitting")
+ 
+@@ -127,7 +127,7 @@
+             copy_tree(source_dir, dest_dir)
+ 
+     print("=== Sasmodels Docs ===")
+-    shutil.copy(joinpath(SASMODELS_DOCS, "rst_prolog"), SPHINX_SOURCE)
++    #shutil.copy(joinpath(SASMODELS_DOCS, "rst_prolog"), SPHINX_SOURCE)
+     copy_tree(SASMODELS_MODEL_SOURCE, SASMODELS_MODEL_TARGET)
+     #copy_tree(SASMODELS_API_SOURCE, SASMODELS_API_TARGET)
+     copy_tree(SASMODELS_DEV_SOURCE, SASMODELS_DEV_TARGET)
diff --git a/debian/patches/series b/debian/patches/series
index 0f3e20f..f78e8fa 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,3 @@
-batchgrid-image-path.patch
 uniquelist-builtin.patch
 setup-entry-point.patch
 limit-docs-sasview.patch
diff --git a/debian/rules b/debian/rules
index 969e2a1..3439f27 100755
--- a/debian/rules
+++ b/debian/rules
@@ -18,7 +18,7 @@ export HOME = $(CURDIR)/build/
 override_dh_auto_clean:
 	dh_auto_clean
 	# clean up docs
-	rm -rf docs/sphinx-docs/build docs/sphinx-docs/source-temp
+	rm -rf docs/sphinx-docs/build docs/sphinx-docs/source-temp otherdocs
 	# clean up tests
 	find test -name logs -type d -exec rm -rf {} +
 	rm -rf test/tests.log .cache test/.cache test/__init__.py
@@ -31,7 +31,9 @@ override_dh_install:
 
 override_dh_auto_build:
 	dh_auto_build
-	cd docs/sphinx-docs; python build_sphinx.py
+	# reassemble the docs from dependent packages to make the overall
+	./debian/fetchdocs
+	python ./docs/sphinx-docs/build_sphinx.py
 	ln -sf /usr/share/javascript/mathjax/ docs/sphinx-docs/build/html/_static/mathjax
 	cd docs/sphinx-docs; make info
 	cd docs/sphinx-docs; make man

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



More information about the debian-science-commits mailing list