Skip to content

Commit 4f5a693

Browse files
aignasrickeylev
authored andcommitted
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. (cherry picked from commit 9dfa3ab)
1 parent f2b6747 commit 4f5a693

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
@@ -48,6 +48,17 @@ END_UNRELEASED_TEMPLATE
4848
-->
4949

5050

51+
{#1-4-1}
52+
## [1.4.1] - 2025-05-08
53+
54+
[1.4.1]: https://github.com/bazel-contrib/rules_python/releases/tag/1.4.1
55+
56+
{#1-4-1-fixed}
57+
### Fixed
58+
* (pypi) Fix a typo not allowing users to benefit from using the downloader when the hashes in the
59+
requirements file are not present. Fixes
60+
[#2863](https://github.com/bazel-contrib/rules_python/issues/2863).
61+
5162
{#1-4-0}
5263
## [1.4.0] - 2025-04-19
5364

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