[Python-checkins] r65146 - in doctools/branches/0.4.x: CHANGES sphinx/directives/other.py sphinx/environment.py
georg.brandl
python-checkins at python.org
Sat Jul 19 20:01:51 CEST 2008
Author: georg.brandl
Date: Sat Jul 19 20:01:51 2008
New Revision: 65146
Log:
Reread documents with globbed toctrees when files are removed/added.
Modified:
doctools/branches/0.4.x/CHANGES
doctools/branches/0.4.x/sphinx/directives/other.py
doctools/branches/0.4.x/sphinx/environment.py
Modified: doctools/branches/0.4.x/CHANGES
==============================================================================
--- doctools/branches/0.4.x/CHANGES (original)
+++ doctools/branches/0.4.x/CHANGES Sat Jul 19 20:01:51 2008
@@ -1,6 +1,9 @@
Release 0.4.2 (in development)
==============================
+* Reread documents with globbed toctrees when source files are
+ added or removed.
+
* Add a missing parameter to PickleHTMLBuilder.handle_page().
* Put inheritance info always on its own line.
Modified: doctools/branches/0.4.x/sphinx/directives/other.py
==============================================================================
--- doctools/branches/0.4.x/sphinx/directives/other.py (original)
+++ doctools/branches/0.4.x/sphinx/directives/other.py Sat Jul 19 20:01:51 2008
@@ -69,6 +69,7 @@
subnode['includefiles'] = includefiles
subnode['includetitles'] = includetitles
subnode['maxdepth'] = options.get('maxdepth', -1)
+ subnode['glob'] = glob
ret.append(subnode)
return ret
Modified: doctools/branches/0.4.x/sphinx/environment.py
==============================================================================
--- doctools/branches/0.4.x/sphinx/environment.py (original)
+++ doctools/branches/0.4.x/sphinx/environment.py Sat Jul 19 20:01:51 2008
@@ -63,7 +63,7 @@
# This is increased every time an environment attribute is added
# or changed to properly invalidate pickle files.
-ENV_VERSION = 24
+ENV_VERSION = 25
default_substitutions = set([
@@ -242,6 +242,7 @@
self.toctree_includes = {} # docname -> list of toctree includefiles
self.files_to_rebuild = {} # docname -> set of files (containing its TOCs)
# to rebuild too
+ self.glob_toctrees = set() # docnames that have :glob: toctrees
# X-ref target inventory
self.descrefs = {} # fullname -> docname, desctype
@@ -296,6 +297,7 @@
self.toctree_includes.pop(docname, None)
self.filemodules.pop(docname, None)
self.indexentries.pop(docname, None)
+ self.glob_toctrees.discard(docname)
for subfn, fnset in self.files_to_rebuild.items():
fnset.discard(docname)
@@ -420,7 +422,14 @@
self.srcdir = srcdir
self.doctreedir = doctreedir
self.find_files(config)
+
added, changed, removed = self.get_outdated_files(config_changed)
+
+ # if files were added or removed, all documents with globbed toctrees
+ # must be reread
+ if added or removed:
+ changed.update(self.glob_toctrees)
+
msg += '%s added, %s changed, %s removed' % (len(added), len(changed),
len(removed))
yield msg
@@ -641,6 +650,8 @@
def note_toctree(self, docname, toctreenode):
"""Note a TOC tree directive in a document and gather information about
file relations from it."""
+ if toctreenode['glob']:
+ self.glob_toctrees.add(docname)
includefiles = toctreenode['includefiles']
for includefile in includefiles:
# note that if the included file is rebuilt, this one must be
More information about the Python-checkins
mailing list