]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commit
python3: backport the full fix for importlib scanning invalid distributions
authorRoss Burton <ross.burton@arm.com>
Tue, 29 Apr 2025 15:29:30 +0000 (16:29 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 1 May 2025 13:20:18 +0000 (14:20 +0100)
commit73de8daa6293403f5b92d313af32882c47bce396
treef98d20d7ed2bfe621bb76e53de3d3302dca15b92
parent3b17355ad1ecad17d12c5eb0e6403a59ef11f7d7
python3: backport the full fix for importlib scanning invalid distributions

Even with our fixes in deterministic_imports.patch the
importlib.metadata package scan was still returning Distribution objects
for empty directories.  This interacts badly with rebuilds when recipes
are changing as when a recipe is removed from the sysroot directories
are not removed[1].

In particular this breaks python3-meson-python-native rebuilds when
Meson upgrades from 1.7 to 1.8: the site-packages directory has an empty
meson-1.7.dist-info/ and populated meson-1.8.dist-info/. Whilst it's
deterministic to return the empty 1.7 first, this breaks pypa/build as
it looks through the distributions in order.

We had discussed this with upstream previously and there's a more
comprehensive fix upstream (actually in importlib_metadata, not cpython)
which ensures that valid distribution objects are listed first.  So we
can drop our patch and replace it with a backport to fix these rebuilds.

[1] oe-core 4f94d929639 ("sstate/staging: Handle directory creation race issue")

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/python/python3/deterministic_imports.patch [deleted file]
meta/recipes-devtools/python/python3/valid-dists.patch [new file with mode: 0644]
meta/recipes-devtools/python/python3_3.13.2.bb