From patchwork Thu Feb 24 04:11:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Orling X-Patchwork-Id: 4186 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 D5475C433F5 for ; Thu, 24 Feb 2022 04:12:09 +0000 (UTC) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mx.groups.io with SMTP id smtpd.web12.6261.1645675929014637604 for ; Wed, 23 Feb 2022 20:12:09 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=bK4jz0zt; spf=pass (domain: gmail.com, ip: 209.85.214.172, mailfrom: ticotimo@gmail.com) Received: by mail-pl1-f172.google.com with SMTP id l9so204205pls.6 for ; Wed, 23 Feb 2022 20:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hEeeMYKiElhKpIsThqJKWny5qf2I06iupEH95I6UvUk=; b=bK4jz0zti4CeD9IvbaKSLBr+m/abLIKIjjGj1cWtDKZCOGyYtYbGb1UQaX6m4pi08W 8qipb2tqd1MfZ7f8LVKP4ebxX0m1DdZaZIORwF8iQRVYNOs4iZ74SQNfLDjjfq+t6Qns lcG1wtZlh8Vo83OJRN3h6T24buEwpH7xoRq/jyowwGUFWP+YwnvjL6Dom/NeoQ+5v24n /7yzLSSl0Rg7pBdSwyYqp4eUjrCnU2DchINFnJiU8LxyjA9o0H+PbkzTE99mibNfVE7x UC7ch88BUGYdYhewRj7YPGeIuYtl1zF/E4+/FX/LaRzqQXGU0fR6ydlzgWnK915yZhfC 9P3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hEeeMYKiElhKpIsThqJKWny5qf2I06iupEH95I6UvUk=; b=zbI6CSxDKBsagkUY88gZ1SzQ8ZIuQF0Ml4/28uXnC8KCuFybzLmkI++VjdFE5cpHzZ UDA0B1txyCw/zgFwmvSssvBFId8bsuYNEOGVnAOdOvKaLtHvK1WyJ7XERt2OBJ2ZzqDc 8q5TR2pCRIpt2tCgdm9gGMiJR716JTHT1cMMbKVhbzok8dEVdmFoToD1V5V7AcMgknuI rvkloZ7CWbXGEXWEDIV+9XWthYSHVOIUqTtBtSc5tFQVhBW8MhBM+1sLaE/XrKRux4u5 jU+j/riFAGW1nuBZbvxcDIROqSHRj1ZUWT70vWdlcc3Dim8lOh1QtLugGbJixc339/SS OskA== X-Gm-Message-State: AOAM5339RDv3P8FuhH9TNG+PLriDka0+nuZodOqp9AYJj690ceJJaYYl /1oYI9fhIcFBkaWcLQahu1zsPBJPz6c3Vw== X-Google-Smtp-Source: ABdhPJy3rbV3UCaaWo47EVBoSyB9v1ySfQU/QJTNw37ceAyDz/tm1/xT+NCDXAng1NY5MUBW6GljsQ== X-Received: by 2002:a17:902:e806:b0:14f:d9b7:ab1 with SMTP id u6-20020a170902e80600b0014fd9b70ab1mr909524plg.151.1645675927856; Wed, 23 Feb 2022 20:12:07 -0800 (PST) Received: from nereus.hsd1.or.comcast.net ([2601:1c0:6000:1b20:16be:5024:1d60:b2cd]) by smtp.gmail.com with ESMTPSA id m19sm1086012pfk.215.2022.02.23.20.12.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 20:12:07 -0800 (PST) From: Tim Orling X-Google-Original-From: Tim Orling To: openembedded-core@lists.openembedded.org Cc: Tim Orling Subject: [PATCH 1/2] setuptools3.bbclass: add check for pyproject.toml Date: Wed, 23 Feb 2022 20:11:59 -0800 Message-Id: <20220224041200.2645054-1-tim.orling@konsulko.com> X-Mailer: git-send-email 2.30.2 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, 24 Feb 2022 04:12:09 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/162290 With help from Peter Kjellerstedt via IRC. Add a check for pyproject.toml in ${S} and if so check if it has a [build-system] build-backend. Give the user a helpful warning that the recipe should be changed to one of the PEP-517 classes (instead of setuptools3.bbclass). Add SETUPTOOLS_SKIP_BUILD_BACKEND_CHECK variable to skip this check (and avoid the warning). This is needed for e.g. python3-setuptools-rust-native which does not build cleanly with setuptools_build_meta.bbclass [YOCTO #14736] Signed-off-by: Tim Orling --- meta/classes/setuptools3.bbclass | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/meta/classes/setuptools3.bbclass b/meta/classes/setuptools3.bbclass index 12561340b07..b137cf0ce48 100644 --- a/meta/classes/setuptools3.bbclass +++ b/meta/classes/setuptools3.bbclass @@ -18,6 +18,38 @@ setuptools3_do_configure() { : } +SETUPTOOLS_SKIP_BUILD_BACKEND_CHECK ?= "0" + +python check_for_pyprojecttoml_build_backend() { + import os + import tomli + from pathlib import Path + + if d.getVar('SETUPTOOLS_SKIP_BUILD_BACKEND_CHECK') == "1": + bb.debug(3, "Skipping check for build-backend in pyproject.toml") + return 0 + pyprojecttoml_file = Path(d.getVar('S'), 'pyproject.toml') + if pyprojecttoml_file.exists(): + bb.debug(3, "pyproject.toml found: %s" % pyprojecttoml_file) + with open(pyprojecttoml_file, "rb") as f: + pyprojecttoml_dict = tomli.load(f) + build_system = pyprojecttoml_dict["build-system"] + if build_system: + bb.debug(3, "[build-system] found in pyproject.toml") + backend = build_system.get('build-backend') + if backend: + bb.debug(3, "build-backend found: %s" % backend) + if backend == "flit_core.buildapi": + bb.warn("The source has a pyproject.toml which declares 'flit_core.buildapi' as a build backend, please consider 'inherit flit_core' instead of inheriting setuptools3.") + elif backend == "setuptools.build_meta": + bb.warn("The source has a pyproject.toml which declares 'setuptools.build_meta' as a build backend, please consider 'inherit setuptools_build_meta' instead of inheriting setuptools3.") + elif backend == "poetry.core.masonry.api": + bb.warn("The source has a pyproject.toml which declares 'poetry.core.masonry.api' as a build backend, please consider 'inherit poetry_core' from meta-python instead of inheriting setuptools3.") + else: + bb.warn("The source has a pyproject.toml which declares '%s' as a build backend, but this is not currently supported in oe-core." % backend) +} +do_configure[prefuncs] += "check_for_pyprojecttoml_build_backend" + setuptools3_do_compile() { cd ${SETUPTOOLS_SETUP_PATH} NO_FETCH_BUILD=1 \ From patchwork Thu Feb 24 04:12:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Orling X-Patchwork-Id: 4187 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 E2BBBC433EF for ; Thu, 24 Feb 2022 04:12:14 +0000 (UTC) Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by mx.groups.io with SMTP id smtpd.web09.6397.1645675934302495421 for ; Wed, 23 Feb 2022 20:12:14 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CxcuPMgH; spf=pass (domain: gmail.com, ip: 209.85.214.175, mailfrom: ticotimo@gmail.com) Received: by mail-pl1-f175.google.com with SMTP id bd1so616643plb.13 for ; Wed, 23 Feb 2022 20:12:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DzsGOPZktC2ZAquqw+bMF0kPqxmh4NblBwIrO1Bxz1k=; b=CxcuPMgHXT4hB9wimb6ViiGxZOlOy0wTU6/OLgPqK7RB/JHxMcReIT0ekSbyl9NMk9 FDW0E121Px9qOyL2IP1e1cVMRRfvH6VsEG1Ra+Iqkh7OaSAqZWuGXqVs3G9GsBBMG1j2 z3uktLz95YNA2ph8/eRUPCtCH5VxsnEekjWcFhwHnGhQAvAU3poVplX9DXdh5NJ4QPhV 9nVBj5iklNDRGiTRtG69s6TCey/hgOwJyniRrxjLpQVLj3gHU4x/nN5WwWXYKOLPWlIW dCBRyUuBnEZTCnWnEgrOAtHGXTJ2A/vTIYwCN3vujUeOnsVGjP4TY7lTZpfJzyN03rsf zgYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DzsGOPZktC2ZAquqw+bMF0kPqxmh4NblBwIrO1Bxz1k=; b=p2yIp9/bfMBt4ddRvKI3UsdFfY0nzG2EfdrJfNvYXonoWzWcdJ/6fybOP050BkyGCn luhrcluZeOjFjoB7xqiLvWEzHmnHW1+W18nbf/c28MYqBmUovxxSjBw/rurj6X9ihH2K n8SZzpvWol1W6MAUMYSKDmrxICAPNji23wPAK+IUSgKg/YV2FI140xeaJ9fiEAmHLlEF vCvOA7k3Whm/K+hwv/1DSvxWo05MotGWs8CpvnwM9IA2MLmAwayj6Z7sAS7wadwMCjw/ uXgNAQca8koSyH5lXco1YQyU3rTEJp6lsWl94tG76E0DG2wWDZGPVZxveGMWJZvEAIY1 AC/w== X-Gm-Message-State: AOAM5333XWsbbwpqUAPXeQPQReybS+fU7KE6st/xMKMj/XAcE141E2G2 QoiWWRqPysb4ORXwjQNcEHTAvzEJBBT5bA== X-Google-Smtp-Source: ABdhPJwuh6/Blu0Jb9jddmQa10c93DXRMTxWAcXADqqh1yajUtWbPAp7jT9jhKFWGC8xbYkj7fikxQ== X-Received: by 2002:a17:902:e945:b0:14e:b8d9:aa07 with SMTP id b5-20020a170902e94500b0014eb8d9aa07mr881483pll.163.1645675933328; Wed, 23 Feb 2022 20:12:13 -0800 (PST) Received: from nereus.hsd1.or.comcast.net ([2601:1c0:6000:1b20:16be:5024:1d60:b2cd]) by smtp.gmail.com with ESMTPSA id m19sm1086012pfk.215.2022.02.23.20.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 20:12:12 -0800 (PST) From: Tim Orling X-Google-Original-From: Tim Orling To: openembedded-core@lists.openembedded.org Cc: Tim Orling Subject: [PATCH 2/2] pip_install_wheel: improved wheel filename guess Date: Wed, 23 Feb 2022 20:12:00 -0800 Message-Id: <20220224041200.2645054-2-tim.orling@konsulko.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220224041200.2645054-1-tim.orling@konsulko.com> References: <20220224041200.2645054-1-tim.orling@konsulko.com> 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, 24 Feb 2022 04:12:14 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/162291 Rather than only use PYPI_PACKAGE as a guess, fall back on PN for cases where a recipe does not inherit pypi. Wheels can only have alphanumeric characters in the 'distribution' name [1]. Any other characters are replaced with an underscore. Provide a function to replace dash with underscore. [1] https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode Signed-off-by: Tim Orling --- meta/classes/pip_install_wheel.bbclass | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass index f0312e0b1eb..e0f0b97ad13 100644 --- a/meta/classes/pip_install_wheel.bbclass +++ b/meta/classes/pip_install_wheel.bbclass @@ -1,6 +1,15 @@ DEPENDS:append = " python3-pip-native" -PIP_INSTALL_PACKAGE ?= "${PYPI_PACKAGE}" +def guess_pip_install_package_name(d): + '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode''' + package = "" + if not d.getVar('PYPI_PACKAGE'): + package = (d.getVar('PN').replace('-', '_')) + else: + package = (d.getVar('PYPI_PACKAGE').replace('-', '_')) + return package + +PIP_INSTALL_PACKAGE ?= "${@guess_pip_install_package_name(d)}" PIP_INSTALL_DIST_PATH ?= "${B}/dist" PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-${PV}-*.whl"