public inbox for buildroot@busybox.net
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/1] utils/scanpypi: workaround for pypi project names
@ 2026-03-27  6:43 Flaviu Nistor
  2026-03-27  6:43 ` [Buildroot] [PATCH 1/1] " Flaviu Nistor
  0 siblings, 1 reply; 4+ messages in thread
From: Flaviu Nistor @ 2026-03-27  6:43 UTC (permalink / raw)
  To: buildroot; +Cc: Flaviu Nistor

I want to purpose this patch and hope others find it useful.
While using scanpypi I noticed that for smmap2 package the modified .mk
.hash files where not correct, since smmap2 pypi project is just a
mirror of smmap and has different revision and hashes. I realized why the
problem exist only by reading the commit history of smmap2 and saw Thomas
Petazzoni's remark in commit: 8bc8f4c4161ddfd255615ce0962b570da20c4148.
The same is valid for gitdb2 package. To avoid this issue in the future
for this packages and others (as I'm sure there are similar cases),
I added a dictionary for buildroot packages that have a different
name compared to the pypi project name (e.g. smmap2 -> smmap).
Since there is no intention 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. 
Other packages can be added in the dictionary as needed.

Flaviu Nistor (1):
  utils/scanpypi: workaround for pypi project names

 utils/scanpypi | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH 1/1] utils/scanpypi: workaround for pypi project names
  2026-03-27  6:43 [Buildroot] [PATCH 0/1] utils/scanpypi: workaround for pypi project names Flaviu Nistor
@ 2026-03-27  6:43 ` Flaviu Nistor
  2026-04-07 18:59   ` Arnout Vandecappelle via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Flaviu Nistor @ 2026-03-27  6:43 UTC (permalink / raw)
  To: buildroot; +Cc: Flaviu Nistor

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

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] utils/scanpypi: workaround for pypi project names
  2026-03-27  6:43 ` [Buildroot] [PATCH 1/1] " Flaviu Nistor
@ 2026-04-07 18:59   ` Arnout Vandecappelle via buildroot
  2026-04-09 15:21     ` Flaviu Nistor
  0 siblings, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2026-04-07 18:59 UTC (permalink / raw)
  To: Flaviu Nistor, buildroot



On 27/03/2026 07:43, Flaviu Nistor wrote:
> 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.

  Would it be an option, instead of having this mapping table, to parse the name 
out of the .mk file if it exists? So if you do scanpypi smmap2, it will check if 
package/python-smmap2/python-smmap2.mk exists, and if yes read the _SOURCE to 
find the upstream name.

  Regards,
  Arnout

> 
> 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']

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] utils/scanpypi: workaround for pypi project names
  2026-04-07 18:59   ` Arnout Vandecappelle via buildroot
@ 2026-04-09 15:21     ` Flaviu Nistor
  0 siblings, 0 replies; 4+ messages in thread
From: Flaviu Nistor @ 2026-04-09 15:21 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: buildroot, Flaviu Nistor

On 07/04/2026 11:59, Arnout Vandecappelle wrote:
>On 27/03/2026 07:43, Flaviu Nistor wrote:
>> 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.
>
>  Would it be an option, instead of having this mapping table, to parse the name 
>out of the .mk file if it exists? So if you do scanpypi smmap2, it will check if 
>package/python-smmap2/python-smmap2.mk exists, and if yes read the _SOURCE to 
>find the upstream name.
>
  Indeed that would be a better solution and less subjected to human error. I will
prepare a new version based on your suggestion and come back with a v2.

  Thank you,
  Flaviu

>  Regards,
>  Arnout
>
>> 
>> 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']
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-09 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27  6:43 [Buildroot] [PATCH 0/1] utils/scanpypi: workaround for pypi project names Flaviu Nistor
2026-03-27  6:43 ` [Buildroot] [PATCH 1/1] " Flaviu Nistor
2026-04-07 18:59   ` Arnout Vandecappelle via buildroot
2026-04-09 15:21     ` Flaviu Nistor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox