From 9c9d47389309a7bc96b889ae1e243cde78927a0b Mon Sep 17 00:00:00 2001 From: Matt Mackay Date: Wed, 1 Jun 2022 21:50:50 -0400 Subject: [PATCH] fix: don't add source files to requirements files from transitive native py_library rules --- py/private/py_wheel.bzl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/py/private/py_wheel.bzl b/py/private/py_wheel.bzl index 604a0939..37641b00 100644 --- a/py/private/py_wheel.bzl +++ b/py/private/py_wheel.bzl @@ -24,7 +24,11 @@ def _make_py_wheel_info(ctx, wheel_filegroups): if PyWheelInfo in filegroup: files_depsets.append(filegroup[PyWheelInfo].files) runfiles.append(filegroup[PyWheelInfo].default_runfiles) - elif DefaultInfo in filegroup: + elif DefaultInfo in filegroup and not PyInfo in filegroup: + # This is slightly incorrect, but we don't yet have a better way of knowing if the dependency is a filegroup + # that we should consume a wheel from. + # What we do know though is we must ignore other py_library dependencies from rules_python, so exclude anything + # that provides the PyInfo provider. files_depsets.append(filegroup[DefaultInfo].files) files_depsets.append(filegroup[DefaultInfo].default_runfiles.files) runfiles.append(filegroup[DefaultInfo].default_runfiles)