bazel pypi macro self-edge -
i'm stumbling around trying bazel working pypi dependencies.
./pypi.bzl:
def _impl(ctx): ctx.actions.run_shell( command = "pip download %s" % ctx.package ) _pypi_package = rule( implementation=_impl, attrs={"package": attr.label(mandatory=true)}, ) def pypi_package(package): _pypi_package(name = package, package = package)
./build:
py_binary( name = "app", srcs = ["app.py"], deps = [":python-dateutil"] ) load("//:pypi.bzl", "pypi_package") pypi_package( package="python-dateutil", )
trying build:
$ bazel build app error: /path/to/cwd/build:9:1: in _pypi_package rule //:python-dateutil: cycle in dependency graph: //:app .-> //:python-dateutil [self-edge] `-- cycle occurred because of configuration option. error: analysis of target '//:app' failed; build aborted. info: elapsed time: 0.219s
no idea if right approach working external dependencies, ignoring that, don't understand self-dep here coming from. in fact, don't see i'm declaring deps pypi_package
rule @ all. what's going on?
the issue attr.label
: "label" here means build label. should have been using attr.string
.
Comments
Post a Comment