mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Ignore subdirectories by pattern.
Ignore subdirectories by pattern from list in 'IGNORE_SUBDIRS' analogous to 'IGNORE_FILES'. Currently there is no way to ignore subdirectories like '.something' or '_hidden' by pattern, only full paths can be given in 'STATIC_EXCLUDES' etc.. This patch works like 'IGNORE_FILES' but on subdirectories.
This commit is contained in:
parent
cc8f835f07
commit
894051dfd3
1 changed files with 5 additions and 0 deletions
|
|
@ -139,6 +139,11 @@ class Generator(object):
|
||||||
for e in exclusions_by_dirpath.get(dirpath, ()):
|
for e in exclusions_by_dirpath.get(dirpath, ()):
|
||||||
if e in dirs:
|
if e in dirs:
|
||||||
dirs.remove(e)
|
dirs.remove(e)
|
||||||
|
for dir in dirs:
|
||||||
|
#check IGNORE_SUBDIRS
|
||||||
|
ignores = self.settings['IGNORE_SUBDIRS']
|
||||||
|
if any(fnmatch.fnmatch(dir, ignore) for ignore in ignores):
|
||||||
|
dirs.remove(dir)
|
||||||
reldir = os.path.relpath(dirpath, self.path)
|
reldir = os.path.relpath(dirpath, self.path)
|
||||||
for f in temp_files:
|
for f in temp_files:
|
||||||
fp = os.path.join(reldir, f)
|
fp = os.path.join(reldir, f)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue