scanpypi: write every license file once
authorAsaf Kahlon <asafka7@gmail.com>
Tue, 8 Oct 2019 09:04:04 +0000 (12:04 +0300)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Fri, 11 Oct 2019 21:04:40 +0000 (23:04 +0200)
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@gmail.com>
Reviewed-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
utils/scanpypi

index 55b3d1e61c1a27afc2abbebc79336b72b0e8f65a..b48eda49aa210d179d49f69cf8c4ece6b45afd9c 100755 (executable)
@@ -461,6 +461,7 @@ class BuildrootPackage():
                       ' likely wrong, please change it if need be'.format(
                           license=', '.join(licenses)))
                 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 ='