From d794f32039ba95aacb43ba3951e78bbc70656454 Mon Sep 17 00:00:00 2001 From: Martin Lehmann Date: Tue, 23 Dec 2025 14:06:32 +0100 Subject: [PATCH] fix excluded dir marker check When checking for markers that exclude the directory that contains them, the hook erroneously expected these markers to be directories instead of files. This breaks with the CACHEDIR.TAG spec, which explicitly states: > This file *must* be an ordinary file, not for example a symbolic link. --- src/maturin_import_hook/project_importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/maturin_import_hook/project_importer.py b/src/maturin_import_hook/project_importer.py index 61fcdd5..d399414 100644 --- a/src/maturin_import_hook/project_importer.py +++ b/src/maturin_import_hook/project_importer.py @@ -593,7 +593,7 @@ def get_files_in_dir( for dir_str, dirs, files in os.walk(root_path, topdown=True): dir_path = Path(dir_str) - include_dir = dir_path not in ignore_dirs and not any(dir_name in excluded_dir_markers for dir_name in dirs) + include_dir = dir_path not in ignore_dirs and not any(name in excluded_dir_markers for name in files) if include_dir: dirs[:] = sorted(dir_name for dir_name in dirs if dir_name not in excluded_dir_names)