From adeef73a97cf191301a7b563883a075caed733b7 Mon Sep 17 00:00:00 2001 From: Damien Martin-Guillerez Date: Tue, 24 Mar 2015 09:05:08 +0000 Subject: Move all examples into Bazel workspace Those examples will be used for Bazel integration tests and their sources should be available directly to the Bazel workspace itself. -- MOS_MIGRATED_REVID=89380736 --- examples/py/BUILD | 14 ++++++++++++++ examples/py/bin.py | 3 +++ examples/py/lib.py | 5 +++++ 3 files changed, 22 insertions(+) create mode 100644 examples/py/BUILD create mode 100644 examples/py/bin.py create mode 100644 examples/py/lib.py (limited to 'examples/py') diff --git a/examples/py/BUILD b/examples/py/BUILD new file mode 100644 index 0000000000..6eecd4a4f3 --- /dev/null +++ b/examples/py/BUILD @@ -0,0 +1,14 @@ +package(default_visibility = ["//visibility:public"]) + +load("/tools/build_rules/py_rules", "py_library", "py_binary") + +py_library( + name = "lib", + srcs = ["lib.py"], +) + +py_binary( + name = "bin", + srcs = ["bin.py"], + deps = [":lib"], +) diff --git a/examples/py/bin.py b/examples/py/bin.py new file mode 100644 index 0000000000..53e917e491 --- /dev/null +++ b/examples/py/bin.py @@ -0,0 +1,3 @@ +from examples.py import lib + +print "Fib(5)=%d" % lib.Fib(5) diff --git a/examples/py/lib.py b/examples/py/lib.py new file mode 100644 index 0000000000..a27d4ce47c --- /dev/null +++ b/examples/py/lib.py @@ -0,0 +1,5 @@ +def Fib(n): + if n == 0 or n == 1: + return 1 + else: + return Fib(n-1) + Fib(n-2) -- cgit v1.2.3