Fix KeyError when running add_miniforge.py

I was attempting to run the script to generate build files for new
versions, but it failed because version `23.1.0-4`[^1] contained a
malformed `.sha256` file.[^2] I looked at the miniforge repo's script
`releases.py`[^3] and copied the logic about which release artifacts
should be skipped when generating a list of downloads.

[^1]: https://github.com/conda-forge/miniforge/releases/tag/23.1.0-4
[^2]: https://github.com/conda-forge/miniforge/releases/download/23.1.0-4/Miniforge3-uninstaller-patch-Windows-x86_64.exe.sha256
[^3]: a15762906b/docs/releases.py (L35-L36)
This commit is contained in:
Alex Hedges 2024-02-24 21:03:27 -05:00
parent 02e1d4a293
commit 8316450887

View file

@ -71,8 +71,9 @@ def supported(filename):
return ('pypy' not in filename) and ('Windows' not in filename) return ('pypy' not in filename) and ('Windows' not in filename)
def add_version(release): def add_version(release):
tag_name = release['tag_name']
download_urls = { f['name']: f['browser_download_url'] for f in release['assets'] } download_urls = { f['name']: f['browser_download_url'] for f in release['assets'] }
shas = dict([download_sha(url) for (name, url) in download_urls.items() if name.endswith('.sha256')]) shas = dict([download_sha(url) for (name, url) in download_urls.items() if name.endswith('.sha256') and tag_name in name])
specs = [create_spec(filename, sha, download_urls[filename]) for (filename, sha) in shas.items() if supported(filename)] specs = [create_spec(filename, sha, download_urls[filename]) for (filename, sha) in shas.items() if supported(filename)]
for distribution in DISTRIBUTIONS: for distribution in DISTRIBUTIONS: