Neu im Bazel-Build-System.Bazel: Erstelle py_binary aus der Python-Datei in py_library
Ich möchte ein py_binary aus einer Datei in einer py_library erstellen, die aus einem http_archive erstellt wird.
Zur Zeit habe ich:
WORKSPACE
:
new_http_archive(
name = "cpplint_archive",
url = "https://pypi.python.org/packages/source/c/cpplint/cpplint-1.2.2.tar.gz",
sha256 = "b2979ff630299293f23c52096e408f2b359e2e26cb5cdf24aed4ce53e4293468",
build_file = "cpplint.BUILD",
strip_prefix = "cpplint-1.2.2"
)
cpplint.BUILD
:
py_library(
name = "cpplint",
srcs = glob(["*.py"]),
visibility = ['//visibility:public']
)
src/BUILD
:
py_binary(
name = "lint",
main = ":cpplint/cpplint.py",
srcs = [":cpplint/cpplint.py"],
deps = [
"@cpplint_archive//:cpplint"
]
)
Der Pfad in srcs und main ist falsch und gibt "kein solches Paket 'cpplint/cpplint.py'", wenn ich bazel run src/lint
ausführen. Ich kann nicht herausfinden, wie ich auf eine Datei in der Bibliothek verweisen soll.
Vielen Dank. Ich werde sehen, welche Option mir am besten passt, aber beide Ansätze funktionieren. – avanwyk