Skip to content

fix(pkg): hash CUDA redist archives without hashlib.file_digest - #4

Merged
seyfal merged 1 commit into
eagle-hq:mainfrom
kevin9327:fix-cuda-redist-py310
Oct 27, 2026
Merged

seyfal merged 1 commit into
eagle-hq:mainfrom
kevin9327:fix-cuda-redist-py310

Conversation

@kevin9327

Copy link
Copy Markdown
Contributor

Licensing, attribution, and third-party content

  • I have checked whether my changes contain or modify Eagle 4-licensed files,
    and have preserved required license, copyright, attribution, and NOTICE text.
  • Materially modified Eagle files are identified with the date, modifier,
    and the affected file or component (or an appropriately mapped change log).
  • Any added third-party code, data, or weights are compatible with the
    repository's licensing and contain required third-party notices.
  • If this is a public fork or derivative distribution, I have followed
    the Eagle Trademark Policy and preserved the required
    non-affiliation and distinguishable-branding disclosures.
  • I have reviewed the contribution terms (PDF)
    and any requirements stated in CONTRIBUTING.md.

Modified: 2026-10-22 by kevin9327, files: tools/cuda_redist.py, tests/test_cuda_redist.py (new). Existing copyright and SPDX headers are unchanged.

Change summary

tools/cuda_redist.py verified each archive with hashlib.file_digest, which only exists from Python 3.11. The package declares requires-python = ">=3.10", so on 3.10 the tool downloaded cuda_nvcc and then failed with AttributeError before installing anything. The fix hashes the archive in 1 MiB blocks, the same way tools/mk_index.py and tools/release_files.py already do. Touches tools/cuda_redist.py and adds tests/test_cuda_redist.py.

Testing and impact

pytest tests/test_cuda_redist.py (new; serves a fake manifest and a tiny xz archive through a patched urlopen, no network; removes hashlib.file_digest to match 3.10): fails on main with AttributeError, passes with the fix. It also checks the archive's top directory is stripped and the lib64 link is created. The digest is unchanged on 3.11+.

Lint: ruff==0.15.1 check on the changed files passes. CPU only; no GPU, model weights or torch needed.

Third-party materials and dependencies

None

AI-assisted or generated content

Grok Bot (an AI assistant) helped find the bug by reading the code, and drafted the fix, the test and this description. I reviewed the diff and ran the new test before the fix (fails) and after (passes), plus the rest of the touched test file.

Documentation and notices

None

pyproject.toml declares requires-python >=3.10, but cuda_redist.py used
hashlib.file_digest, which was added in Python 3.11, so installing a CUDA
toolkit with the tool failed with AttributeError on 3.10 after the
download. Hash the archive in 1 MiB blocks instead.

Test: tests/test_cuda_redist.py (no network: urlopen is faked) fails
before with file_digest removed, passes after.
@seyfal

seyfal commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Merged in 949c214. Thanks, this one broke the CUDA install on Python 3.10.

The export that publishes this repo first landed your fix without your name on it. I've fixed the export, and your original commit is now in main's history, so this PR shows as merged under your name.

@seyfal seyfal closed this Oct 26, 2026
@seyfal seyfal reopened this Oct 27, 2026
@seyfal
seyfal merged commit 5e40990 into eagle-hq:main Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants