]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
classes-recipe/cython: handle builds with no .c sources
authorRoss Burton <ross.burton@arm.com>
Thu, 14 Nov 2024 21:53:53 +0000 (21:53 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 18 Nov 2024 17:34:49 +0000 (17:34 +0000)
This didn't seem to be possible considering the entire point of Cython
is to generate C bindings, but some Python build systems remove the
build tree once the wheel has been generated, so we never get to see the
sources. As xargs will call the specified command even without any files
this results in sed failing.

Pass --no-run-if-empty so that this case doesn't result in an error.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/cython.bbclass

index f37ebeb23fefa76f67b3c5fff9b23e1570cd456b..53b84f5f5ebc4e839901af7b18ee5078969bc6cc 100644 (file)
@@ -7,5 +7,5 @@ do_compile[postfuncs] = "strip_cython_metadata"
 strip_cython_metadata() {
     # Remove the Cython Metadata headers that we don't need after the build, and
     # may contain build paths.
-    find ${S} -name "*.c" -print0 | xargs -0 sed -i -e "/BEGIN: Cython Metadata/,/END: Cython Metadata/d"
+    find ${S} -name "*.c" -print0 | xargs --no-run-if-empty --null sed -i -e "/BEGIN: Cython Metadata/,/END: Cython Metadata/d"
 }