Skip to content

Commit 3a8829b

Browse files
docs: doc the imports attribute as a target-relative path (#3571)
The docs incorrectly refer to the path as a repo-root relative path, but this is plainly not the case, as the underlying code does, essentially, `join(repoRoot, ctx.label, importsAttr)` Work towards #3565 --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 3aa6386 commit 3a8829b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

python/private/attributes.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,14 @@ List of import directories to be added to the PYTHONPATH.
189189
Subject to "Make variable" substitution. These import directories will be added
190190
for this rule and all rules that depend on it (note: not the rules this rule
191191
depends on. Each directory will be added to `PYTHONPATH` by `py_binary` rules
192-
that depend on this rule. The strings are repo-runfiles-root relative,
192+
that depend on this rule.
193+
194+
The values are target-directory-relative runfiles-root paths. e.g. given target
195+
`//foo/bar:baz`, `sys.path` will be affected as:
196+
* `a/b` adds `$runfilesRoot/$repo/foo/bar/a/b`
197+
* `../sibling` adds `$runfilesRoot/$repo/foo/sibling`
198+
* `../../` adds `$runfilesRoot/$repo`
199+
(where `$repo` is the name of the repository containing the target).
193200
194201
Absolute paths (paths that start with `/`) and paths that references a path
195202
above the execution root are not allowed and will result in an error.

0 commit comments

Comments
 (0)