Closes #1330: Fix :confval:exclude_patterns behavior with subdirectories in the :confval:html_static_path.

This commit is contained in:
Georg Brandl 2014-01-19 18:10:19 +01:00
parent 48aeed6fd8
commit 5dcf03fb2d
2 changed files with 14 additions and 12 deletions

View File

@ -116,6 +116,9 @@ Bugs fixed
* #1283: Fix a bug in the detection of changed files that would try to access
doctrees of deleted documents.
* #1330: Fix :confval:`exclude_patterns` behavior with subdirectories in the
:confval:`html_static_path`.
Documentation
-------------

View File

@ -158,18 +158,17 @@ def copy_static_entry(source, targetdir, builder, context={},
else:
copyfile(source, target)
elif path.isdir(source):
if level == 0:
for entry in os.listdir(source):
if entry.startswith('.'):
continue
copy_static_entry(path.join(source, entry), targetdir,
builder, context, level=1,
exclude_matchers=exclude_matchers)
else:
target = path.join(targetdir, path.basename(source))
if path.exists(target):
shutil.rmtree(target)
shutil.copytree(source, target)
if not path.isdir(targetdir):
os.mkdir(targetdir)
for entry in os.listdir(source):
if entry.startswith('.'):
continue
newtarget = targetdir
if path.isdir(path.join(source, entry)):
newtarget = path.join(targetdir, entry)
copy_static_entry(path.join(source, entry), newtarget,
builder, context, level=level+1,
exclude_matchers=exclude_matchers)
_DEBUG_HEADER = '''\