From f5e23c61ad53f209bea51607cd598062453c0b8a Mon Sep 17 00:00:00 2001 From: Lukacs Berki Date: Fri, 27 Mar 2015 14:08:38 +0000 Subject: Make Python rules in Bazel actually work. In particular: add a BazelPythonSemantics implementation and the respective RuleConfiguredTarget factories, rule class definitions and hook them up with BazelRuleClassProvider. Add implicit dependencies (2to3 is just a stub script for now that always fails) and a tiny exampe. -- MOS_MIGRATED_REVID=89691827 --- examples/py_native/BUILD | 10 ++++++++++ examples/py_native/bin.py | 4 ++++ examples/py_native/lib.py | 5 +++++ 3 files changed, 19 insertions(+) create mode 100644 examples/py_native/BUILD create mode 100644 examples/py_native/bin.py create mode 100644 examples/py_native/lib.py (limited to 'examples/py_native') diff --git a/examples/py_native/BUILD b/examples/py_native/BUILD new file mode 100644 index 0000000000..3d8de94251 --- /dev/null +++ b/examples/py_native/BUILD @@ -0,0 +1,10 @@ +py_binary( + name = "bin", + srcs = ["bin.py"], + deps = [":lib"], +) + +py_library( + name = "lib", + srcs = ["lib.py"], +) diff --git a/examples/py_native/bin.py b/examples/py_native/bin.py new file mode 100644 index 0000000000..f79379a237 --- /dev/null +++ b/examples/py_native/bin.py @@ -0,0 +1,4 @@ +"""A tiny example binary for the native Python rules of Bazel.""" +from examples.py_native.lib import GetNumber + +print "The number is %d" % GetNumber() diff --git a/examples/py_native/lib.py b/examples/py_native/lib.py new file mode 100644 index 0000000000..44522e0fe9 --- /dev/null +++ b/examples/py_native/lib.py @@ -0,0 +1,5 @@ +"""A tiny example binary for the native Python rules of Bazel.""" + + +def GetNumber(): + return 42 -- cgit v1.2.3