From patchwork Thu Nov 14 21:53:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 52493 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6EE8D6A23A for ; Thu, 14 Nov 2024 21:54:07 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.6280.1731621238793845947 for ; Thu, 14 Nov 2024 13:53:59 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1590D1474 for ; Thu, 14 Nov 2024 13:54:28 -0800 (PST) Received: from cesw-amp-gbt-1s-m12830-04.oss.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 89A383F66E for ; Thu, 14 Nov 2024 13:53:57 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Subject: [PATCH] classes-recipe/cython: handle builds with no .c sources Date: Thu, 14 Nov 2024 21:53:53 +0000 Message-Id: <20241114215353.734794-1-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 14 Nov 2024 21:54:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/207177 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 --- meta/classes-recipe/cython.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes-recipe/cython.bbclass b/meta/classes-recipe/cython.bbclass index f37ebeb23fe..53b84f5f5eb 100644 --- a/meta/classes-recipe/cython.bbclass +++ b/meta/classes-recipe/cython.bbclass @@ -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" }