# -*- python -*-

load("@drake//tools/install:install.bzl", "install")
load("//tools/lint:lint.bzl", "add_lint_tests")
load(
    "//tools/skylark:pybind.bzl",
    "drake_pybind_library",
    "get_drake_py_installs",
    "get_pybind_package_info",
)
load(
    "//tools/skylark:drake_py.bzl",
    "drake_py_library",
    "drake_py_unittest",
)

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

# This determines how `PYTHONPATH` is configured, and how to install the
# bindings.
PACKAGE_INFO = get_pybind_package_info("//bindings")

drake_py_library(
    name = "module_py",
    srcs = ["__init__.py"],
    imports = PACKAGE_INFO.py_imports,
    deps = [
        "//bindings/pydrake:module_py",
    ],
)

drake_pybind_library(
    name = "planner_py",
    cc_deps = [
        "//bindings/pydrake/util:drake_optional_pybind",
        "//bindings/pydrake/util:eigen_pybind",
    ],
    cc_so_name = "planner",
    cc_srcs = ["planner_py.cc"],
    package_info = PACKAGE_INFO,
    py_deps = [
        ":module_py",
    ],
)

PY_LIBRARIES_WITH_INSTALL = [
    ":planner_py",
]

PY_LIBRARIES = [
    ":module_py",
]

drake_py_unittest(
    name = "planner_test",
    deps = [
        ":planner_py",
    ],
)

# Symbol roll-up (for user ease).
drake_py_library(
    name = "all_py",
    srcs = ["all.py"],
    deps = PY_LIBRARIES_WITH_INSTALL + PY_LIBRARIES,
)

# Package roll-up (for Bazel dependencies).
drake_py_library(
    name = "manipulation",
    deps = [":all_py"],
)

install(
    name = "install",
    targets = PY_LIBRARIES + [":all_py"],
    py_dest = PACKAGE_INFO.py_dest,
    deps = get_drake_py_installs(PY_LIBRARIES_WITH_INSTALL),
)

add_lint_tests()
