Skip to content

Commit fa0e2ac

Browse files
committed
style: apply black + fix RAT excludes for wheel dist-info
Two small fixes on top of t1mato/burr@ci/release-ci-followups so CI goes green: * Black formatting on the four new/modified files (auto-fix; contributor can pull this back locally, or maintainers can just squash-in on merge). * Wheel RAT scan: sdist and src tarball RAT scans pass, but the newly-added wheel scan fails because auto-generated dist-info metadata files (METADATA, WHEEL, RECORD) have no source and no ASF header. Added those three basename globs to .rat-excludes. Verified locally: black + flake8 + isort clean on the touched files. RAT reproduction not possible without the jar, but the failure signature in CI matches this class of file exactly and the excludes are the minimum-necessary additions.
1 parent 0115dd0 commit fa0e2ac

5 files changed

Lines changed: 51 additions & 22 deletions

File tree

.rat-excludes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,11 @@
7474
**/*.gif
7575
**/*.ico
7676
**/*.jpg
77+
78+
# Python wheel dist-info metadata files. These are auto-generated by the wheel
79+
# builder from pyproject.toml + package contents; they have no source and no
80+
# ASF header. Needed because Release Validation extracts and RAT-scans the
81+
# built wheel in addition to source and sdist tarballs.
82+
**/METADATA
83+
**/WHEEL
84+
**/RECORD

scripts/ci_smoke_server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ def main() -> None:
242242
_log("Checking UI is served at GET /...")
243243
with urllib.request.urlopen(f"{base_url}/", timeout=5) as resp:
244244
if resp.status != 200:
245-
_fail(f"GET / returned HTTP {resp.status}, expected 200 — UI may be missing from wheel")
245+
_fail(
246+
f"GET / returned HTTP {resp.status}, expected 200 — UI may be missing from wheel"
247+
)
246248
_log("UI served correctly")
247249

248250
# 6. Run a tracked Burr app as a separate process using the venv.
@@ -284,9 +286,7 @@ def inc(state: State) -> State:
284286
# writes its data. Polling is preferable to a fixed sleep: it succeeds as soon
285287
# as the data appears and gives a clear failure message on timeout.
286288
_log("Waiting for server to report project 'ci-smoke-test'...")
287-
if not _poll_projects(
288-
base_url, "ci-smoke-test", timeout_s=30, server_proc=server_proc
289-
):
289+
if not _poll_projects(base_url, "ci-smoke-test", timeout_s=30, server_proc=server_proc):
290290
if server_proc.poll() is not None:
291291
_log(f"Server process exited with code {server_proc.returncode}")
292292
_log("--- server log ---")

