From 2fd67741342e122c689ea731af38e1ea1c53869d Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Fri, 20 Dec 2024 19:59:33 -0500 Subject: [PATCH] FIX: When --- tools/hooks/sync_dependencies.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/hooks/sync_dependencies.py b/tools/hooks/sync_dependencies.py index 0878a5f56eb..baba1643d72 100755 --- a/tools/hooks/sync_dependencies.py +++ b/tools/hooks/sync_dependencies.py @@ -4,6 +4,7 @@ # License: BSD-3-Clause # Copyright the MNE-Python contributors. +import difflib import re from importlib.metadata import metadata from pathlib import Path @@ -92,4 +93,9 @@ def _prettify_pin(pin): skip = False if not skip: out_lines.append(line) -README_PATH.write_text("\n".join(out_lines) + "\n", encoding="utf-8") +new = "\n".join(out_lines) + "\n" +old = README_PATH.read_text("utf-8") +if new != old: + diff = "\n".join(difflib.unified_diff(old.splitlines(), new.splitlines())) + print(f"Updating {README_PATH} with diff:\n{diff}") + README_PATH.write_text(new, encoding="utf-8")