[Buildroot] [PATCH 1/1] scanpypi: write every license file once

Arnout Vandecappelle arnout at mind.be
Fri Oct 11 21:12:53 UTC 2019



On 08/10/2019 11:04, Asaf Kahlon wrote:
> On some cases, when the package contains multiple license files
> and some of them from the same type, the scanpypi script will write
> the same license type more than once under _LICENSE.
> Hence, before creating the _LICENSE variable, we'll remove every
> possible duplication.
> 
> Signed-off-by: Asaf Kahlon <asafka7 at gmail.com>

 Applied to master, thanks.


> ---
>  utils/scanpypi | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/utils/scanpypi b/utils/scanpypi
> index 55b3d1e61c..b48eda49aa 100755
> --- a/utils/scanpypi
> +++ b/utils/scanpypi
> @@ -461,6 +461,7 @@ class BuildrootPackage():
>                        ' likely wrong, please change it if need be'.format(
>                            license=', '.join(licenses)))

 I notice now that there's something wrong here: this is under a condition that
licenses is empty, so this statement makes no sense...

>                  licenses = [self.metadata['info']['license']]
> +            licenses = set(licenses)
>              license_line = '{name}_LICENSE = {license}\n'.format(
>                  name=self.mk_name,
>                  license=', '.join(licenses))
> @@ -473,6 +474,7 @@ class BuildrootPackage():
>                      license_names.append(match.license.id)
>                  else:
>                      license_names.append("FIXME: license id couldn't be detected")
> +            license_names = set(license_names)
>  
>              if len(license_names) > 0:
>                  license_line = ('{name}_LICENSE ='

 We have exactly the same code here (including the line you added) in both
branches of the condition, so I smell a refactoring opportunity!

 Regards,
 Arnout




More information about the buildroot mailing list