diff options
author | Trevor Gamblin <tgamblin@baylibre.com> | 2023-06-01 09:56:29 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-02 14:41:50 +0100 |
commit | ef70f26445ca834b404943b197f9928fe7d16e5a (patch) | |
tree | 39a95db3203e1320dafcd3af5d18b4da7495425f /meta/classes-recipe | |
parent | c6763d27efd11e2bc2a62147890ad1067c4af2ec (diff) | |
download | poky-ef70f26445ca834b404943b197f9928fe7d16e5a.tar.gz |
python_hatchling: remove empty python sysroot dirs
In some cases, empty versioned directories are being left behind in
sysroots from previous versions of packages. This appears to be found
with recipes relying on hatchling, and causes errors at the do_compile
step:
| File "/workspace/yocto/manual/openembedded-core/build/tmp-glibc/work/core2-64-oe-linux/python3-iniconfig/2.0.0-r0/recipe-sysroot-native/usr/lib/python3.11/site-packages/packaging/version.py", line 197, in __init__
| match = self._regex.search(version)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
| TypeError: expected string or bytes-like object, got 'NoneType'
To fix this error, add a do_prepare_recipe_sysroot postfunc in the
python_hatchling class that removes any nested empty directories from
the sysroots during build, so that dependent recipes don't get caught
on them.
(From OE-Core rev: 3ded8b83cebb6d2b9f9da1c0325148f8da4ed23b)
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe')
-rw-r--r-- | meta/classes-recipe/python_hatchling.bbclass | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/meta/classes-recipe/python_hatchling.bbclass b/meta/classes-recipe/python_hatchling.bbclass index b9e6582eb5..b5a3c3feea 100644 --- a/meta/classes-recipe/python_hatchling.bbclass +++ b/meta/classes-recipe/python_hatchling.bbclass | |||
@@ -7,3 +7,21 @@ | |||
7 | inherit python_pep517 python3native python3-dir setuptools3-base | 7 | inherit python_pep517 python3native python3-dir setuptools3-base |
8 | 8 | ||
9 | DEPENDS += "python3-hatchling-native" | 9 | DEPENDS += "python3-hatchling-native" |
10 | |||
11 | # delete nested, empty directories from the python site-packages path. Make | ||
12 | # sure that we remove the native ones for target builds as well | ||
13 | hatchling_rm_emptydirs:class-target () { | ||
14 | find ${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/* -depth -type d -empty -delete | ||
15 | find ${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages/* -depth -type d -empty -delete | ||
16 | } | ||
17 | |||
18 | hatchling_rm_emptydirs:class-native () { | ||
19 | find ${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages/* -depth -type d -empty -delete | ||
20 | } | ||
21 | |||
22 | # Define a default empty version of hatchling_rm_emptydirs to appease bitbake | ||
23 | hatchling_rm_emptydirs () { | ||
24 | : | ||
25 | } | ||
26 | |||
27 | do_prepare_recipe_sysroot[postfuncs] += " hatchling_rm_emptydirs" | ||