summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/python_hatchling.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-recipe/python_hatchling.bbclass')
-rw-r--r--meta/classes-recipe/python_hatchling.bbclass18
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 @@
inherit python_pep517 python3native python3-dir setuptools3-base
DEPENDS += "python3-hatchling-native"
+
+# delete nested, empty directories from the python site-packages path. Make
+# sure that we remove the native ones for target builds as well
+hatchling_rm_emptydirs:class-target () {
+ find ${STAGING_LIBDIR}/${PYTHON_DIR}/site-packages/* -depth -type d -empty -delete
+ find ${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages/* -depth -type d -empty -delete
+}
+
+hatchling_rm_emptydirs:class-native () {
+ find ${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages/* -depth -type d -empty -delete
+}
+
+# Define a default empty version of hatchling_rm_emptydirs to appease bitbake
+hatchling_rm_emptydirs () {
+ :
+}
+
+do_prepare_recipe_sysroot[postfuncs] += " hatchling_rm_emptydirs"