# HG changeset patch
# User Volker Braun <vbraun.name@gmail.com>
# Date 1359808620 0
# Node ID b8728b1a81b39f9c941884aef831656cd9cff523
# Parent f133a8a0f5f4f7ce57251fc51e27d72eb30331ae
Hide useless warning and add the sat subdoc that was accidentally left out.
diff --git a/doc/common/custom-sphinx-build.py b/doc/common/custom-sphinx-build.py
a
|
b
|
|
38 | 38 | ) |
39 | 39 | |
40 | 40 | |
| 41 | if any('multidoc_first_pass=1' in arg for arg in sys.argv): |
| 42 | useless_chatter += ( |
| 43 | re.compile('^None:[0-9]*: WARNING: citation not found: '), |
| 44 | ) |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
41 | 49 | class SageSphinxLogger(object): |
42 | 50 | """ |
43 | 51 | This implements the file object interface to serve as sys.stdout |
… |
… |
|
129 | 137 | def write(self, str): |
130 | 138 | try: |
131 | 139 | self._write(str) |
132 | | except: |
| 140 | except StandardError: |
133 | 141 | import traceback |
134 | 142 | traceback.print_exc(file=self._stream) |
135 | 143 | |
diff --git a/doc/common/multidocs.py b/doc/common/multidocs.py
a
|
b
|
|
20 | 20 | - the javascript index; |
21 | 21 | - the citations. |
22 | 22 | """ |
23 | | import cPickle, os, sys, shutil |
| 23 | import cPickle, os, sys, shutil, re, tempfile |
24 | 24 | import sphinx |
25 | 25 | from sphinx.util.console import bold |
26 | 26 | |
… |
… |
|
72 | 72 | # needed by env.check_consistency (sphinx.environement, line 1734) |
73 | 73 | for ind in newalldoc: |
74 | 74 | # treat subdocument source as orphaned file and don't complain |
75 | | env.metadata[ind] = {'orphan'} |
| 75 | md = env.metadata.get(ind, set()) |
| 76 | md.add('orphan') |
| 77 | env.metadata[ind] = md |
76 | 78 | # merge the citations |
77 | 79 | newcite = {} |
78 | 80 | for ind, (path, tag) in docenv.citations.iteritems(): |
… |
… |
|
187 | 189 | ctx['pathto'] = sage_pathto |
188 | 190 | |
189 | 191 | |
| 192 | def citation_dir(app): |
| 193 | citedir = re.sub('/doc/output/[^/]*/', '/doc/output/inventory/', app.outdir) |
| 194 | if not os.path.isdir(citedir): |
| 195 | os.makedirs(os.path.abspath(citedir)) |
| 196 | return citedir |
| 197 | |
190 | 198 | def write_citations(app, citations): |
191 | 199 | """ |
192 | | Pickle the citation in a file |
| 200 | Pickle the citation in a file. |
| 201 | |
| 202 | Atomic except on Windows, where you need to upgrade to a real filesystem. |
193 | 203 | """ |
194 | 204 | import cPickle |
195 | | file = open(os.path.join(app.outdir, CITE_FILENAME), 'wb') |
196 | | cPickle.dump(citations, file) |
197 | | file.close() |
| 205 | outdir = citation_dir(app) |
| 206 | fd, tmp = tempfile.mkstemp(dir=outdir) |
| 207 | os.close(fd) |
| 208 | with open(tmp, 'wb') as file: |
| 209 | cPickle.dump(citations, file) |
| 210 | citation = os.path.join(outdir, CITE_FILENAME) |
| 211 | try: |
| 212 | os.rename(tmp, citation) |
| 213 | except OSError: # your OS sucks and cannot do atomic file replacement |
| 214 | os.unlink(citation) |
| 215 | os.rename(tmp, citation) |
198 | 216 | app.info("Saved pickle file: %s"%CITE_FILENAME) |
199 | 217 | |
200 | 218 | |
… |
… |
|
204 | 222 | references. |
205 | 223 | """ |
206 | 224 | app.builder.info(bold('loading cross citations... '), nonl=1) |
207 | | filename = os.path.join(app.outdir, '..', CITE_FILENAME) |
| 225 | filename = os.path.join(citation_dir(app), '..', CITE_FILENAME) |
208 | 226 | if not os.path.exists(filename): |
209 | 227 | return |
210 | 228 | import cPickle |
211 | 229 | file = open(filename, 'rb') |
212 | | try: |
213 | | cache = cPickle.load(file) |
214 | | except: |
215 | | app.warn("Cache file '%s' is corrupted; ignoring it..."% filename) |
216 | | return |
217 | | else: |
218 | | app.builder.info("done (%s citations)."%len(cache)) |
219 | | finally: |
220 | | file.close() |
| 230 | cache = cPickle.load(file) |
| 231 | file.close() |
| 232 | app.builder.info("done (%s citations)."%len(cache)) |
221 | 233 | cite = env.citations |
222 | 234 | for ind, (path, tag) in cache.iteritems(): |
223 | 235 | if ind not in cite: # don't override local citation |
diff --git a/doc/en/reference/conf.py b/doc/en/reference/conf.py
a
|
b
|
|
115 | 115 | 'rings', |
116 | 116 | 'rings_numerical', |
117 | 117 | 'rings_standard', |
| 118 | 'sat', |
118 | 119 | 'schemes', |
119 | 120 | 'semirings', |
120 | 121 | 'stats', |