Official Inference Code of EAGLE-4
fix(pkg): keep added License-File headers out of a description-less METADATA
Seyfal Sultanov92dc856adde2
diff --git a/tests/test_add_wheel_notices.py b/tests/test_add_wheel_notices.pyindex 53afe80..6945f0d 100644--- a/tests/test_add_wheel_notices.py+++ b/tests/test_add_wheel_notices.py@@ -82,3 +82,21 @@ def test_refuses_to_overwrite(tmp_path, wheel):MODULE.add_notices(source, tmp_path / "out", "1eagle", {"THIRDPARTYNOTICES.txt": notice})with pytest.raises(FileExistsError):MODULE.add_notices(source, tmp_path / "out", "1eagle", {"THIRDPARTYNOTICES.txt": notice})+++def test_metadata_without_description_keeps_license_file_in_headers(tmp_path, wheel):+ source, notice = wheel+ bare = tmp_path / "bare" / source.name+ bare.parent.mkdir()+ with zipfile.ZipFile(source) as original, zipfile.ZipFile(bare, "w") as archive:+ for name in original.namelist():+ data = original.read(name)+ if name == f"{INFO}/METADATA":+ data = b"Metadata-Version: 2.4\nName: sglang-kernel\nVersion: 0.4.7\n"+ archive.writestr(original.getinfo(name), data)+ receipt = MODULE.add_notices(bare, tmp_path / "out", "1eagle", {"THIRDPARTYNOTICES.txt": notice})+ with zipfile.ZipFile(tmp_path / "out" / receipt["output"]) as archive:+ metadata = archive.read(f"{INFO}/METADATA").decode()+ assert metadata == (+ "Metadata-Version: 2.4\nName: sglang-kernel\nVersion: 0.4.7\nLicense-File: THIRDPARTYNOTICES.txt\n"+ )diff --git a/tools/add_wheel_notices.py b/tools/add_wheel_notices.pyindex d58c28d..4fc6a09 100644--- a/tools/add_wheel_notices.py+++ b/tools/add_wheel_notices.py@@ -62,9 +62,10 @@ def add_notices(source: Path, destination: Path, build: str, notices: dict[str,raise ValueError("wheel already has a build tag")meta_text = original.read(metadata).decode()head, separator, body = meta_text.partition("\n\n")- head += "".join(f"\nLicense-File: {name}" for name in notices)+ # A METADATA without a description has no blank line: keep the new headers out of a body.+ head = head.rstrip("\n") + "".join(f"\nLicense-File: {name}" for name in notices)changes = {- metadata: (head + separator + body).encode(),+ metadata: (head + (separator + body if separator else "\n")).encode(),wheel: (wheel_text.rstrip("\n") + f"\nBuild: {build}\n").encode(),}payload, rows = {}, []