From 6e3d5ef64b4c7ddf882a43bebab6b5293c120a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Fri, 23 Jan 2026 17:25:59 +0100 Subject: [PATCH] fix: don't watch external sources (#301) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit issue #294 Signed-off-by: Timothée Mazzucotelli --- python/zensical/config.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/zensical/config.py b/python/zensical/config.py index fd4031b..2a47f01 100644 --- a/python/zensical/config.py +++ b/python/zensical/config.py @@ -26,8 +26,8 @@ from __future__ import annotations import hashlib import importlib import os -from pathlib import Path import pickle +from pathlib import Path from typing import IO, Any from urllib.parse import urlparse @@ -480,9 +480,10 @@ def _list_sources(config: dict, config_file: str) -> list[tuple[str, int]]: .get("paths", ()) ) files_with_hash = [] + root = Path(config_file).parent.resolve() for python_path in python_paths: - path = Path(config_file).parent.joinpath(python_path).resolve() - if path.is_dir(): + path = root.joinpath(python_path).resolve() + if path.is_dir() and path.is_relative_to(root): for subpath in path.rglob("*"): # Path.rglob can't do patterns, so we need to filter here if subpath.suffix in { @@ -492,8 +493,8 @@ def _list_sources(config: dict, config_file: str) -> list[tuple[str, int]]: ".so", ".dll", }: - files_with_hash.extend( - [(str(subpath), int(os.path.getmtime(subpath)))] + files_with_hash.append( # noqa: PERF401 + (str(subpath), int(os.path.getmtime(subpath))) ) return sorted(files_with_hash)