[Python-checkins] r65632 - in doctools/trunk: CHANGES doc/config.rst sphinx/builder.py sphinx/config.py sphinx/environment.py sphinx/quickstart.py

georg.brandl python-checkins at python.org
Sun Aug 10 19:21:08 CEST 2008


Author: georg.brandl
Date: Sun Aug 10 19:21:08 2008
New Revision: 65632

Log:
Add exclude_dirnames value.


Modified:
   doctools/trunk/CHANGES
   doctools/trunk/doc/config.rst
   doctools/trunk/sphinx/builder.py
   doctools/trunk/sphinx/config.py
   doctools/trunk/sphinx/environment.py
   doctools/trunk/sphinx/quickstart.py

Modified: doctools/trunk/CHANGES
==============================================================================
--- doctools/trunk/CHANGES	(original)
+++ doctools/trunk/CHANGES	Sun Aug 10 19:21:08 2008
@@ -47,6 +47,9 @@
 
 * Glossary entries are now automatically added to the index.
 
+* Added ``exclude_dirnames`` config value that can be used to exclude
+  e.g. CVS directories from source file search.
+
 * ``Sphinx.add_node()`` now takes optional visitor methods for the
   HTML, LaTeX and text translators; this prevents having to manually
   patch the classes.

Modified: doctools/trunk/doc/config.rst
==============================================================================
--- doctools/trunk/doc/config.rst	(original)
+++ doctools/trunk/doc/config.rst	Sun Aug 10 19:21:08 2008
@@ -80,20 +80,32 @@
    toctree.  Use this setting to suppress the warning that is normally emitted
    in that case.
 
-.. confval:: exclude_dirs
+.. confval:: exclude_trees
 
-   A list of directory names, relative to the source directory, that are to be
-   excluded from the search for source files.
+   A list of directory paths, relative to the source directory, that are to be
+   recursively excluded from the search for source files, that is, their
+   subdirectories won't be searched too.  The default is ``[]``.
 
-   .. versionadded:: 0.3
+   .. versionadded:: 0.4
 
-.. confval:: exclude_trees
+.. confval:: exclude_dirnames
+
+   A list of directory names that are to be excluded from any recursive
+   operation Sphinx performs (e.g. searching for source files or copying static
+   files).  This is useful, for example, to exclude version-control-specific
+   directories like ``'CVS'``.  The default is ``[]``.
+
+   .. versionadded:: 0.5
+
+.. confval:: exclude_dirs
 
    A list of directory names, relative to the source directory, that are to be
-   recursively exlucded from the search for source files, that is, their
-   subdirectories won't be searched too.
+   excluded from the search for source files.
 
-   .. versionadded:: 0.4
+   .. deprecated:: 0.5
+      This does not take subdirs of the excluded directories into account.  Use
+      :confval:`exclude_trees` or :confval:`exclude_dirs`, which match the
+      expectations.
 
 .. confval:: locale_dirs
 

Modified: doctools/trunk/sphinx/builder.py
==============================================================================
--- doctools/trunk/sphinx/builder.py	(original)
+++ doctools/trunk/sphinx/builder.py	Sun Aug 10 19:21:08 2008
@@ -639,6 +639,8 @@
                 if path.isfile(fullname):
                     shutil.copyfile(fullname, targetname)
                 elif path.isdir(fullname):
+                    if filename in self.config.exclude_dirnames:
+                        continue
                     if path.exists(targetname):
                         shutil.rmtree(targetname)
                     shutil.copytree(fullname, targetname)

Modified: doctools/trunk/sphinx/config.py
==============================================================================
--- doctools/trunk/sphinx/config.py	(original)
+++ doctools/trunk/sphinx/config.py	Sun Aug 10 19:21:08 2008
@@ -38,6 +38,7 @@
         unused_docs = ([], True),
         exclude_dirs = ([], True),
         exclude_trees = ([], True),
+        exclude_dirnaems = ([], True),
         default_role = (None, True),
         add_function_parentheses = (True, True),
         add_module_names = (True, True),

Modified: doctools/trunk/sphinx/environment.py
==============================================================================
--- doctools/trunk/sphinx/environment.py	(original)
+++ doctools/trunk/sphinx/environment.py	Sun Aug 10 19:21:08 2008
@@ -347,7 +347,7 @@
         self.found_docs = set(get_matching_docs(
             self.srcdir, config.source_suffix, exclude_docs=set(config.unused_docs),
             exclude_dirs=exclude_dirs, exclude_trees=exclude_trees,
-            exclude_dirnames=['_sources']))
+            exclude_dirnames=['_sources'] + config.exclude_dirnames))
 
     def get_outdated_files(self, config_changed):
         """

Modified: doctools/trunk/sphinx/quickstart.py
==============================================================================
--- doctools/trunk/sphinx/quickstart.py	(original)
+++ doctools/trunk/sphinx/quickstart.py	Sun Aug 10 19:21:08 2008
@@ -31,15 +31,15 @@
 # The contents of this file are pickled, so don't put values in the namespace
 # that aren't pickleable (module imports are okay, they're removed automatically).
 #
-# All configuration values have a default value; values that are commented out
-# serve to show the default value.
+# All configuration values have a default; values that are commented out
+# serve to show the default.
 
 import sys, os
 
 # If your extensions are in another directory, add it here. If the directory
 # is relative to the documentation root, use os.path.abspath to make it
 # absolute, like shown here.
-#sys.path.append(os.path.abspath('some/directory'))
+#sys.path.append(os.path.abspath('.'))
 
 # General configuration
 # ---------------------
@@ -57,19 +57,21 @@
 # The master toctree document.
 master_doc = '%(master)s'
 
-# General substitutions.
+# General information about the project.
 project = u'%(project)s'
 copyright = u'%(copyright)s'
 
-# The default replacements for |version| and |release|, also used in various
-# other places throughout the built documents.
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
 #
 # The short X.Y version.
 version = '%(version)s'
 # The full version, including alpha/beta/rc tags.
 release = '%(release)s'
 
-# The language for content autogenerated by Sphinx
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
 #language = None
 
 # There are two options for replacing |today|: either, you set today to some
@@ -81,7 +83,7 @@
 # List of documents that shouldn't be included in the build.
 #unused_docs = []
 
-# List of directories, relative to source directories, that shouldn't be searched
+# List of directories, relative to source directory, that shouldn't be searched
 # for source files.
 exclude_trees = [%(exclude_trees)s]
 


More information about the Python-checkins mailing list