[sagemath] 01/01: WIP: work around #21612
Ximin Luo
infinity0 at debian.org
Fri Oct 7 17:36:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch _wip_docbuild
in repository sagemath.
commit 784df17b2298bb3e8aedd505be1cf99585fc2fce
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 | 106 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 107 insertions(+)
diff --git a/debian/patches/fixsage-incremental-docbuild.patch b/debian/patches/fixsage-incremental-docbuild.patch
new file mode 100644
index 0000000..3170d0c
--- /dev/null
+++ b/debian/patches/fixsage-incremental-docbuild.patch
@@ -0,0 +1,106 @@
+Description: WIP: Fix incremental docbuild
+ You possibly also need to apply
+ sage/build/pkgs/sphinx/patches/environment.patch
+ to your system sphinx.
+Author: Ximin Luo <infinity0 at debian.org>
+Bug: https://trac.sagemath.org/ticket/21612
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- 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')
+@@ -684,8 +685,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.
+@@ -960,26 +962,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:
+@@ -987,9 +990,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
--
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