Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions py/private/py_wheel.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ def _make_py_wheel_info(ctx, wheel_filegroups):
files_depsets = []
runfiles = []
for filegroup in filegroups:
if DefaultInfo in filegroup:
files_depsets.append(filegroup[DefaultInfo].files)
files_depsets.append(filegroup[DefaultInfo].default_runfiles.files)
runfiles.append(filegroup[DefaultInfo].default_runfiles)

# The ordering is important here as we want to ensure we use the PyWheelInfo from transitive
# py_library dependencies, and only fall back to DefaultInfo when translating from the wheel
# filegroup to py_wheel_library
if PyWheelInfo in filegroup:
files_depsets.append(filegroup[PyWheelInfo].files)
runfiles.append(filegroup[PyWheelInfo].default_runfiles)
elif DefaultInfo in filegroup:
files_depsets.append(filegroup[DefaultInfo].files)
files_depsets.append(filegroup[DefaultInfo].default_runfiles.files)
runfiles.append(filegroup[DefaultInfo].default_runfiles)

py_info_runfiles = ctx.runfiles()
py_info_runfiles = py_info_runfiles.merge_all(runfiles)
Expand Down
63 changes: 63 additions & 0 deletions py/tests/internal-deps/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
load("//py:defs.bzl", "py_binary", "py_test", rules_py_py_library = "py_library")
load("@aspect_bazel_lib//lib:write_source_files.bzl", "write_source_files")

rules_py_py_library(
name = "init",
srcs = [
"__init__.py",
],
)

rules_py_py_library(
name = "add",
srcs = [
"add.py",
],
deps = [
":init",
],
)

rules_py_py_library(
name = "sub",
srcs = [
"sub.py",
],
deps = [
":init",
],
)

py_library(
name = "pi",
srcs = [
"pi.py",
],
deps = [
":init",
],
)

py_binary(
name = "main",
srcs = [
"__main__.py",
],
deps = [
":add",
":pi",
":sub",
],
)

py_test(
name = "assert",
srcs = [
"__main__.py",
],
deps = [
":add",
":pi",
":sub",
],
)
Empty file.
7 changes: 7 additions & 0 deletions py/tests/internal-deps/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from add import add
from sub import sub
from pi import format_pi

assert add(3, .14) == 3.14
assert sub(4, .86) == 3.14
assert format_pi('.2f') == "3.14"
2 changes: 2 additions & 0 deletions py/tests/internal-deps/add.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def add(a, b):
return a + b
3 changes: 3 additions & 0 deletions py/tests/internal-deps/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
3.14
3.14
3.14
4 changes: 4 additions & 0 deletions py/tests/internal-deps/pi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from math import pi

def format_pi(f):
return format(pi, f)
2 changes: 2 additions & 0 deletions py/tests/internal-deps/sub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def sub(a, b):
return a - b