1
0
Fork 0
forked from github/pelican

don't watch not existing paths

This commit is contained in:
Deniz Turgut 2023-10-28 17:30:45 +03:00
commit b289dcea82
No known key found for this signature in database
GPG key ID: 87B7168D7AB3ED2F

View file

@ -764,21 +764,25 @@ def wait_for_changes(settings_file, reader_class, settings):
fnmatch.translate(pattern) for pattern in settings.get('IGNORE_FILES', [])
)
watching_paths = [
candidate_paths = [
settings_file,
theme_path,
content_path,
]
watching_paths.extend(
candidate_paths.extend(
os.path.join(content_path, path) for path in settings.get('STATIC_PATHS', [])
)
watching_paths = [os.path.abspath(p) for p in watching_paths if p]
for path in watching_paths:
watching_paths = []
for path in candidate_paths:
if not path:
continue
path = os.path.abspath(path)
if not os.path.exists(path):
logger.warning("Unable to watch path '%s' as it does not exist.", path)
else:
watching_paths.append(path)
return next(watchfiles.watch(
*watching_paths,