Commit c9bb66e
fix(bootstrap): manual runfiles path construction when using submodules (#3636)
This fixes #3563.
Verified by running the repro in
https://github.com/mering/reproduction_rules_python_1_7.
The identified regression in
b8e32c4
is problematic because prepending `ctx.workspace_name` to `short_path`
results in paths containing `..` (e.g., `_main/../sub+/path/to/file.py`)
when building from a root module that includes other modules. This
causes the `_find_runfiles_root`
[logic](https://github.com/faximan/rules_python/blob/eb6ac472eb86cc263acc336a2b73982043069aae/python/private/site_init_template.py#L73),
which _counts slashes_, to incorrectly calculate the runfiles root.
The fix is simply using the available `runfiles_root_path` function
instead. In the example above, this makes the path simply
`sub+/path/to/file.py`.
---------
Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>1 parent 77a89a6 commit c9bb66e
File tree
5 files changed
+54
-14
lines changed- examples/bzlmod
- other_module/other_module/pkg
- tests/other_module
- python/private
5 files changed
+54
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
| 513 | + | |
517 | 514 | | |
518 | 515 | | |
519 | 516 | | |
| |||
616 | 613 | | |
617 | 614 | | |
618 | 615 | | |
619 | | - | |
| 616 | + | |
620 | 617 | | |
621 | 618 | | |
622 | 619 | | |
| |||
671 | 668 | | |
672 | 669 | | |
673 | 670 | | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
| 671 | + | |
678 | 672 | | |
679 | 673 | | |
680 | 674 | | |
| |||
777 | 771 | | |
778 | 772 | | |
779 | 773 | | |
780 | | - | |
781 | | - | |
782 | | - | |
783 | | - | |
| 774 | + | |
784 | 775 | | |
785 | 776 | | |
786 | 777 | | |
| |||
793 | 784 | | |
794 | 785 | | |
795 | 786 | | |
796 | | - | |
| 787 | + | |
797 | 788 | | |
798 | 789 | | |
799 | 790 | | |
| |||
0 commit comments