• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""Macro wrapping the py_library rule for Soong/Bazel convergence."""
2
3def py_library(imports = [".."], **kwargs):
4    # b/208215661: Always propagate the parent directory of this target so that
5    # dependent targets can use `import <modulename>` without using absolute
6    # imports, which Bazel uses by default. The eventual effect of this in a
7    # py_binary is that all directories contain py_library deps are added to the
8    # PYTHONPATH of the py_binary stub script, enabling `import <modulename>`.
9    if ".." not in imports:
10        imports.append("..")
11
12    native.py_library(
13        imports = imports,
14        **kwargs,
15    )
16