Skip to content

Commit 61b5a8d

Browse files
authored
Fix whl_library file path inference (#2876)
When given .whl file URLs and no file name, `whl_library` writes the wheel it downloads to a file with the same file name as the first URL's. But then at extraction time, it always consults ctx.attr.filename for that file name, leading to failure when that attribute is None. This patch should fix that. Related #2363
1 parent 367d09e commit 61b5a8d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ END_UNRELEASED_TEMPLATE
9090
various URL formats - URL encoded version strings get correctly resolved, sha256 value can be
9191
also retrieved from the URL as opposed to only the `--hash` parameter. Fixes
9292
[#2363](https://github.com/bazel-contrib/rules_python/issues/2363).
93+
* (pypi) `whl_library` now infers file names from its `urls` attribute correctly.
9394

9495
{#v0-0-0-added}
9596
### Added

python/private/pypi/whl_library.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def _whl_library_impl(rctx):
277277
fail("could not download the '{}' from {}:\n{}".format(filename, urls, result))
278278

279279
if filename.endswith(".whl"):
280-
whl_path = rctx.path(rctx.attr.filename)
280+
whl_path = rctx.path(filename)
281281
else:
282282
# It is an sdist and we need to tell PyPI to use a file in this directory
283283
# and, allow getting build dependencies from PYTHONPATH, which we

0 commit comments

Comments
 (0)