[Buildroot] [PATCH 1/1] utils/scanpypi: workaround for pypi project names

Flaviu Nistor
2026-03-27T06:44:47Z

Add a dictionary for buildroot packages that have a different
name compared to the pypi project name (e.g. smmap2 -> smmap).
Since it is not intended to change the buildroot package name,
this is a workaround in order to use the scanpypi utility for
this packages and still get correct generated files. Current
packages added in the dictionary by this commit are smmap2 and
gitdb2.

Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com>
---
utils/scanpypi | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/utils/scanpypi b/utils/scanpypi
index 61879e39d4..09899bfe0e 100755
--- a/utils/scanpypi
+++ b/utils/scanpypi
@@ -189,6 +189,14 @@ class BuildrootPackage():
create_config_in

"""
+
+ # Dictionary of python package names to their actual PyPI project names
+ # Used when a package's buildroot name differs from its PyPI name
+ PYPI_NAME_MAPPINGS = {
+ 'smmap2': 'smmap',
+ 'gitdb2': 'gitdb',
+ }
+
setup_args = {}

def __init__(self, real_name, pkg_folder):
@@ -216,8 +224,12 @@ class BuildrootPackage():
"""
Fetch a package's metadata from the python package index
"""
+
+ # Check if there's a PyPI name in the dictionary for this package
+ pypi_name = self.PYPI_NAME_MAPPINGS.get(self.real_name, self.real_name)
+
self.metadata_url = 'https://pypi.org/pypi/{pkg}/json'.format(
- pkg=self.real_name)
+ pkg=pypi_name)
try:
pkg_json = urllib.request.urlopen(self.metadata_url).read().decode()
except urllib.error.HTTPError as error:
@@ -225,13 +237,13 @@ class BuildrootPackage():
print('ERROR: Could not find package {pkg}.\n'
'Check syntax inside the python package index:\n'
'https://pypi.python.org/pypi/ '
- .format(pkg=self.real_name))
+ .format(pkg=pypi_name))
raise
except urllib.error.URLError:
print('ERROR: Could not find package {pkg}.\n'
'Check syntax inside the python package index:\n'
'https://pypi.python.org/pypi/ '
- .format(pkg=self.real_name))
+ .format(pkg=pypi_name))
raise
self.metadata = json.loads(pkg_json)
self.version = self.metadata['info']['version']
--
2.34.1