Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bazel] Should avoid need for legacy_create_init=False #253

Open
EricCousineau-TRI opened this issue Mar 8, 2023 · 0 comments
Open

[bazel] Should avoid need for legacy_create_init=False #253

EricCousineau-TRI opened this issue Mar 8, 2023 · 0 comments

Comments

@EricCousineau-TRI
Copy link
Collaborator

EricCousineau-TRI commented Mar 8, 2023

Per Anzu PR 9950, we find the need to set py_binary(*, legacy_create_init=False) as a means to workaround bazelbuild/bazel#7386

From digging a bit more in the Anzu PR and in drake-ros, it seems like it happens because Bazel's imports seem to order things to prefer the external repositories over the user supplied ordering (which seems defective).

For example, using 7a36ec3:

$ cd drake_ros_examples
$ bazel run //:drake_ros_py_import_test
...
{source}/test
{runfiles}                             !!!! This is the shadowing issue
{runfiles}/drake/bindings
... other ros deps
{runfiles}/ros2/archive/rclpy/local/lib/python3.10/dist-packages
{runfiles}/drake_ros                   !!!! This is shadowed
{runfiles}/drake
{runfiles}/drake_ros_examples
{runfiles}/lcm
{runfiles}/ros2
/usr/lib/python310.zip
/usr/lib/python3.10
/usr/lib/python3.10/lib-dynload
/usr/local/lib/python3.10/dist-packages
/usr/lib/python3/dist-packages
/usr/lib/python3.10/dist-packages

While we could sprinkle legacy_create_init=False everywhere, I don't want to require that just yet without having disabled it in Anzu / Drake first, which may take some work.

In Anzu / Drake, we work around things like this by simply renaming the repository.

I will see if we can just rename the repository to drake_ros_repo. Yuck, but whatever, I'd prefer to keep our solutions simple, and I am afraid of interactions with legacy_create_init=False.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant