[sagemath] 03/03: WIP: work around #21612

Tobias Hansen thansen at moszumanska.debian.org
Wed Oct 5 18:56:53 UTC 2016


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

thansen pushed a commit to branch _wip_docbuild2
in repository sagemath.

commit ecc97ffe9f86a1d57b25cb00ff5c7740e6fae836
Author: Ximin Luo <infinity0 at debian.org>
Date:   Thu Sep 29 16:46:50 2016 +0200

    WIP: work around #21612
---
 debian/patches/fixsage-incremental-docbuild.patch | 98 +++++++++++++++++++++++
 debian/patches/series                             |  1 +
 debian/rules                                      | 11 ++-
 3 files changed, 109 insertions(+), 1 deletion(-)

diff --git a/debian/patches/fixsage-incremental-docbuild.patch b/debian/patches/fixsage-incremental-docbuild.patch
new file mode 100644
index 0000000..fa91c38
--- /dev/null
+++ b/debian/patches/fixsage-incremental-docbuild.patch
@@ -0,0 +1,98 @@
+--- a/sage/src/sage_setup/docbuild/__init__.py
++++ b/sage/src/sage_setup/docbuild/__init__.py
+@@ -13,7 +13,7 @@
+ from __future__ import absolute_import
+ from __future__ import print_function
+ 
+-import logging, optparse, os, shutil, subprocess, sys, re
++import filecmp, logging, optparse, os, shutil, subprocess, sys, re
+ 
+ import sphinx.cmdline
+ import sphinx.util.console
+@@ -223,10 +223,11 @@
+         logger.warning("Build finished.  The built documents can be found in %s", pdf_dir)
+ 
+     def clean(self, *args):
+-        shutil.rmtree(self._doctrees_dir())
+-        output_formats = list(args) if args else self._output_formats()
+-        for format in output_formats:
+-            shutil.rmtree(self._output_dir(format), ignore_errors=True)
++        logger.error("Warning: Clean cancelled due to patch; args: %r", args)
++        #shutil.rmtree(self._doctrees_dir())
++        #output_formats = list(args) if args else self._output_formats()
++        #for format in output_formats:
++        #    shutil.rmtree(self._output_dir(format), ignore_errors=True)
+ 
+     html = builder_helper('html')
+     pickle = builder_helper('pickle')
+@@ -686,8 +687,9 @@
+         if (inherit_prev is None or inherit_prev != options.inherited or
+             underscore_prev is None or underscore_prev != options.underscore):
+             logger.info("Detected change(s) in inherited and/or underscored members option(s).")
+-            self.clean_auto()
+-            self.get_cache.clear_cache()
++            logger.error("Warning: Clean cancelled due to patch")
++            #self.clean_auto()
++            #self.get_cache.clear_cache()
+ 
+         # After "sage -clone", refresh the .rst file mtimes in
+         # environment.pickle.
+@@ -962,26 +964,27 @@
+         filename = self.auto_rest_filename(module_name)
+         sage_makedirs(os.path.dirname(filename))
+ 
+-        outfile = open(filename, 'w')
++        tmpname = filename + ".tmp"
++        with open(tmpname, 'w') as outfile:
+ 
+-        title = self.get_module_docstring_title(module_name)
++            title = self.get_module_docstring_title(module_name)
+ 
+-        if title == '':
+-            logger.error("Warning: Missing title for %s", module_name)
+-            title = "MISSING TITLE"
+-
+-        # Don't doctest the autogenerated file.
+-        outfile.write(".. nodoctest\n\n")
+-        # Now write the actual content.
+-        outfile.write(".. _%s:\n\n"%(module_name.replace(".__init__","")))
+-        outfile.write(title + '\n')
+-        outfile.write('='*len(title) + "\n\n")
+-        outfile.write('.. This file has been autogenerated.\n\n')
++            if title == '':
++                logger.error("Warning: Missing title for %s", module_name)
++                title = "MISSING TITLE"
++
++            # Don't doctest the autogenerated file.
++            outfile.write(".. nodoctest\n\n")
++            # Now write the actual content.
++            outfile.write(".. _%s:\n\n"%(module_name.replace(".__init__","")))
++            outfile.write(title + '\n')
++            outfile.write('='*len(title) + "\n\n")
++            outfile.write('.. This file has been autogenerated.\n\n')
+ 
+-        global options
+-        inherited = ':inherited-members:' if options.inherited else ''
++            global options
++            inherited = ':inherited-members:' if options.inherited else ''
+ 
+-        automodule = '''
++            automodule = '''
+ .. automodule:: %s
+    :members:
+    :undoc-members:
+@@ -989,9 +992,12 @@
+    %s
+ 
+ '''
+-        outfile.write(automodule % (module_name, inherited))
++            outfile.write(automodule % (module_name, inherited))
+ 
+-        outfile.close()
++        # Only rename to original if different, to preserve mtimes
++        # Hacky workaround for #21612
++        if not os.path.exists(filename) or not filecmp.cmp(filename, tmpname):
++            os.rename(tmpname, filename)
+ 
+     def clean_auto(self):
+         """
diff --git a/debian/patches/series b/debian/patches/series
index 5b766d8..115f876 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -43,3 +43,4 @@ debian-temp-userdir-singular.patch
 debian-temp-userdir.patch
 temp-disable-parallel-sphinx.patch
 temp-cython-include-source.patch
+fixsage-incremental-docbuild.patch
diff --git a/debian/rules b/debian/rules
index ffe9d41..37ae4eb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -61,7 +61,14 @@ ptestlong:
 	# (and then this target) without trying (override_)dh_auto_build again.
 	cd sage && ./sage -t -p --all --long $(EXTRA_SAGE_TEST_FLAGS) --logfile=logs/ptestlong.log
 
-reset: clean
+# If the docbuild fails and you want to try again, you should run this first.
+# Otherwise the docbuild gets slower and slower as it re-reads information from
+# its build directory. At least that's my (infinity0) impression; I didn't
+# investigate this in too much detail yet.
+clean-docbuild:
+	rm -rf $$HOME/.local/share/sagemath/doc
+
+reset: clean clean-docbuild
 	QUILT_PATCHES=debian/patches quilt pop -af || true
 	cd sage; git clean -fdx && git submodule update --force
 	QUILT_PATCHES=debian/patches quilt push -a
@@ -75,3 +82,5 @@ build-dep:
 
 failed-tests:
 	grep "Failed example:" sage/logs/ptestlong.log | awk '{s++} END {print s}'
+
+.PHONY: clean-doc-build reset build-dep

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



More information about the debian-science-commits mailing list