[Python-checkins] r61804 - in doctools/trunk: CHANGES sphinx/builder.py sphinx/environment.py sphinx/util/__init__.py

georg.brandl python-checkins at python.org
Sun Mar 23 19:26:25 CET 2008


Author: georg.brandl
Date: Sun Mar 23 19:26:24 2008
New Revision: 61804

Modified:
   doctools/trunk/CHANGES
   doctools/trunk/sphinx/builder.py
   doctools/trunk/sphinx/environment.py
   doctools/trunk/sphinx/util/__init__.py
Log:
Don't try to build copied sources if source suffix is .txt.


Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Sun Mar 23 19:26:24 2008
@@ -4,6 +4,14 @@
 * sphinx.quickstart: Really don't create a makefile if the user
   doesn't want one.
 
+* setup: Don't install scripts twice, via setuptools entry points
+  and distutils scripts.  Only install via entry points.
+
+* sphinx.builder: Don't recognize the HTML builder's copied source
+  files (under _sources) as input files if the source suffix is
+  ``.txt``.
+
+
 Release 0.1.61798 (Mar 23, 2008)
 ================================
 

Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py	(original)
+++ doctools/trunk/sphinx/builder.py	Sun Mar 23 19:26:24 2008
@@ -475,7 +475,7 @@
         # dump the search index
         self.handle_finish()
 
-    # --------- these are overwritten by the Web builder
+    # --------- these are overwritten by the Pickle builder
 
     def get_target_uri(self, docname, typ=None):
         return docname + '.html'
@@ -483,7 +483,8 @@
     def get_outdated_docs(self):
         for docname in get_matching_docs(
             self.srcdir, self.config.source_suffix,
-            exclude=set(self.config.unused_docs)):
+            exclude=set(self.config.unused_docs),
+            prune=['_sources']):
             targetname = self.env.doc2path(docname, self.outdir, '.html')
             try:
                 targetmtime = path.getmtime(targetname)
@@ -555,11 +556,11 @@
             f.close()
 
 
-class WebHTMLBuilder(StandaloneHTMLBuilder):
+class PickleHTMLBuilder(StandaloneHTMLBuilder):
     """
-    Builds HTML docs usable with the web-based doc server.
+    Builds HTML docs without rendering templates.
     """
-    name = 'web'
+    name = 'pickle'
 
     def init(self):
         self.init_translator_class()
@@ -567,7 +568,8 @@
     def get_outdated_docs(self):
         for docname in get_matching_docs(
             self.srcdir, self.config.source_suffix,
-            exclude=set(self.config.unused_docs)):
+            exclude=set(self.config.unused_docs),
+            prune=['_sources']):
             targetname = self.env.doc2path(docname, self.outdir, '.fpickle')
             try:
                 targetmtime = path.getmtime(targetname)
@@ -613,7 +615,8 @@
         finally:
             f.close()
 
-        # if there is a source file, copy the source file for the "show source" link
+        # if there is a source file, copy the source file for the
+        # "show source" link
         if ctx.get('sourcename'):
             source_name = path.join(self.outdir, 'sources',
                                     os_path(ctx['sourcename']))
@@ -901,12 +904,16 @@
     def finish(self):
         pass
 
+# compatibility alias
+WebHTMLBuilder = PickleHTMLBuilder
+
 
 from sphinx.linkcheck import CheckExternalLinksBuilder
 
 builtin_builders = {
     'html': StandaloneHTMLBuilder,
-    'web': WebHTMLBuilder,
+    'pickle': PickleHTMLBuilder,
+    'web': PickleHTMLBuilder,
     'htmlhelp': HTMLHelpBuilder,
     'latex': LaTeXBuilder,
     'changes': ChangesBuilder,

Modified: doctools/trunk/sphinx/environment.py
==============================================================================
--- doctools/trunk/sphinx/environment.py	(original)
+++ doctools/trunk/sphinx/environment.py	Sun Mar 23 19:26:24 2008
@@ -323,7 +323,8 @@
         Return (added, changed, removed) sets.
         """
         self.found_docs = set(get_matching_docs(self.srcdir, config.source_suffix,
-                                                exclude=set(config.unused_docs)))
+                                                exclude=set(config.unused_docs),
+                                                prune=['_sources']))
 
         # clear all files no longer present
         removed = set(self.all_docs) - self.found_docs

Modified: doctools/trunk/sphinx/util/__init__.py
==============================================================================
--- doctools/trunk/sphinx/util/__init__.py	(original)
+++ doctools/trunk/sphinx/util/__init__.py	Sun Mar 23 19:26:24 2008
@@ -50,7 +50,7 @@
             raise
 
 
-def get_matching_docs(dirname, suffix, exclude=()):
+def get_matching_docs(dirname, suffix, exclude=(), prune=()):
     """
     Get all file names (without suffix) matching a suffix in a
     directory, recursively.
@@ -62,6 +62,9 @@
     for root, dirs, files in os.walk(dirname):
         dirs.sort()
         files.sort()
+        for prunedir in prune:
+            if prunedir in dirs:
+                dirs.remove(prunedir)
         for sfile in files:
             if not fnmatch.fnmatch(sfile, pattern):
                 continue


More information about the Python-checkins mailing list