Khaleel Al-Adhami 1 týždeň pred
rodič
commit
8dc65874eb
1 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 3 3
      scripts/hatch_build.py

+ 3 - 3
scripts/hatch_build.py

@@ -126,12 +126,12 @@ def yaml_dump(o: Any, **kwargs: Any) -> str:
             for file, old, new in patches:
             for file, old, new in patches:
                 file_path = pathlib.Path(file)
                 file_path = pathlib.Path(file)
                 file_content = file_path.read_text()
                 file_content = file_path.read_text()
-                if file_content != new and file_content != old:
+                if new not in file_content and old not in file_content:
                     raise RuntimeError(
                     raise RuntimeError(
                         f"Unexpected content in {file_path}. Did you update pre-commit without updating the patches?"
                         f"Unexpected content in {file_path}. Did you update pre-commit without updating the patches?"
                     )
                     )
-                if file_content == old:
-                    file_path.write_text(new)
+                if old in file_content:
+                    file_path.write_text(file_content.replace(old, new))
 
 
         if not (pathlib.Path(self.root) / "scripts").exists():
         if not (pathlib.Path(self.root) / "scripts").exists():
             return
             return