Files
poky/meta/classes-recipe/cython.bbclass
Ross Burton 121ffba743 classes-recipe/cython: handle builds with no .c sources
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.

(From OE-Core rev: f1c1bdb05ea8f79a14a4b53e110889b70881f4d7)

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>
2024-11-18 22:09:03 +00:00

12 lines
498 B
Plaintext

DEPENDS:append = " python3-cython-native"
# Remap the build paths that appear in generated .c code
export CYTHON_PREFIX_MAP = "${S}=${TARGET_DBGSRC_DIR} ${B}=${TARGET_DBGSRC_DIR}"
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 --no-run-if-empty --null sed -i -e "/BEGIN: Cython Metadata/,/END: Cython Metadata/d"
}