From 0e9bd12bc8a1a500a1b39269a59df60ec41764db Mon Sep 17 00:00:00 2001 From: Garrett Holmstrom Date: Mon, 5 May 2025 18:46:04 -0700 Subject: [PATCH] Fix whl_library file path inference --- CHANGELOG.md | 1 + python/private/pypi/whl_library.bzl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b94072d655..94487219bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -90,6 +90,7 @@ END_UNRELEASED_TEMPLATE various URL formats - URL encoded version strings get correctly resolved, sha256 value can be also retrieved from the URL as opposed to only the `--hash` parameter. Fixes [#2363](https://github.com/bazel-contrib/rules_python/issues/2363). +* (pypi) `whl_library` now infers file names from its `urls` attribute correctly. {#v0-0-0-added} ### Added diff --git a/python/private/pypi/whl_library.bzl b/python/private/pypi/whl_library.bzl index b370de448a..17ee3d3cfe 100644 --- a/python/private/pypi/whl_library.bzl +++ b/python/private/pypi/whl_library.bzl @@ -277,7 +277,7 @@ def _whl_library_impl(rctx): fail("could not download the '{}' from {}:\n{}".format(filename, urls, result)) if filename.endswith(".whl"): - whl_path = rctx.path(rctx.attr.filename) + whl_path = rctx.path(filename) else: # It is an sdist and we need to tell PyPI to use a file in this directory # and, allow getting build dependencies from PYTHONPATH, which we