rules_py icon indicating copy to clipboard operation
rules_py copied to clipboard

[Bug]: Wrong delimiter in conflict detection code?

Open tgeng opened this issue 2 months ago • 1 comments

What happened?

When site-packages have conflicts, I am getting a panic like

==================== Test output for //path/to:some_test:
thread 'main' panicked at py/tools/py/src/pth.rs:146:14:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
================================================================================

Looking at the code it seems to me that the following line should be site-packages rather than .runefiles/

https://github.com/aspect-build/rules_py/blob/main/py/tools/py/src/pth.rs#L144

Apparently, tgt seems to be pointing to the "source" (for example <execroot>/_main/bazel-out/k8-fastbuild/bin/external/some~external~module/some/pypi/package/site-packages/some/python/file.py), so it won't contain any .runfiles in the path.

Version

Development (host) and target OS/architectures:

Output of bazel --version:

bazel version Bazelisk version: v1.11.0 Build label: 7.2.0 Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer Build time: Mon Jun 10 13:04:32 2024 (1718024672) Build timestamp: 1718024672 Build timestamp as int: 1718024672

Version of the Aspect rules, or other relevant rules from your WORKSPACE or MODULE.bazel file: 0.7.3

Language(s) and/or frameworks involved: Python

How to reproduce

I have two packages without almost identical content and they are both added to `deps` of a `py_test`. Then running `bazel test //path/to/the:test` fails with the above error from rust.

Any other information?

No response

tgeng avatar Jul 02 '24 17:07 tgeng