From patchwork Fri Feb 25 04:03:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Orling X-Patchwork-Id: 4236 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 88404C433F5 for ; Fri, 25 Feb 2022 04:04:13 +0000 (UTC) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mx.groups.io with SMTP id smtpd.web09.3254.1645761852871519267 for ; Thu, 24 Feb 2022 20:04:12 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k60Kf0ns; spf=pass (domain: gmail.com, ip: 209.85.214.174, mailfrom: ticotimo@gmail.com) Received: by mail-pl1-f174.google.com with SMTP id x11so3714254pll.10 for ; Thu, 24 Feb 2022 20:04:12 -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=00ybtLqcmgkt4bYBjeG5BaQ/rMF0X+eMjL0kjGPb8CY=; b=k60Kf0nsJ1zm4SPItQKHKSqW8lgPHnFxnVydFDtid13EshiapaqYhpSwJwYaFolHiy gDiG7iX3LqEbtyRkoEjlDiGmQX3LYIQNUyqaf/xuH6VBmit3pdknbHx9yFRHb1d/IX19 zktLdi359+ePyHvfyqCrVZonx5KZObLQzFm7imGIXYs4D93HVMOHfyMB5aYlll+d1Skb wvgKvehXvLTvxEcxjGVr//s0TR8Z37wa3+pYDjVeXxhPI5ECiHNDEhOIlTh7n4APBgUa CgSnoYzN3E5hp368z4KGFbwPC4GzmFOP16sTObMX2axnumooCgGcoNawwBlY9v47yPcX ioMQ== 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=00ybtLqcmgkt4bYBjeG5BaQ/rMF0X+eMjL0kjGPb8CY=; b=Ef4qPhq2XOwX6+00FvEgbObf5LzYYzBgmBU7MSUBJeIGIfY0MSnNXoaUNQqJQebJD3 nmcM06lf8bEn7wauFFhslSBTY4C7zZVJ5bto1/ooiLrO+4POlNd9iF4Q0tiZkl4wtH5k /tsoekwtPlhzmeA9odGhEZ8OrqUHmd2Nk7G95orGlnqAKGX6/bRK8zbuapykL3dkI4bA BPash2KSLwxn6pVOoq0J2S7XENap/eYchNM0YqxwqkoJgNSXjFzWigkIhN1zio5hEnOO KI5vereH1wFaDYwwPFAmxg79VuLC3QTmTQkevXU5iZ18O5rMxE6uI6u050nIqQ/xo9IV 1Uwg== X-Gm-Message-State: AOAM533e1TPWyKGtGXUAjOjE/i86ef4dcM8OJkgfe8S+JJ97kwQkx/Hn OdJEULLibFTH1dYmRftO1HFDRL6nSqyiKg== X-Google-Smtp-Source: ABdhPJyJQn/ozZe+SD+oS3xFh93onbrVEQVBASYghC+isLdDU3sQIG5Uo481pbzxWovZXpmv7zVaZw== X-Received: by 2002:a17:90a:3c89:b0:1bc:b475:65e1 with SMTP id g9-20020a17090a3c8900b001bcb47565e1mr1335768pjc.30.1645761851912; Thu, 24 Feb 2022 20:04:11 -0800 (PST) Received: from nereus.hsd1.or.comcast.net ([2601:1c0:6000:1b20:263d:523e:139c:a040]) by smtp.gmail.com with ESMTPSA id y5-20020a056a00190500b004f104b5350fsm1066512pfi.93.2022.02.24.20.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 20:04:11 -0800 (PST) From: Tim Orling X-Google-Original-From: Tim Orling To: openembedded-core@lists.openembedded.org Cc: Tim Orling , Tim Orling Subject: [PATCH v2 1/2] setuptools3.bbclass: add check for pyproject.toml Date: Thu, 24 Feb 2022 20:03:29 -0800 Message-Id: <20220225040329.813595-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 ; Fri, 25 Feb 2022 04:04:13 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/162334 From: Tim Orling 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 --- Changes in v2: fix whitespace errors meta/classes/setuptools3.bbclass | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/meta/classes/setuptools3.bbclass b/meta/classes/setuptools3.bbclass index 12561340b07..12d662fb49c 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 Fri Feb 25 04:03:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Orling X-Patchwork-Id: 4237 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 65F10C433EF for ; Fri, 25 Feb 2022 04:04:44 +0000 (UTC) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mx.groups.io with SMTP id smtpd.web09.3256.1645761883812751990 for ; Thu, 24 Feb 2022 20:04:43 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KtBGA5k7; spf=pass (domain: gmail.com, ip: 209.85.214.181, mailfrom: ticotimo@gmail.com) Received: by mail-pl1-f181.google.com with SMTP id l9so3298663pls.6 for ; Thu, 24 Feb 2022 20:04:43 -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=qG04nIg6J63aKeBJ76h2FtaMlt5RgWmHjYeeRb6mZXA=; b=KtBGA5k7WC6n4MP9km92C18xDWsRKfG2uk90RsjlM0oCClJzbqdC1LytnBnmRBXVI0 hVVVpkWHtw1eITPCLpst6rIF7qiytg4dBNlBPZiBvmlWhtNlhgROh7VSw5zpybAmjk3n CCxmOlp2eHVtEbGDQ+cjlizNzeXCubwoq05qTENs0aScw8BwoG4IQPnFZM/vu5pu0Ryr En8Z8REpmAIA2FQMq+3j3xyDInc4/om3Q8bjGWudI7VstCXidLKpiNfPB1q+XzT2NJdI PtgZsl9ApUXPpFZZ0Rc8hTwwBzkDHOkzl6yGR2fBfxyC9DCOXkCNGRZZW2JunXW9uI5l foHQ== 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=qG04nIg6J63aKeBJ76h2FtaMlt5RgWmHjYeeRb6mZXA=; b=cx0mnmIoL6zEUsQqLID5yxifJOcBK4wG9hnUuzLVm714UEZxyWxJyU2u5Zbji3fJe8 63esbhkoOUMtF6Y0EthhZW7d36im0z0UhRIi8JnRNnMyZVdNxMqPQ7Xovauw76JXkLfP a+zQnHHuJZYgO1g8SOETABrl+P2Hydm7wb8LC8o2aRwXHS2CXbttvl4aVNMQ2R0AhPMu 42mGxfxNvgwnSdJvqQCL5ABKec4UNEoDkfYu1rJahnIwAddrd9OSx2MJX/9WlDG8Grkg QMF8jixpTLP3/xr1mKp/JNd2Sskk1juSAn/fq+A9mgLtRqZWVySF546nTb0Yi2jk9bf3 b2Sg== X-Gm-Message-State: AOAM532SDTexPS7IB47U52bRMYwysKTFRnHN2Oo3A/OzftMUGQ6jsXzK VaXmoYz/PMPEd/a4yv3tkBCTUBeQWENL/w== X-Google-Smtp-Source: ABdhPJyMOEn1Ph49PGlh5sR7TTom8mJrgPf+TVY4icD55jY0X6QATn+P+eQfGpKaLiM83ojKt5Io/g== X-Received: by 2002:a17:90a:3f09:b0:1b8:e615:a261 with SMTP id l9-20020a17090a3f0900b001b8e615a261mr1342047pjc.196.1645761882960; Thu, 24 Feb 2022 20:04:42 -0800 (PST) Received: from nereus.hsd1.or.comcast.net ([2601:1c0:6000:1b20:263d:523e:139c:a040]) by smtp.gmail.com with ESMTPSA id y5-20020a056a00190500b004f104b5350fsm1066512pfi.93.2022.02.24.20.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 20:04:42 -0800 (PST) From: Tim Orling X-Google-Original-From: Tim Orling To: openembedded-core@lists.openembedded.org Cc: Tim Orling , Tim Orling Subject: [PATCH v2 2/2] pip_install_wheel: improved wheel filename guess Date: Thu, 24 Feb 2022 20:03:31 -0800 Message-Id: <20220225040329.813595-2-tim.orling@konsulko.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220225040329.813595-1-tim.orling@konsulko.com> References: <20220225040329.813595-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 ; Fri, 25 Feb 2022 04:04:44 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/162335 From: Tim Orling 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 --- Changes in v2: address review comments meta/classes/pip_install_wheel.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass index 8a848c0ebab..9f9feda6ee0 100644 --- a/meta/classes/pip_install_wheel.bbclass +++ b/meta/classes/pip_install_wheel.bbclass @@ -1,6 +1,10 @@ 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''' + return (d.getVar('PYPI_PACKAGE') or d.getVar('PN')).replace('-', '_') + +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"