From patchwork Thu Oct 22 18:36:06 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Anavi X-Patchwork-Id: 101688 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.6007.1792694179813590458 for ; Thu, 22 Oct 2026 11:36:20 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@konsulko.com header.s=google header.b=bMwN2PbZ; spf=pass (domain: konsulko.com, ip: 209.85.128.46, mailfrom: leon.anavi@konsulko.com) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4a1df146015so993345e9.0 for ; Thu, 22 Oct 2026 11:36:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1792694178; x=1793298978; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=dnnK2eTrFRLJpcI2cCmQrbIyCnuZXVvLD5iMxwq7XBw=; b=bMwN2PbZD5rhMbPsgv/J0hmKUZoWkT5Inq1m84wdQzeno6oKYEKl7aDZ+fpUvoJV3d 3KDrwIHCOVYkeHvr3KU/WTRHLUQzKkfSe2vDBAtnAMvel5oZ1R3phEoWsXeA0yrbeTyf GRRidoJOyMs8+udTISSf23+52Kv6rCFcEAcf0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792694178; x=1793298978; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=dnnK2eTrFRLJpcI2cCmQrbIyCnuZXVvLD5iMxwq7XBw=; b=IMddhBTlQqegLPFllYY7yGx1rT5bbB0DMnAYTrDk52V4LMwcGjigOQcU2Fg3BoCEu2 f13mk3WDyADKGpPIHqdyh72q+S/tTnmvaNq49jqBOyEg66wE3UcuZ9uVDunQ2uGNpyzJ 0a0LqrvkBoFBsZjnsQDcruZwl4qFSPQ42acQ7IAvFqfcduPdWedom7UaGQSVgnwavJLL w0WvQr3zsXUqQpK8WaUJPY+TYCUv3x9/NwmRxpulVNIf8ryQ8YPv5i9ebq5+uK0NGN7v CRIetzAMsIwSwi6YlcN5c+QTLwRtXRTujxsxPHJJLp6YPGfCu5PrzzW3vHMGGV+cPSb8 6juA== X-Gm-Message-State: AFq9FYLeNUh8wfUAk+LuIEdOSmd/WvfGgE7+sfDwzXHt4Ahin2GEnWu+ lN488O2Bz35xCjkYxRttDVtb4t1r1IAGppOXibkVMNYbDPZrTEAVn6OeUjoT+U+5gDaeihzX3Ro fxviQ X-Gm-Gg: AYBFou0rhKgSNOUTYMfxWfqYIwQnKpGlva1FH2o2Vh7w8Usx0SrOElvspmdzJgHuSSR 5lVNtv7KAkyU+qraTq/X/6KkTxmWuu+QeIxywhrednV79sTd9+35zyxBZrLhBa2xkPy7zcJsE63 51e9MndP8ETAujEPrVcAZUTo4a+oqAfIZ6yqqCbCurTgwVK9VwsLLSUr5utq3Bwm9UmydH4kdt2 YCPQ1tsSjTDNbQhRxOHFgKY4SkjCvs0iKTs0PMd6hGHYRzCwPy5HFQaJVS7NYEaKzQkZjf5tMqv iBGr8kOy6faX6T6H8pVT1UzKwpxmUp2HddfO1YFLrRXIZTV0nvONLpGxtuR2a1TYCp5HbN+50/m C9SnkuUszhLzi8EhZdW27KY3X4mVE5oKSKXUiohp6xjtpls6apaZ1XiOyYv8wfvNBQHnZEEaYfP WDguyjRxrkESjdvML7GZjvk3JEfw6nffkI7pwfu6Fr2LkqI2J0V6pG0BoAfcUIKvvFOUku5DpC/ wPTPqXW7VJ9/nPMWAYyRWgl4wJ7cKk0zsw/dL3yQ6CbUbHSitKevvdm1k0irpJp2wIZwSSWSQ9U Wh5FOSFfkWi0h5KnrXCgcTrH+I+nXhZ0DPgl2TaNsg0PR4pEJyZ2U/y8pjz6zTXmzGa+WAl2Eeb B4uip X-Received: by 2002:a05:600c:c094:b0:4a1:faa1:3813 with SMTP id 5b1f17b1804b1-4a1fdd26e79mr106804975e9.27.1792694177654; Thu, 22 Oct 2026 11:36:17 -0700 (PDT) Return-Path: Received: from tone.k.g (lan.nucleusys.com. [92.247.61.126]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a21047b524sm15303475e9.14.2026.10.22.11.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2026 11:36:15 -0700 (PDT) From: Leon Anavi To: openembedded-core@lists.openembedded.org Cc: Leon Anavi Subject: [PATCH 1/3] recipetool: Support multi-line license Date: Thu, 22 Oct 2026 21:36:06 +0300 Message-ID: <20261022183608.3500655-1-leon.anavi@konsulko.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 22 Oct 2026 18:36:26 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248452 Some Python packages put the full license text into the license field of PKG-INFO or pyproject.toml instead of a short identifier. Add a comment_lines() helper to PythonRecipeHandler which prefixes every continuation line with '#' to avoid the ParseError. Fixes: $ devtool add python3-tibs https://pypi.org/project/tibs bb.parse.ParseError: ParseError at .../python3-tibs_2.0.2.bb:9: unparsed line: 'Copyright (c) 2025 Scott Griffiths (...)' ERROR: Parsing newly created recipe failed AI-Generated: Uses Claude Code Signed-off-by: Leon Anavi --- scripts/lib/recipetool/create_buildsys_python.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py index 0c5f44b966..81ceaed47a 100644 --- a/scripts/lib/recipetool/create_buildsys_python.py +++ b/scripts/lib/recipetool/create_buildsys_python.py @@ -123,6 +123,17 @@ class PythonRecipeHandler(RecipeHandler): """ return re.sub(r"[-_.]+", "-", s).lower() + @staticmethod + def comment_lines(s): + """ + Some Python packages put the full license text into the license + field of PKG-INFO or pyproject.toml instead of a short identifier. + Prefix follow-up lines with '#' so that multi-line values (e.g. + a full license text) remain a valid comment in the recipe. + """ + return "\n".join(("# " + line).rstrip() if i else line + for i, line in enumerate(s.splitlines())) + def process_url(self, args, classes, handled, extravalues): """ Convert any pypi url https://pypi.org/project// into https://files.pythonhosted.org/packages/source/... @@ -675,7 +686,7 @@ class PythonSetupPyRecipeHandler(PythonRecipeHandler): if license_str: for i, line in enumerate(lines_before): if line.startswith('##LICENSE_PLACEHOLDER##'): - lines_before.insert(i, '# NOTE: License in setup.py/PKGINFO is: %s' % license_str) + lines_before.insert(i, '# NOTE: License in setup.py/PKGINFO is: %s' % self.comment_lines(license_str)) break if 'Classifier' in info: @@ -914,7 +925,7 @@ class PythonPyprojectTomlRecipeHandler(PythonRecipeHandler): for i, line in enumerate(lines_before): if line.startswith("##LICENSE_PLACEHOLDER##"): lines_before.insert( - i, "# NOTE: License in pyproject.toml is: %s" % license_str + i, "# NOTE: License in pyproject.toml is: %s" % self.comment_lines(license_str) ) break From patchwork Thu Oct 22 18:36:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Anavi X-Patchwork-Id: 101689 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.5969.1792694180869516356 for ; Thu, 22 Oct 2026 11:36:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@konsulko.com header.s=google header.b=LW9RrZiR; spf=pass (domain: konsulko.com, ip: 209.85.128.45, mailfrom: leon.anavi@konsulko.com) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4980fe6b3beso8020205e9.0 for ; Thu, 22 Oct 2026 11:36:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1792694179; x=1793298979; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=f9gIQIs8pWCHlLczUlu/+XCkVgh/hLWaV6spcm6TE1Q=; b=LW9RrZiRqqDm8q47ipl4QJDG3GsAkzaw9ir13Go7y6QTgU5OFxZGjNjO8CrKgTixDT 2zsI8eJ7rkWT6R0PzOiyigAcfEAiaGqO0Jz0HxferejyT83xOMwENV9RZmxKBGehddr3 8ZtlWdJd4hqb9a/1ek52cYuzHEtFM3S7jeotc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792694179; x=1793298979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=f9gIQIs8pWCHlLczUlu/+XCkVgh/hLWaV6spcm6TE1Q=; b=rwepFDf4lbUDKLqS4sJiMj9vlO8NzAKhTaBKrod5kMrHR/W4qwDeXAt159PW5tn5wS gGo9Z7w68i7/5ATb2f1W04c6CTIGuyCLnOtzUaY/77yFhDyPqK5aLYJAovBVEF5onDrX 22ArtxpJRxZJSmTjn6bA5tBa/ttUk5rCNYIAEhC7Oq5o83Fbs1QPGSH+KgdGnwOuR+A+ mf7eGJ9qC/wl6d/+QmtTqex7NL4VSAkSqV0KdUXyicge/nDh/gswdtivmbQL9jivgSvE E8YwfsDzDpWae6knflScbjiwcInHguwWZffMpsQ6MBbz7xrdPqPI0K0dFyWXocPgfi2L wjmA== X-Gm-Message-State: AFq9FYKV/xSKCF2bzEwTeXGWHp8JdTdj+gYJCJESjOI+wasG+JusfuEm 1pEujYcCnCVqS3PVv2bZC2b2FptFZjK8Ei++piwnTC0T54qP3X98HXJT1u3g4O+QBa/AnFU/10U 8YZ3Q X-Gm-Gg: AYBFou3/NUkm0hPxFXJ6b7lgeugnRjVBc4Jrl2Si8d66LkpQCKZSEEIBJoYqp68RwmN nfs08bKLYhYt5+DY1qTJ7Utso/IpslcZcfi8sc8CX9JWjA//Djo1X9Aq1zea/o1INlDTUsUdCnn BJLutvTTs+zb0HeViytyeOrB8Ecl5ft7ZUrxjzceKONrYsBmUHomL8XXyiwyJ9yEipNCBTUd5n1 2jwsD7LAIYOnwmhLD+La3KmbJijdA55JHAD1+nOxjOTEUTZMoa8ubA9DWnzn4yXreauwA1wcTht htYPobTbTKNfZoiFIj9W9rGZCsiqqSLLiMDcSMKbLF0aECLHSEcwaIPe9XcbigppL3SMAsCYdmo W8jugo8QrXbq7mLHgxhl4M3Zu8MPA+jjxh5/FcsCFNa0Bj7ui3nbwcvf3CBXshlFuBDyut1pzYD WiZUpzfUOVfRvGhmaaX9j9oSLQkwI/twrRQE+iKYbHB7yQrx5FDyZGLY+Lnes9l8ZaFlWHvNa3J w8rPSDb4w/2pJpYdFQsvUaSaPF5b0PO3JPvpwqJNqEpEk3DHPUNm5RWoNQKKcRX7evVr/d7SFEc LIiUMArCvYkKd5QPTGh/xliFTOxbP4FBy8ilIS55Dysw8gjGb1yiJ/IYrObwKWFrx4VMTYriJLf Uc5Av X-Received: by 2002:a05:600c:1d07:b0:49e:6581:7baf with SMTP id 5b1f17b1804b1-4a204a8f4camr57059925e9.2.1792694178805; Thu, 22 Oct 2026 11:36:18 -0700 (PDT) Return-Path: Received: from tone.k.g (lan.nucleusys.com. [92.247.61.126]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a21047b524sm15303475e9.14.2026.10.22.11.36.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2026 11:36:18 -0700 (PDT) From: Leon Anavi To: openembedded-core@lists.openembedded.org Cc: Leon Anavi Subject: [PATCH 2/3] recipetool: Fix sdist name detection from PyPI Date: Thu, 22 Oct 2026 21:36:07 +0300 Message-ID: <20261022183608.3500655-2-leon.anavi@konsulko.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261022183608.3500655-1-leon.anavi@konsulko.com> References: <20261022183608.3500655-1-leon.anavi@konsulko.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 22 Oct 2026 18:36:26 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248453 The sdist name used to decide whether PYPI_PACKAGE_SDIST needs to be set was determined incorrectly: - For pypi.org project URLs the release filename was split on every '-', so python-magic-0.4.15.tar.gz resulted in PYPI_PACKAGE_SDIST = "python". - For files.pythonhosted.org URLs the name was taken from determine_from_url(), which lowercases it and replaces '_' with '-'. For sphinxcontrib_svg2pdfconverter-2.0.0.tar.gz this set PYPI_PACKAGE_SDIST to the hyphenated name although the sdist uses the standard underscore form and the variable is not needed. In both cases the generated recipe fetches from a non-existent URL. Before: devtool add python3-magic https://pypi.org/project/python-magic/ bitbake python3-magic -e | grep ^PYPI_PACKAGE PYPI_PACKAGE="python-magic" PYPI_PACKAGE_EXT="tar.gz" PYPI_PACKAGE_SDIST="python" devtool add python3-sphinxcontrib-svg2pdfconverter https://files.pythonhosted.org/packages/b9/05/11b12853b6a0398bd19d5464b68cb97dde21c354265ff2c1929f92ae03a9/sphinxcontrib_svg2pdfconverter-2.1.0.tar.gz bitbake python3-sphinxcontrib-svg2pdfconverter -e | grep ^PYPI_PACKAGE PYPI_PACKAGE="sphinxcontrib-svg2pdfconverter" PYPI_PACKAGE_EXT="tar.gz" PYPI_PACKAGE_SDIST="sphinxcontrib-svg2pdfconverter" After: devtool add python3-magic https://pypi.org/project/python-magic/ bitbake python3-magic -e | grep ^PYPI_PACKAGE PYPI_PACKAGE="python-magic" PYPI_PACKAGE_EXT="tar.gz" PYPI_PACKAGE_SDIST="python-magic" devtool add python3-sphinxcontrib-svg2pdfconverter https://files.pythonhosted.org/packages/b9/05/11b12853b6a0398bd19d5464b68cb97dde21c354265ff2c1929f92ae03a9/sphinxcontrib_svg2pdfconverter-2.1.0.tar.gz bitbake python3-sphinxcontrib-svg2pdfconverter -e | grep ^PYPI_PACKAGE PYPI_PACKAGE="sphinxcontrib-svg2pdfconverter" PYPI_PACKAGE_EXT="tar.gz" PYPI_PACKAGE_SDIST="sphinxcontrib_svg2pdfconverter" Split only on the last '-' and use the name exactly as it appears in the filename. Fixes: 52779aa8b5 ("recipetool: set PYPI_PACKAGE_SDIST if needed") AI-Generated: Uses Claude Code Signed-off-by: Leon Anavi --- meta/lib/oeqa/selftest/cases/recipetool.py | 7 +++++++ scripts/lib/recipetool/create_buildsys_python.py | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 5a9fc8ea67..ca05e54593 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -511,6 +511,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=16a934f165e8c3245f241e77d401bb88' checkvars['SRC_URI[sha256sum]'] = 'f3765c0f582d2dfc72c15f3b5a82aecfae9498bd29ca840d72f37d7bd38bfcd5' checkvars['PYPI_PACKAGE'] = pn + checkvars['PYPI_PACKAGE_SDIST'] = pn inherits = ['setuptools3', 'pypi'] self._test_recipe_contents(recipefile, checkvars, inherits) @@ -533,6 +534,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=16a934f165e8c3245f241e77d401bb88' checkvars['SRC_URI[sha256sum]'] = 'f3765c0f582d2dfc72c15f3b5a82aecfae9498bd29ca840d72f37d7bd38bfcd5' checkvars['PYPI_PACKAGE'] = pn + checkvars['PYPI_PACKAGE_SDIST'] = pn inherits = ['setuptools3', "pypi"] self._test_recipe_contents(recipefile, checkvars, inherits) @@ -547,6 +549,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=16a934f165e8c3245f241e77d401bb88' checkvars['SRC_URI[sha256sum]'] = 'f3765c0f582d2dfc72c15f3b5a82aecfae9498bd29ca840d72f37d7bd38bfcd5' checkvars['PYPI_PACKAGE'] = pn + checkvars['PYPI_PACKAGE_SDIST'] = pn inherits = ['setuptools3', "pypi"] self._test_recipe_contents(recipefile, checkvars, inherits) @@ -572,6 +575,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars = {} checkvars['LICENSE'] = 'MIT' checkvars['PYPI_PACKAGE'] = pn + checkvars['PYPI_PACKAGE_SDIST'] = pn inherits = ['setuptools3', "pypi"] self._test_recipe_contents(recipefile, checkvars, inherits) @@ -593,6 +597,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars['LICENSE'] = 'BSD-3-Clause' checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=702b1ef12cf66832a88f24c8f2ee9c19' checkvars['SRC_URI[sha256sum]'] = 'c225b674c83fa923be93d235330ce0300373d02885cef23238813b0d5668304a' + checkvars['PYPI_PACKAGE_SDIST'] = None inherits = ['python_setuptools_build_meta', 'pypi'] self._test_recipe_contents(recipefile, checkvars, inherits) @@ -616,6 +621,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars['LICENSE'] = 'GPL-3.0-only' checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=1ebbd3e34237af26da5dc08a4e440464' checkvars['SRC_URI[sha256sum]'] = '81f7c0c5559becc8049470d86046b36e96113637bcbe4753ecef06977c00245d' + checkvars['PYPI_PACKAGE_SDIST'] = None inherits = ['python_setuptools_build_meta', 'pypi'] self._test_recipe_contents(recipefile, checkvars, inherits) @@ -638,6 +644,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars['LICENSE'] = 'BSD-2-Clause' checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE.txt;md5=b11cf936853a71258d4b57bb1849a3f9' checkvars['SRC_URI[sha256sum]'] = 'ab9c8f1080391e231812d20abf2657a69ee35574563b1014414f953964a95fa3' + checkvars['PYPI_PACKAGE_SDIST'] = None inherits = ['python_setuptools_build_meta', 'pypi'] self._test_recipe_contents(recipefile, checkvars, inherits) diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py index 81ceaed47a..4fc96db7e8 100644 --- a/scripts/lib/recipetool/create_buildsys_python.py +++ b/scripts/lib/recipetool/create_buildsys_python.py @@ -162,7 +162,7 @@ class PythonRecipeHandler(RecipeHandler): for release in reversed(data["releases"][version]): if release["packagetype"] == "sdist": fetch_uri = release["url"] - sdist = release["filename"].rsplit("-")[0] + sdist = release["filename"].rsplit("-", 1)[0] break else: logger.warning("Cannot handle pypi url %s: cannot fetch package information using %s", source, json_url) @@ -171,8 +171,10 @@ class PythonRecipeHandler(RecipeHandler): match = re.match(r'^https?://files.pythonhosted.org/packages.*/(.*)-.*$', source) if match: fetch_uri = source - pypi_package = match.group(1) - sdist, version = determine_from_url(fetch_uri) + # The sdist name as found in the filename, not normalised + sdist = match.group(1) + pypi_package = sdist + _, version = determine_from_url(fetch_uri) if match and not args.no_pypi: if required_version and version != required_version: From patchwork Thu Oct 22 18:36:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Anavi X-Patchwork-Id: 101690 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.6009.1792694181554311518 for ; Thu, 22 Oct 2026 11:36:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@konsulko.com header.s=google header.b=nuBS50Xd; spf=pass (domain: konsulko.com, ip: 209.85.128.46, mailfrom: leon.anavi@konsulko.com) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-49d05d51553so890945e9.2 for ; Thu, 22 Oct 2026 11:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1792694180; x=1793298980; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=806G2IsOAB9WAN/g8d5Fc7MdhGmu3sTMTzlTVXwS7P8=; b=nuBS50XdHAAeVyWHgaWMyI3qZKS0dGRNS73nmiTWxNyCBGL8aT3q7Dcz2CugjwHwCl mRYY8YbcFWbdDP/iD7N0I0tEwLMDBvaFkI+bCThmCLD1zBwVtZtIv58eyR4AeGmGsFNU v0fgmlblHiMNDTzjOliDxjQlK/Q9AzZ3RJ6E0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1792694180; x=1793298980; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=806G2IsOAB9WAN/g8d5Fc7MdhGmu3sTMTzlTVXwS7P8=; b=rxVFfJIkEnZV+u6q7nRFgMcgkHCg3OKl/SHUFLGWXHnI8y0+M2/+GkqAW/McZmoncS V1ohk5W1Rsj0WTaA6Q0+uibzxxrhx75j0bL8Ww0lVfzGL15NxxcYEOxCJ3FlRgEthmYI 69/vQOeJyeLnh7mdaNJ2ed7CB4rZZ59Ny3V1Yyqsl/DeDB66aC2WsuoShBtiu5RMZ69F XSPo3aiWfRqias9q7UXhgWT/E6pbv0hxt5IfHx/0zxnSGvjYPiwQ4ZDvx1FA+leVwcsM t45KftRAlh7Nucs8Pmj2OljTB+2SwdkHgH/C1NSPuqS3hWrJggG8RZCelZQJHyItg/tK +/9w== X-Gm-Message-State: AFq9FYL7k7Dnjw9eVhD9gECoB0gkbgQ/7cG/Cc3NeTXFHcK+afdrG3dg P1ZuNxV+6ST2tKP6zblup63N3xzaqzQl3JijEdihoXL4bwIXbgZ0MVK6vEx03vxBpIUCG3Pqn5r Seke8 X-Gm-Gg: AYBFou0K1F03xM52EMcQZP22M0OCCCv6TpUOB8ylXeXqJ52hav7SiE/8yv8EEiiheSX QdVT1i3msG0p88SnYveBHpBDNF4hgNKlQSn1V3ueafuS9b9gcekYvbcUSsUpC2wrxg4Q4T4zqaH MUNxV7cFIUnrC9Uow66wQoFompPulANkWQNtQxyhm8NVoHLBHxWu8Beeuj9Npw8O8ZZLALXMCIm hPnuRwu+5Ra1oW8IOAM1bmoaeWz9sgM0DRLnWWDQURdQbZvxAXp/iskzEXZghujwUAkFRAjcqw8 ujd3K+aPzHiuoec11vEeb0vUVHvsb0BO3uR2/QXk16Sp9bozAs4NSAUCL8twRsBjIo9efoC3PEL plfTCeAFM6XG0p41oD+ai797Mk7dD4d91oNFrqb2DutwGLhf6ZY8vO9DOsVW51rYPUJ/4n2OCeS OSLVhfMRg8n6lRUJOygQ32IQaxwFO1o7/4gscT8P2uzRV3S8tu20PWB6tnwIHXliMNl0NMt/zuM B7qE5Ke5qeIkgNUA9BP5JfrHSEOrgTuO0td0ruiPo5KNOctooM+pkOwKENCpu31qG77DJoSA9RT ICTyOzBYQUCjBTax2ZqjOapR/bKe8ZRLrHF6th4g0h1t64P0PfOLq/24+fNqJzm1E64riQwxHJ0 +Jxku X-Received: by 2002:a05:600c:3ba0:b0:4a1:7d9b:d4ae with SMTP id 5b1f17b1804b1-4a1fdb078ebmr149288105e9.5.1792694179717; Thu, 22 Oct 2026 11:36:19 -0700 (PDT) Return-Path: Received: from tone.k.g (lan.nucleusys.com. [92.247.61.126]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4a21047b524sm15303475e9.14.2026.10.22.11.36.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Oct 2026 11:36:19 -0700 (PDT) From: Leon Anavi To: openembedded-core@lists.openembedded.org Cc: Leon Anavi Subject: [PATCH 3/3] recipetool: Drop PYPI_PACKAGE if it matches BPN Date: Thu, 22 Oct 2026 21:36:08 +0300 Message-ID: <20261022183608.3500655-3-leon.anavi@konsulko.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261022183608.3500655-1-leon.anavi@konsulko.com> References: <20261022183608.3500655-1-leon.anavi@konsulko.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by lin-tor-korg-lkml-alma10-1 with HTTPS for ; Thu, 22 Oct 2026 18:36:26 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/248454 PYPI_PACKAGE was always added to recipes created for PyPI sources because the recipe name is not known yet when the source URL is processed. Since PYPI_PACKAGE is now the normalised package name and pypi.bbclass derives it from BPN by default, it is redundant in the common case. Once the recipe name has been determined, drop PYPI_PACKAGE if it matches the default value from pypi.bbclass. Before: devtool add python3-tibs https://pypi.org/project/tibs grep ^PYPI_PACKAGE python3-tibs_2.0.2.bb PYPI_PACKAGE = "tibs" After: devtool add python3-tibs https://pypi.org/project/tibs grep ^PYPI_PACKAGE python3-tibs_2.0.2.bb However, it still sets PYPI_PACKAGE and PYPI_PACKAGE_SDIST where needed, for example in a recipe for python-magic: devtool add python3-magic https://pypi.org/project/python-magic/ grep ^PYPI_PACKAGE python3-magic_0.4.27.bb PYPI_PACKAGE = "python-magic" PYPI_PACKAGE_SDIST = "python-magic" AI-Generated: Uses Claude Code Signed-off-by: Leon Anavi --- meta/lib/oeqa/selftest/cases/recipetool.py | 3 +++ scripts/lib/recipetool/create.py | 14 ++++++++++++++ scripts/lib/recipetool/create_buildsys_python.py | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index ca05e54593..54b7cb3a65 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -597,6 +597,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars['LICENSE'] = 'BSD-3-Clause' checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=702b1ef12cf66832a88f24c8f2ee9c19' checkvars['SRC_URI[sha256sum]'] = 'c225b674c83fa923be93d235330ce0300373d02885cef23238813b0d5668304a' + checkvars['PYPI_PACKAGE'] = None checkvars['PYPI_PACKAGE_SDIST'] = None inherits = ['python_setuptools_build_meta', 'pypi'] @@ -621,6 +622,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars['LICENSE'] = 'GPL-3.0-only' checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE;md5=1ebbd3e34237af26da5dc08a4e440464' checkvars['SRC_URI[sha256sum]'] = '81f7c0c5559becc8049470d86046b36e96113637bcbe4753ecef06977c00245d' + checkvars['PYPI_PACKAGE'] = None checkvars['PYPI_PACKAGE_SDIST'] = None inherits = ['python_setuptools_build_meta', 'pypi'] @@ -644,6 +646,7 @@ class RecipetoolCreateTests(RecipetoolBase): checkvars['LICENSE'] = 'BSD-2-Clause' checkvars['LIC_FILES_CHKSUM'] = 'file://LICENSE.txt;md5=b11cf936853a71258d4b57bb1849a3f9' checkvars['SRC_URI[sha256sum]'] = 'ab9c8f1080391e231812d20abf2657a69ee35574563b1014414f953964a95fa3' + checkvars['PYPI_PACKAGE'] = None checkvars['PYPI_PACKAGE_SDIST'] = None inherits = ['python_setuptools_build_meta', 'pypi'] diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index bf533a45cf..3baf19c7c2 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py @@ -795,6 +795,20 @@ def create_recipe(args): if name_pv and not realpv: realpv = name_pv + # PYPI_PACKAGE is not needed if it matches the default derived from BPN (see pypi.bbclass) + if pn and 'pypi' in classes and extravalues.get('PYPI_PACKAGE'): + bpn = pn + if bpn.endswith('-native'): + bpn = bpn[:-len('-native')] + if bpn.startswith('nativesdk-'): + bpn = bpn[len('nativesdk-'):] + for prefix in ('python-', 'python3-'): + if bpn.startswith(prefix): + bpn = bpn[len(prefix):] + break + if re.sub(r"[-_.]+", "-", bpn).lower() == extravalues['PYPI_PACKAGE']: + del extravalues['PYPI_PACKAGE'] + handle_license_vars(srctree_use, lines_before, handled, extravalues, tinfoil.config_data) if not outfile: diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py index 4fc96db7e8..d53a6205bf 100644 --- a/scripts/lib/recipetool/create_buildsys_python.py +++ b/scripts/lib/recipetool/create_buildsys_python.py @@ -180,7 +180,8 @@ class PythonRecipeHandler(RecipeHandler): if required_version and version != required_version: raise Exception("Version specified using --version/-V (%s) and version specified in the url (%s) do not match" % (required_version, version)) # PYPI_PACKAGE is optional if BPN looks like "python-" or "python3-" (see pypi.bbclass) - # but at this point we cannot know because because user can specify the output name of the recipe on the command line + # but at this point we cannot know because the user can specify the output name of the recipe on the command line, + # so it is set here and dropped later in create_recipe() once the recipe name is known pypi_package = self.pypi_normalise(pypi_package) extravalues["PYPI_PACKAGE"] = pypi_package # Some sdists don't use normalised names, so check and set PYPI_PACKAGE_SDIST if needed