forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pydrake: Do not import a duplicate of pydrake, but use another module…
… to load `libdrake.so`
- Loading branch information
1 parent
a68f669
commit bf5dde8
Showing
6 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- python -*- | ||
|
||
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_so_name = "bazel_workaround_4594_libdrake", | ||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- python -*- | ||
|
||
def get_bazel_workaround_4594_libdrake_package_info(): | ||
"""Only to be used by //bindings:bazel_workaround_4594_libdrake_py. | ||
For more information, see `pydrake/__init__.py`. | ||
""" | ||
return struct(py_imports = ["../.."]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "pybind11/pybind11.h" | ||
|
||
namespace drake { | ||
namespace pydrake { | ||
|
||
PYBIND11_MODULE(bazel_workaround_4594_libdrake, m) { | ||
m.doc() = "Consolidated workaround for bazelbuild/bazel#4594 to load " | ||
"libdrake.so, to be used by `pydrake/__init__.py`."; | ||
} | ||
|
||
} // namespace pydrake | ||
} // namespace drake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters