From 9b2917a564a97ad7065dc3a1d919761aa303efcb Mon Sep 17 00:00:00 2001 From: mareld <70335127+mailto-jonas@users.noreply.github.com> Date: Tue, 21 Jan 2025 03:01:41 +0100 Subject: [PATCH] fix: Don't fail in override from a non-root module (#2566) This patch enable calls to pypi override from a non-root module without failing. The call will instead be silently ignored. Fixes #2550 --------- Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com> --- CHANGELOG.md | 3 ++- python/private/pypi/extension.bzl | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ea933986f..2d8c1631ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,7 +52,8 @@ Unreleased changes template. {#v0-0-0-changed} ### Changed -* Nothing changed. +* (pypi) {obj}`pip.override` will now be ignored instead of raising an error, + fixes [#2550](https://github.com/bazelbuild/rules_python/issues/2550). {#v0-0-0-fixed} ### Fixed diff --git a/python/private/pypi/extension.bzl b/python/private/pypi/extension.bzl index 6409bccdd6..405c22f60e 100644 --- a/python/private/pypi/extension.bzl +++ b/python/private/pypi/extension.bzl @@ -387,7 +387,9 @@ You cannot use both the additive_build_content and additive_build_content_file a for module in module_ctx.modules: for attr in module.tags.override: if not module.is_root: - fail("overrides are only supported in root modules") + # Overrides are only supported in root modules. Silently + # ignore the override: + continue if not attr.file.endswith(".whl"): fail("Only whl overrides are supported at this time")