Skip to content

Commit

Permalink
[pydrake] Remove workaround for bazel#4594 (#21748)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricCousineau-TRI authored Jul 26, 2024
1 parent bd97580 commit 9779652
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 61 deletions.
24 changes: 0 additions & 24 deletions bindings/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
load("//tools/lint:lint.bzl", "add_lint_tests")
load(
"//tools/skylark:pybind.bzl",
"drake_pybind_library",
)
load(
":bazel_workaround_4594_libdrake.bzl",
"get_bazel_workaround_4594_libdrake_package_info",
)

package(default_visibility = [
"//bindings/pydrake:__subpackages__",
])

# This is placed outside of `pydrake` so that we can import this without
# pulling in an extra copy of `pydrake`. For more information, see
# `pydrake/__init__.py`.
drake_pybind_library(
name = "bazel_workaround_4594_libdrake_py",
add_install = False,
cc_srcs = ["bazel_workaround_4594_libdrake_py.cc"],
# Since `package_info` must be a `struct`, we must define this in a `*.bzl`
# file.
package_info = get_bazel_workaround_4594_libdrake_package_info(),
)

add_lint_tests(cpplint_data = ["//bindings/pydrake:.clang-format"])
6 changes: 0 additions & 6 deletions bindings/bazel_workaround_4594_libdrake.bzl

This file was deleted.

13 changes: 0 additions & 13 deletions bindings/bazel_workaround_4594_libdrake_py.cc

This file was deleted.

1 change: 0 additions & 1 deletion bindings/pydrake/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ drake_py_library(
"__init__.py",
],
deps = [
"//bindings:bazel_workaround_4594_libdrake_py",
"//bindings/pydrake/common:_init_py",
],
)
Expand Down
17 changes: 0 additions & 17 deletions bindings/pydrake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,6 @@
import sys
import warnings

# When importing `pydrake` as an external under Bazel, Bazel will use a shared
# library whose relative RPATHs are incorrect for `libdrake.so`, and thus will
# fail to load; this issue is captured in bazelbuild/bazel#4594. As a
# workaround, we can use a library that properly links to `libdrake.so`, but in
# `{runfiles}/{workspace}/external/drake` rather than `{runfiles}/drake`.
# Once this is loaded, all of the Python C-extension libraries
# that depend on it (and its dependencies) will load properly.
# Please note that this workaround is only important when running under the
# Bazel runfiles tree. Installed `pydrake` should not have this issue.
# N.B. We do not import `external.drake.bindings.pydrake` as this may cause
# duplicate classes to be loaded (#8810). This will not be a problem once #7912
# is resolved.
try:
import external.drake.bindings.bazel_workaround_4594_libdrake
except ImportError:
pass


def getDrakePath():
# Compatibility alias.
Expand Down

0 comments on commit 9779652

Please sign in to comment.