Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions add_to_pydotorg.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ def md5sum_for(filename: str) -> str:
).hexdigest()


def sha256sum_for(filename: str) -> str:
"""Returns SHA256 checksum for filename."""
return hashlib.sha256(open(filename, "rb").read()).hexdigest()


def filesize_for(filename: str) -> int:
return path.getsize(filename)

Expand Down Expand Up @@ -261,6 +266,7 @@ def build_file_dict(
"is_source": os_pk == 3,
"url": download_root + f"{base_version(release)}/{rfile}",
"md5_sum": md5sum_for(filename),
"sha256sum": sha256sum_for(filename),
"filesize": filesize_for(filename),
"download_button": add_download,
}
Expand Down
1 change: 1 addition & 0 deletions tests/test_add_to_pydotorg.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_build_file_dict(tmp_path: Path) -> None:
"is_source": False,
"url": f"{release_url}/test-artifact.txt",
"md5_sum": "3e25960a79dbc69b674cd4ec67a72c62",
"sha256sum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c",
"filesize": 11,
"download_button": True,
"sigstore_bundle_file": f"{release_url}/test-artifact.txt.sigstore",
Expand Down