Skip to content

Commit 9dfa3ab

Browse files
authored
fix(pypi): fix a typo in parse_simpleapi_html (bazel-contrib#2866)
It seems that the integration tests that I thought were covering this had the same time. Added an assertion to the unit tests as well Fixes bazel-contrib#2863.
1 parent 9f3512f commit 9dfa3ab

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ END_UNRELEASED_TEMPLATE
102102
### Removed
103103
* Nothing removed.
104104

105+
{#1-4-1}
106+
## [1.4.1] - 2025-05-08
107+
108+
[1.4.1]: https://github.com/bazel-contrib/rules_python/releases/tag/1.4.1
109+
110+
{#1-4-1-fixed}
111+
### Fixed
112+
* (pypi) Fix a typo not allowing users to benefit from using the downloader when the hashes in the
113+
requirements file are not present. Fixes
114+
[#2863](https://github.com/bazel-contrib/rules_python/issues/2863).
115+
105116
{#1-4-0}
106117
## [1.4.0] - 2025-04-19
107118

python/private/pypi/parse_simpleapi_html.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def parse_simpleapi_html(*, url, content):
5252

5353
# Each line follows the following pattern
5454
# <a href="https://...#sha256=..." attribute1="foo" ... attributeN="bar">filename</a><br />
55-
sha256_by_version = {}
55+
sha256s_by_version = {}
5656
for line in lines[1:]:
5757
dist_url, _, tail = line.partition("#sha256=")
5858
dist_url = _absolute_url(url, dist_url)
@@ -65,7 +65,7 @@ def parse_simpleapi_html(*, url, content):
6565
head, _, _ = tail.rpartition("</a>")
6666
maybe_metadata, _, filename = head.rpartition(">")
6767
version = _version(filename)
68-
sha256_by_version.setdefault(version, []).append(sha256)
68+
sha256s_by_version.setdefault(version, []).append(sha256)
6969

7070
metadata_sha256 = ""
7171
metadata_url = ""
@@ -102,7 +102,7 @@ def parse_simpleapi_html(*, url, content):
102102
return struct(
103103
sdists = sdists,
104104
whls = whls,
105-
sha256_by_version = sha256_by_version,
105+
sha256s_by_version = sha256s_by_version,
106106
)
107107

108108
_SDIST_EXTS = [

tests/pypi/parse_simpleapi_html/parse_simpleapi_html_tests.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def _test_sdist(env):
8686
got = parse_simpleapi_html(url = input.url, content = html)
8787
env.expect.that_collection(got.sdists).has_size(1)
8888
env.expect.that_collection(got.whls).has_size(0)
89+
env.expect.that_collection(got.sha256s_by_version).has_size(1)
8990
if not got:
9091
fail("expected at least one element, but did not get anything from:\n{}".format(html))
9192

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy