Add exclude_dirnames value.

This commit is contained in:
Georg Brandl
2008-08-10 17:21:08 +00:00
parent b3f1de1bf7
commit 74d52b40bc
6 changed files with 38 additions and 18 deletions

View File

@@ -47,6 +47,9 @@ New features added
* 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.

View File

@@ -80,20 +80,32 @@ General configuration
toctree. Use this setting to suppress the warning that is normally emitted
in that case.
.. confval:: exclude_trees
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.4
.. 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
excluded from the search for source files.
.. versionadded:: 0.3
.. confval:: exclude_trees
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.
.. 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

View File

@@ -639,6 +639,8 @@ class StandaloneHTMLBuilder(Builder):
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)

View File

@@ -38,6 +38,7 @@ class Config(object):
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),

View File

@@ -347,7 +347,7 @@ class BuildEnvironment:
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):
"""

View File

@@ -31,15 +31,15 @@ QUICKSTART_CONF = '''\
# 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 @@ source_suffix = '%(suffix)s'
# 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 @@ release = '%(release)s'
# 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]