Skip to content

Conversation

rickeylev
Copy link
Collaborator

The refactoring to move the pkgutil shim generation to build phase inverted
the logic for when it should be activated. When
enable_implicit_namespace_pkgs=True, it means to not generate the pkgutil shims
("respect the Python definition of the namespace package").

To fix, just invert the logic that activates it.

A test will be added in a subsequent PR because the necessary helper isn't
in the 1.5 branch.

Fixes #3038

@rickeylev rickeylev requested review from aignas and groodt as code owners July 5, 2025 16:19
@rickeylev
Copy link
Collaborator Author

rickeylev commented Jul 5, 2025

note to self:

  • looks like the tests are using some sort of mock that isn't glob-like enough.
  • Argh, the test calls a rule, so can't actually call create_inits(). I think the test needs to be rewritten as an analysis test or something.
@aignas
Copy link
Collaborator

aignas commented Jul 6, 2025

In order to unblock this I modified the unit test to set the flag to disable the consumption of the glob.

@aignas
Copy link
Collaborator

aignas commented Jul 6, 2025

Thanks for catching this and digging until the end!

@aignas aignas added this pull request to the merge queue Jul 6, 2025
Merged via the queue into bazel-contrib:main with commit 47c681b Jul 6, 2025
2 of 3 checks passed
aignas added a commit that referenced this pull request Jul 6, 2025
…es are disabled (#3059) The refactoring to move the pkgutil shim generation to build phase inverted the logic for when it should be activated. When `enable_implicit_namespace_pkgs=True`, it means to not generate the pkgutil shims ("respect the Python definition of the namespace package"). To fix, just invert the logic that activates it. A test will be added in a subsequent PR because the necessary helper isn't in the 1.5 branch. Fixes #3038 --------- Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com> (cherry picked from commit 47c681b)
@rickeylev rickeylev deleted the fix.enable.namespace.pkgs branch July 6, 2025 22:12
github-merge-queue bot pushed a commit that referenced this pull request Jul 7, 2025
This adds functional tests for the generated pkgutil namespace files. The test works by creating two wheels with the necessary structure: * An `__init__.py` file isn't in the wheel for the namespace package * They are both part of the namespace package. * The test verifies both are importable. These are the tests for #3059
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants