mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Don't try to build copied sources if source suffix is .txt.
This commit is contained in:
parent
325750aa76
commit
0de9d7db7a
8
CHANGES
8
CHANGES
@ -4,6 +4,14 @@ Changes in trunk
|
||||
* 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)
|
||||
================================
|
||||
|
||||
|
@ -475,7 +475,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
# 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 @@ class StandaloneHTMLBuilder(Builder):
|
||||
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 @@ class StandaloneHTMLBuilder(Builder):
|
||||
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 @@ class WebHTMLBuilder(StandaloneHTMLBuilder):
|
||||
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 @@ class WebHTMLBuilder(StandaloneHTMLBuilder):
|
||||
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 @@ class ChangesBuilder(Builder):
|
||||
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,
|
||||
|
@ -323,7 +323,8 @@ class BuildEnvironment:
|
||||
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
|
||||
|
@ -50,7 +50,7 @@ def ensuredir(path):
|
||||
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 @@ def get_matching_docs(dirname, suffix, exclude=()):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user