diff options
| author | Georg Brandl <georg@python.org> | 2014-01-19 19:13:17 +0100 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2014-01-19 19:13:17 +0100 |
| commit | cd7658dde7f32714f4e6013cd221a9ea6e88bb82 (patch) | |
| tree | 329d1f0abf16c75666013bc877f7532a21663398 /sphinx/util | |
| parent | 2a8cf7c7781a4554adbcb4bae6bec2a40bfc156d (diff) | |
| parent | 468198f91b0a41056c46c25f8cedf5c528c97564 (diff) | |
| download | sphinx-cd7658dde7f32714f4e6013cd221a9ea6e88bb82.tar.gz | |
merge with stable
Diffstat (limited to 'sphinx/util')
| -rw-r--r-- | sphinx/util/__init__.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 5cbbb61b..a20fc19b 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -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 = '''\ |
