From 09ef21af399a60ceb2e45526fe1a7dd94c53819c Mon Sep 17 00:00:00 2001 From: cirakg Date: Wed, 28 Oct 2026 11:45:11 +0100 Subject: chore: prepare repository for open-source release --- tools/gen_pdf417_tables.py | 5 ++++- tools/gen_qr_tables.py | 1 + tools/lint_project.py | 4 +++- tools/tests/test_lint_project.py | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/gen_pdf417_tables.py b/tools/gen_pdf417_tables.py index 7a66677..0e63c2d 100644 --- a/tools/gen_pdf417_tables.py +++ b/tools/gen_pdf417_tables.py @@ -27,7 +27,10 @@ from pdf417gen import codes, data SUBMODES = [data.UPPER, data.LOWER, data.MIXED, data.PUNCT] -HEADER = {"_author": "cirakg & claude ai"} +HEADER = { + "_author": "cirakg & claude ai", + "_license": "Derived from pdf417gen (MIT); see THIRD_PARTY_NOTICES.md and LICENSES/pdf417gen.txt.", +} def tables() -> dict[str, object]: diff --git a/tools/gen_qr_tables.py b/tools/gen_qr_tables.py index 68e6355..64c516a 100644 --- a/tools/gen_qr_tables.py +++ b/tools/gen_qr_tables.py @@ -50,6 +50,7 @@ def render(rows: list[list[int]]) -> str: "// Author: cirakg & claude ai\n" "// Summary: QR error-correction block structure per version and level (generated from segno; do not edit).\n" "//\n" + "// Derived from Segno (BSD-3-Clause). See THIRD_PARTY_NOTICES.md and LICENSES/segno.txt.\n" "// Generated by tools/gen_qr_tables.py. For version v (1-40) and level e (0 L, 1 M, 2 Q, 3 H), the five\n" "// numbers at index ((v - 1) * 4 + e) * 5 are: EC codewords per block, group-1 blocks, data codewords\n" "// per group-1 block, group-2 blocks, data codewords per group-2 block (ISO/IEC 18004 table 9).\n\n" diff --git a/tools/lint_project.py b/tools/lint_project.py index c1c225a..3fe7717 100644 --- a/tools/lint_project.py +++ b/tools/lint_project.py @@ -55,6 +55,8 @@ SKIP_DIRS = { } # Written by a tool that would drop a hand-added header on the next run. GENERATED = {Path("docker/docs/package-lock.json")} +# License texts must retain their upstream wording without project headers. +VERBATIM_LICENSES = {Path("LICENSE"), Path("LICENSES/segno.txt"), Path("LICENSES/pdf417gen.txt")} BASE32_SECRET_RE = re.compile(r'"[^"\n]*[A-Z2-7]{16,}[^"\n]*"') HEX_SECRET_RE = re.compile(r'"[^"\n]*[0-9a-fA-F]{32,}[^"\n]*"') @@ -141,7 +143,7 @@ def project_files(root: Path) -> list[Path]: def check_header(path: Path, rel: Path) -> Iterable[Problem]: """HDR001 for one file, by file type.""" - if rel in GENERATED: + if rel in GENERATED or rel in VERBATIM_LICENSES: return suffix = path.suffix.lower() if suffix == ".png": diff --git a/tools/tests/test_lint_project.py b/tools/tests/test_lint_project.py index 31f8125..c38b98f 100644 --- a/tools/tests/test_lint_project.py +++ b/tools/tests/test_lint_project.py @@ -106,6 +106,8 @@ def test_headers_are_required_in_every_file_type(tmp_path: Path) -> None: "data/ok.json": json.dumps({"_author": lp.AUTHOR, "_summary": "x"}), "data/bad.json": json.dumps({"author": "someone else", "description": "x"}), "docker/docs/package-lock.json": "{}", # generated, exempt + "LICENSE": "Verbatim license text, exempt from project headers.", + "LICENSES/segno.txt": "Verbatim upstream license, also exempt.", "build/out.txt": "ignored folder", } for name, text in files.items(): -- cgit v1.2.3