mirror of
https://github.com/Klotzkette/claude-fuer-deutsches-recht
synced 2026-06-09 10:03:19 +00:00
feat(v61.0.0): boost corporate ma deal os
This commit is contained in:
@@ -18,8 +18,32 @@ ROOT = Path(__file__).resolve().parent.parent
|
||||
TESTAKTEN = ROOT / "testakten"
|
||||
|
||||
|
||||
def fs_path(path: Path) -> Path:
|
||||
"""Return a Windows long-path-safe Path without changing display paths."""
|
||||
if sys.platform != "win32":
|
||||
return path
|
||||
resolved = str(path.resolve())
|
||||
if resolved.startswith("\\\\?\\"):
|
||||
return Path(resolved)
|
||||
if resolved.startswith("\\\\"):
|
||||
return Path("\\\\?\\UNC\\" + resolved[2:])
|
||||
return Path("\\\\?\\" + resolved)
|
||||
|
||||
|
||||
def path_exists(path: Path) -> bool:
|
||||
return fs_path(path).exists()
|
||||
|
||||
|
||||
def read_bytes(path: Path) -> bytes:
|
||||
return fs_path(path).read_bytes()
|
||||
|
||||
|
||||
def read_text(path: Path) -> str:
|
||||
return fs_path(path).read_text(encoding="utf-8", errors="replace")
|
||||
|
||||
|
||||
def is_probable_pdf(path: Path) -> str | None:
|
||||
data = path.read_bytes()
|
||||
data = read_bytes(path)
|
||||
if len(data) < 1024:
|
||||
return "PDF ist kleiner als 1 KB"
|
||||
if not data.startswith(b"%PDF"):
|
||||
@@ -38,11 +62,11 @@ def main() -> int:
|
||||
slug = d.name
|
||||
pdf = d / "gesamt-pdf" / f"{slug}_gesamt.pdf"
|
||||
gesamt_dir = d / "gesamt-pdf"
|
||||
if not pdf.exists():
|
||||
if not path_exists(pdf):
|
||||
errors.append(f"{slug}: fehlt {pdf.relative_to(ROOT)}")
|
||||
continue
|
||||
extra_pdfs = []
|
||||
if gesamt_dir.exists():
|
||||
if path_exists(gesamt_dir):
|
||||
extra_pdfs = sorted(p for p in gesamt_dir.glob("*.pdf") if p != pdf)
|
||||
if extra_pdfs:
|
||||
listed = ", ".join(str(p.relative_to(ROOT)) for p in extra_pdfs)
|
||||
@@ -51,9 +75,9 @@ def main() -> int:
|
||||
if problem:
|
||||
errors.append(f"{slug}: {problem}: {pdf.relative_to(ROOT)}")
|
||||
readme_candidates = [d / "README.md"] + sorted(d.glob("00_*.md")) + sorted(d.glob("aktenuebersicht*.md"))
|
||||
readme = next((p for p in readme_candidates if p.exists()), None)
|
||||
readme = next((p for p in readme_candidates if path_exists(p)), None)
|
||||
if readme:
|
||||
text = readme.read_text(encoding="utf-8", errors="replace")
|
||||
text = read_text(readme)
|
||||
rel = f"gesamt-pdf/{slug}_gesamt.pdf"
|
||||
if rel not in text:
|
||||
errors.append(f"{slug}: {readme.name} verlinkt {rel} nicht")
|
||||
|
||||
Reference in New Issue
Block a user