rusackas commented on code in PR #40395:
URL: https://github.com/apache/superset/pull/40395#discussion_r3328118659
##########
scripts/translations/backfill_po.py:
##########
@@ -510,6 +536,8 @@ def backfill(
with open(index_path, encoding="utf-8") as f:
index: dict[str, Any] = json.load(f)
+ _ensure_license_header(po_path)
+
Review Comment:
Fixed. Added a `dry_run` parameter to `_ensure_license_header` so it prints
a `[dry-run]` notice but skips the write when the flag is set. The `backfill()`
caller now passes `dry_run=dry_run` through. hainenber confirmed this — thanks
for catching it.
##########
scripts/translations/backfill_po.py:
##########
@@ -95,6 +113,14 @@
}
+def _ensure_license_header(po_path: Path) -> None:
+ """Prepend the ASF license header to the .po file if it is missing."""
+ content = po_path.read_text(encoding="utf-8")
+ if "Licensed to the Apache Software Foundation" not in content:
+ po_path.write_text(_ASF_LICENSE_HEADER + content, encoding="utf-8")
+ print(f"Added ASF license header to {po_path}", file=sys.stderr)
Review Comment:
Good call. Added three tests in `backfill_po_test.py` covering the three
cases: header prepended when absent, skipped when already present, and no-write
under `dry_run=True`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]