fix: populate sha256 in resource files and fix Windows PythonConfiguration

- Add sha256 field to Windows PythonConfiguration (PyPy/GraalPy have
  direct download URLs on Windows too)
- Pass sha256 to install_pypy() and install_graalpy() in windows.py
- Fix update_pythons.py: handle empty sha256 from CPython API (older
  versions) by streaming download to compute it; fix condition to
  check 'not sha256' rather than 'not in dict'
- Fix update_virtualenv.py: compute sha256 even when version unchanged
  but sha256 is empty (first-time population)
- Fix update_python_build_standalone.py: resolve file path relative to
  the script itself (not the installed package) so writes go to source
  checkout, not the uv cache
- Populate actual sha256 values by running all three update scripts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Assisted-by: copilot-cli:claude-sonnet-4.6
This commit is contained in:
Henry Schreiner
2026-05-28 17:25:09 -04:00
co-authored by Copilot
parent 97537fe937
commit b597cb5aff
7 changed files with 625 additions and 607 deletions
+8 -5
View File
@@ -95,7 +95,14 @@ def update_virtualenv(force: bool, level: str) -> None:
if latest_release.version > Version(local_version):
version = latest_release.name
url = latest_release.download_url
# Compute sha256 by streaming the new download
sha256 = "" # recomputed below
else:
version = local_version
url = default["url"]
sha256 = default.get("sha256", "")
# Compute sha256 if not already stored (new version or first-time population)
if not sha256:
log.info("Computing sha256 for %s...", url)
response = requests.get(url, stream=True)
response.raise_for_status()
@@ -103,10 +110,6 @@ def update_virtualenv(force: bool, level: str) -> None:
for chunk in response.iter_content(65536):
hasher.update(chunk)
sha256 = hasher.hexdigest()
else:
version = local_version
url = default["url"]
sha256 = default.get("sha256", "")
configurations["default"] = {
"version": version,