diff options
author | David Chen <dzc@google.com> | 2016-02-10 12:52:11 +0000 |
---|---|---|
committer | Dmitry Lomov <dslomov@google.com> | 2016-02-10 16:34:46 +0000 |
commit | ea02b8a51fc924755971f78e392100b50d8dc5a2 (patch) | |
tree | 54ed40e7e37fa90ce0a4e7d44fb1566e7c147176 /examples/py_native/fibonacci | |
parent | 847a41816c08b846e09c62834f28fbbcb08d5d6d (diff) |
Add imports attribute to Bazel native Python rules to allow adding directories to PYTHONPATH.
Fixes #702
RELNOTES: Add imports attribute to native Python rules.
--
MOS_MIGRATED_REVID=114314430
Diffstat (limited to 'examples/py_native/fibonacci')
-rw-r--r-- | examples/py_native/fibonacci/BUILD | 6 | ||||
-rw-r--r-- | examples/py_native/fibonacci/fib.py | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/examples/py_native/fibonacci/BUILD b/examples/py_native/fibonacci/BUILD new file mode 100644 index 0000000000..c3ee9b0fea --- /dev/null +++ b/examples/py_native/fibonacci/BUILD @@ -0,0 +1,6 @@ +py_library( + name = "fibonacci", + srcs = ["fib.py"], + imports = ["."], + visibility = ["//examples/py_native:__pkg__"], +) diff --git a/examples/py_native/fibonacci/fib.py b/examples/py_native/fibonacci/fib.py new file mode 100644 index 0000000000..645a937a0e --- /dev/null +++ b/examples/py_native/fibonacci/fib.py @@ -0,0 +1,8 @@ +"""An example binary to test the imports attribute of native Python rules.""" + + +def Fib(n): + if n == 0 or n == 1: + return 1 + else: + return Fib(n-1) + Fib(n-2) |