refactor: avoid conflict merging when shared libraries are present by rickeylev · Pull Request #3448 · bazel-contrib/rules_python

@rickeylev

@rickeylev

gemini-code-assist[bot]

@rickeylev

@rickeylev

@rickeylev

…into refactor.optimize.symlink.grouping

@rickeylev rickeylev deleted the refactor.optimize.symlink.grouping branch

December 10, 2025 17:12

This was referenced

Dec 10, 2025

github-merge-queue bot pushed a commit that referenced this pull request

Dec 14, 2025
…re being linked (#3458)

When a file (instead of directory) was duplicated, it was incorrectly be
treated as
a directory. The conflicting path was turned into a directory and all
the files
were made child paths of it. In practice, this usually worked out OK
still because
the conflicting file was an `__init__.py` file for a pkgutil-style
namespace package,
which effectively converted it to an implicit namespace package.

I think this was introduced by
#3448,
but am not 100% sure.

To fix, first check for exact path equality when merging conflicting
paths. If the
candidate file has the same link_to_path as the grouping, then just link
to that file
and skip any remaining files in the group. The rest of the group's files
are skipped
because none of them can contribute links anymore:
* If they have the same path, then they are ignored (first set wins)
* If they are a sub-path, then it violates the preconditions of the
group (all files
  in the group should be exact matches or sub-paths of a common prefix)
* If they aren't under the common prefix, then it violates the
preconditions of the
  group and are skipped.

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>