From patchwork Tue Mar 1 07:56:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Weihmann X-Patchwork-Id: 4490 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 3B3ABC433F5 for ; Tue, 1 Mar 2022 07:56:32 +0000 (UTC) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (EUR02-VE1-obe.outbound.protection.outlook.com [40.92.69.102]) by mx.groups.io with SMTP id smtpd.web09.5942.1646121390553349542 for ; Mon, 28 Feb 2022 23:56:31 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=ak/QoSj2; spf=pass (domain: outlook.com, ip: 40.92.69.102, mailfrom: kweihmann@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HUmQS1WidahNsXnesHeo3GYfeVsIBV4gmYs2mrMn4vylHJgm1diXqnCX2SPqZ5QFvpC7pNbRL43N8HymkDAU/bWY0v2FFwU1OFtb/q8/494FsUT2+oyFY6YZfofF7jUCSVWf5yK/Gijtf8kSRBqY81CP5FEIQ0hgfKj4JoTk/yG4FUq0ebkHtdUFvKzKrEk2uokfkxRIoXcJ/pCgmQ/8qmlyWA/FTOQoOr7hm4tpL+wP5+vzDWayhQHuoUf8cHkAVAMxn7mP/r0Q92Mbr4fLmhWCpl7m/OvNjMhBENjj3wJBVfPyjoczVhD+Sj/pBYs9lUTjN04G3QRVyTbDUs+vFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gN8GrZAVEVkp69Oi7lksRENpVxrad7giXuRqFwzqFz0=; b=Dd/QBrtyyNzhustGBoEROEF+le/3Y8vojTwFXkGVq3kJEOv3DrFsvEwvuvMwmN9fNf7WNjBZbx0u70YxhVHJWnb9oPGeJvARaTIERru3Uhgz+VhL/pO/WcqhDxjjcZNq7z3sKuMPzA/V/X+pol0lld8eCBALgPgriHqbobz1XLo+9rp9sAu1i8JxR5GF0botkG9+35i8vJtCQ0nGmAFTvbWnT9uy5Z9l6cvf2X9XZclm0xAwoDHmS6GRa8W+CfLlfBHYzXh//p0q1zRgVUZ/NW/f7RtbCsHtaNkYr9Vgshrmv9xy1QIHQUv2XRLT+GAA8WtpPgdZO/g48PHON3INOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gN8GrZAVEVkp69Oi7lksRENpVxrad7giXuRqFwzqFz0=; b=ak/QoSj2ykCbU7gWiEZAcUuXc+osX3iS7mMiPRQQy1BcH2s1I6qh4hgqyxLZqItBX0dN+11hiBlEy0jhQm3yOWARDAStJHZWFVRICT3M9eO2SrbXGp42OVZq7pW3BOoZiDRZmXIyOVrTEj/ZmtqsmSoeIzPSiRXNlATuWlkcDrL4iG1lfAglqyIBv9hBXnMeGtQ3T1tKu2ME2JWHvPoOrdVaIQGHT/wcyI0Vc3O/cYQClBhmZA6+THoncgvfdqen/OeqefK65knQ3ErFRaGjuvHkUbkXRyE9MZGLq22wVoa3v/XmK0x2J8dr52tMB3HrVq2cY9vCNzrkZ05AIA5VYg== Received: from AS8PR09MB4645.eurprd09.prod.outlook.com (2603:10a6:20b:292::8) by AM9PR09MB4818.eurprd09.prod.outlook.com (2603:10a6:20b:2d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.22; Tue, 1 Mar 2022 07:56:27 +0000 Received: from AS8PR09MB4645.eurprd09.prod.outlook.com ([fe80::296b:6866:9ac3:65e0]) by AS8PR09MB4645.eurprd09.prod.outlook.com ([fe80::296b:6866:9ac3:65e0%3]) with mapi id 15.20.5017.027; Tue, 1 Mar 2022 07:56:27 +0000 From: Konrad Weihmann To: openembedded-core@lists.openembedded.org CC: Konrad Weihmann Subject: [meta-oe][PATCH v2] pip_install_wheel: improve wheel handling Date: Tue, 1 Mar 2022 08:56:11 +0100 Message-ID: X-Mailer: git-send-email 2.25.1 X-TMN: [oyCDWsmXiS8fdcV0ARvpa9PRER4BAvYT7+y5uHpVaTEY1J6jAV1W3RXXizrTvKNS] X-ClientProxiedBy: AM6PR04CA0062.eurprd04.prod.outlook.com (2603:10a6:20b:f0::39) To AS8PR09MB4645.eurprd09.prod.outlook.com (2603:10a6:20b:292::8) X-Microsoft-Original-Message-ID: <20220301075611.18798-1-kweihmann@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 670e85c5-4d78-4e3b-692a-08d9fb58fd2d X-MS-Exchange-SLBlob-MailProps: tBYDyRQCPckUxFtwzn7qeFsH753DMJdSkkWxpjCAzEnnsXdH7Ac5sF0l74mGw4MbCX86D+2rW4FGxGHtiw+f7m1ISSGXK0fDAZWrGdtaVHBcrb7VNv2qwB5ZtdfiAAb5P+gwhTgX5VXhkbSJFuPToR2GOwWSPm3E+sH5HI6C04UPI2ld5nyiPCeyVmi1Zejm8mpd6eQ9McQssiZ/V9WbhPdvygQjxZrOquNrsIibSCA2h2+56eISBoi5Wwtd0oozVvflXM6x5/6xku6aK8Kc0hSDo6Foapcvfm8BzLqZB6rIF1DGumiXyGwXPO+8niL3yrbKCoA1cShYMj4SMNSKR3DX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PCdSFEQVeafpjYBIN+ZjZ3F85TSULZhSTngnOIw/8a1l25VO0YxmNGBkLeqdteToNXznkwm5IKyBeViLMw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 670e85c5-4d78-4e3b-692a-08d9fb58fd2d X-MS-Exchange-CrossTenant-AuthSource: AS8PR09MB4645.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2022 07:56:27.5441 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR09MB4818 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 ; Tue, 01 Mar 2022 07:56:32 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/162529 - replace python3 prefix when guessing the wheel name as there are still plenty of recipes out there that do use python3 prefixes - remove all previously generated wheels matching the glob to avoid installing any outdated blob - don't use PV in glob, as PV doesn't necessarily align with the version used inside of the setuptools configuration. this will avoid having the user set PYPA_WHEEL in a lot of recipes - respect SETUPTOOLS_SETUP_PATH in PIP_INSTALL_DIST_PATH and use B as a fallback only (in case this class is inherited without setuptools3 class being there as well). recipes like python3-smbus run in a subfolder of the workspace and were failing in before this adjustment Signed-off-by: Konrad Weihmann --- v2: fix type in python3 prefix replacement meta/classes/pip_install_wheel.bbclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/meta/classes/pip_install_wheel.bbclass b/meta/classes/pip_install_wheel.bbclass index 5b7e5cd706..1b6db91d6f 100644 --- a/meta/classes/pip_install_wheel.bbclass +++ b/meta/classes/pip_install_wheel.bbclass @@ -1,12 +1,13 @@ DEPENDS:append = " python3-pip-native" def guess_pip_install_package_name(d): + import re '''https://www.python.org/dev/peps/pep-0491/#escaping-and-unicode''' - return (d.getVar('PYPI_PACKAGE') or d.getVar('BPN')).replace('-', '_') + return (d.getVar('PYPI_PACKAGE') or re.sub(r"^python3-", "", d.getVar('BPN')).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" +PIP_INSTALL_DIST_PATH ?= "${@d.getVar('SETUPTOOLS_SETUP_PATH') or d.getVar('B')}/dist" +PYPA_WHEEL ??= "${PIP_INSTALL_DIST_PATH}/${PIP_INSTALL_PACKAGE}-*-*.whl" PIP_INSTALL_ARGS ?= "\ -vvvv \ @@ -28,6 +29,8 @@ PIP_INSTALL_PYTHON = "python3" PIP_INSTALL_PYTHON:class-native = "nativepython3" pip_install_wheel_do_install () { + # cleanup previously generated files + rm -f ${PYPA_WHEEL} nativepython3 -m pip install ${PIP_INSTALL_ARGS} ${PYPA_WHEEL} || bbfatal_log "Failed to pip install wheel. Check the logs."