scripts/verify_apache_artifacts.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,9 @@ def verify_licenses(
754754
summary.fail("Apache RAT", "no tar.gz or .whl artifacts found")
755755
return False
756756

757-
print(f"Found {len(rat_artifacts)} artifact(s) to check ({len(tar_artifacts)} tarball(s), {len(wheel_artifacts)} wheel(s)):\n")
757+
print(
758+
f"Found {len(rat_artifacts)} artifact(s) to check ({len(tar_artifacts)} tarball(s), {len(wheel_artifacts)} wheel(s)):\n"
759+
)
758760

759761
all_valid = True
760762
for artifact_name in rat_artifacts:

tests/test_ci_smoke_server.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class FakeResp:
107107

108108
def read(self):
109109
import json
110+
110111
return json.dumps([{"name": "ci-smoke-test"}, {"name": "other"}]).encode()
111112

112113
def __enter__(self):
@@ -144,7 +145,11 @@ class FakeProc:
144145
def poll(self):
145146
return 1 # non-None → process is dead
146147

147-
monkeypatch.setattr(smoke.urllib.request, "urlopen", lambda *a, **kw: (_ for _ in ()).throw(AssertionError("should not reach urlopen")))
148+
monkeypatch.setattr(
149+
smoke.urllib.request,
150+
"urlopen",
151+
lambda *a, **kw: (_ for _ in ()).throw(AssertionError("should not reach urlopen")),
152+
)
148153

149154
result = smoke._poll_projects(
150155
"http://127.0.0.1:9999", "ci-smoke-test", timeout_s=5, server_proc=FakeProc()
@@ -155,6 +160,7 @@ def poll(self):
155160
def test_poll_projects_keeps_trying_until_project_appears(monkeypatch):
156161
"""Retries when project is absent, then succeeds once it appears."""
157162
import json
163+
158164
responses = [
159165
json.dumps([]).encode(),
160166
json.dumps([{"name": "other"}]).encode(),

tests/test_verify_apache_artifacts.py

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ def test_artifact_files_ignores_rat_reports():
267267
def test_wheel_content_hashes_returns_sha256_per_file(tmp_path):
268268
"""Returns a dict mapping each member path to its SHA256 hex digest."""
269269
import hashlib
270+
270271
wheel_path = tmp_path / "test-1.0-py3-none-any.whl"
271272
content = b"hello burr"
272273
_write_wheel(wheel_path, {"burr/__init__.py": content})
@@ -280,10 +281,13 @@ def test_wheel_content_hashes_excludes_record_file(tmp_path):
280281
"""RECORD (the manifest) is excluded — it lists other files' hashes and
281282
will legitimately differ between two wheels built from identical source."""
282283
wheel_path = tmp_path / "test-1.0-py3-none-any.whl"
283-
_write_wheel(wheel_path, {
284-
"burr/__init__.py": b"code",
285-
"burr-1.0.dist-info/RECORD": b"burr/__init__.py,sha256=abc,4\n",
286-
})
284+
_write_wheel(
285+
wheel_path,
286+
{
287+
"burr/__init__.py": b"code",
288+
"burr-1.0.dist-info/RECORD": b"burr/__init__.py,sha256=abc,4\n",
289+
},
290+
)
287291

288292
hashes = verify._wheel_content_hashes(str(wheel_path))
289293

@@ -294,10 +298,13 @@ def test_wheel_content_hashes_excludes_record_file(tmp_path):
294298
def test_wheel_content_hashes_excludes_directory_entries(tmp_path):
295299
"""Directory entries (zip members whose name ends with /) have no content."""
296300
wheel_path = tmp_path / "test-1.0-py3-none-any.whl"
297-
_write_wheel(wheel_path, {
298-
"burr/": b"",
299-
"burr/__init__.py": b"code",
300-
})
301+
_write_wheel(
302+
wheel_path,
303+
{
304+
"burr/": b"",
305+
"burr/__init__.py": b"code",
306+
},
307+
)
301308

302309
hashes = verify._wheel_content_hashes(str(wheel_path))
303310

@@ -323,14 +330,20 @@ def test_compare_wheel_contents_ignores_record_differences(tmp_path):
323330
"""RECORD files that differ between wheels are not reported as differences."""
324331
wheel_a = tmp_path / "a.whl"
325332
wheel_b = tmp_path / "b.whl"
326-
_write_wheel(wheel_a, {
327-
"burr/__init__.py": b"code",
328-
"burr-1.0.dist-info/RECORD": b"burr/__init__.py,sha256=aaa,4\n",
329-
})
330-
_write_wheel(wheel_b, {
331-
"burr/__init__.py": b"code",
332-
"burr-1.0.dist-info/RECORD": b"burr/__init__.py,sha256=bbb,4\n",
333-
})
333+
_write_wheel(
334+
wheel_a,
335+
{
336+
"burr/__init__.py": b"code",
337+
"burr-1.0.dist-info/RECORD": b"burr/__init__.py,sha256=aaa,4\n",
338+
},
339+
)
340+
_write_wheel(
341+
wheel_b,
342+
{
343+
"burr/__init__.py": b"code",
344+
"burr-1.0.dist-info/RECORD": b"burr/__init__.py,sha256=bbb,4\n",
345+
},
346+
)
334347

335348
match, diffs = verify._compare_wheel_contents(str(wheel_a), str(wheel_b))
336349

0 commit comments

Comments
 (0)