Skip to content

BUG: ignore empty directories when checking package splits - #909

Closed
jad-fahmi wants to merge 6 commits into
mesonbuild:mainfrom
jad-fahmi:fix/empty-install-subdir
Closed

jad-fahmi wants to merge 6 commits into
mesonbuild:mainfrom
jad-fahmi:fix/empty-install-subdir

Conversation

@jad-fahmi

@jad-fahmi jad-fahmi commented Sep 27, 2026 •

Copy link
Copy Markdown

An install_subdir() entry with all files excluded can cause StopIteration in the split-package check. Check the expanded wheel entries so empty directories are ignored and actual splits still raise BuildError.

Fixes #869.

python -m pytest tests/test_wheel.py: 26 passed, 12 skipped on Windows.

Comment thread mesonpy/__init__.py Outdated
wheel_files[path].append(_Entry(dst, src, install_rpath, build_rpath))

packages: Dict[str, Tuple[str, pathlib.Path]] = {}
for path in ('purelib', 'platlib'):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the check need to be repeated for both purelib and platlib?

Comment thread tests/test_wheel.py Outdated

@pytest.mark.skipif(MESON_VERSION < (1, 2, 0), reason='meson too old to report excluded files')
@pytest.mark.parametrize('empty_first', [True, False])
def test_purelib_platlib_empty_subdir(tmp_path, empty_first):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way this test is structured makes it hard to read. Just add the relevant parts to the tests/packages/purelib-platlib-split test package.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this is not a good idea: purelib-platlib-split raises an error, thus checking for a valid setup in it makes writing the test awkward. tests/packages/install-subdir is the place where this should go.

@jad-fahmi jad-fahmi changed the title BUG: check package splits after expanding install directories BUG: preserve split-package errors for empty install directories Sep 27, 2026
@dnicolodi

Copy link
Copy Markdown
Member

I do not understand the last changes pushed to the PR. Empty directories are not added to wheel, and even if they were, they would not cause a package to be split between platlib and purelib as empty directories do not have any role in the Python import machinery. What is the reason for raising an error on empty directories?

@jad-fahmi jad-fahmi changed the title BUG: preserve split-package errors for empty install directories BUG: ignore empty directories when checking package splits Sep 28, 2026
@jad-fahmi
jad-fahmi marked this pull request as draft September 28, 2026 01:39
Meson lists install_sources() entries before install_subdir() entries.
Use install_subdir() for platlib so the empty purelib entry is visited
first and the test reproduces the StopIteration reported in #869.

Run the regression from Meson 1.1, which already reports exclusions.
@jad-fahmi jad-fahmi closed this Sep 28, 2026
@dnicolodi

Copy link
Copy Markdown
Member

Was this closed by mistake?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible unhandled StopIteration

2 participants