mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
added IGNORE_FILES setting for autoreload
This commit is contained in:
parent
a7b18515a1
commit
0288bf1f68
3 changed files with 9 additions and 6 deletions
|
|
@ -10,6 +10,7 @@ import traceback
|
|||
import logging
|
||||
import errno
|
||||
import locale
|
||||
import fnmatch
|
||||
from collections import defaultdict, Hashable
|
||||
from functools import partial
|
||||
|
||||
|
|
@ -406,8 +407,7 @@ def process_translations(content_list):
|
|||
|
||||
LAST_MTIME = 0
|
||||
|
||||
|
||||
def files_changed(path, extensions):
|
||||
def files_changed(path, extensions, ignores=[]):
|
||||
"""Return True if the files have changed since the last check"""
|
||||
|
||||
def file_times(path):
|
||||
|
|
@ -415,7 +415,8 @@ def files_changed(path, extensions):
|
|||
for root, dirs, files in os.walk(path):
|
||||
dirs[:] = [x for x in dirs if x[0] != '.']
|
||||
for f in files:
|
||||
if any(f.endswith(ext) for ext in extensions):
|
||||
if any(f.endswith(ext) for ext in extensions) \
|
||||
and not any(fnmatch.fnmatch(f, ignore) for ignore in ignores):
|
||||
yield os.stat(os.path.join(root, f)).st_mtime
|
||||
|
||||
global LAST_MTIME
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue