From 8970d3b9604483b719b1e3f0c705e10ed5f1bbd6 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 18 Nov 2020 20:27:03 +0100 Subject: [PATCH] Change the test for the license key: expect a license ID listed on spxd. I really doubt we need to cover the case of "the license is free but not listed on spdx" ... Spdx's list is quite exhaustive... --- package_linter.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/package_linter.py b/package_linter.py index 1d7b21b..8333c9c 100755 --- a/package_linter.py +++ b/package_linter.py @@ -880,36 +880,22 @@ class Manifest(TestSuite): @test() def license(self): - if not "license" in self.manifest: + if "license" not in self.manifest: return - def license_mentionned_in_readme(): - readme_path = os.path.join(self.path, 'README.md') - if os.path.isfile(readme_path): - return "LICENSE" in open(readme_path).read() - return False - license = self.manifest["license"] - if "nonfree" in license.replace("-", ""): yield Warning("'non-free' apps cannot be integrated in YunoHost's app catalog.") - + return code_license = '' + license + '' - if license == "free" and not license_mentionned_in_readme(): + if code_license not in spdx_licenses(): yield Warning( - "Setting the license as 'free' implies to write something about it in " - "the README.md. Alternatively, consider using one of the codes available " - "on https://spdx.org/licenses/" - ) - elif code_license not in spdx_licenses(): - yield Warning( - "The license id '%s' is not registered in https://spdx.org/licenses/. " - "It can be a typo error. If not, you should replace it by 'free' " - "or 'non-free' and give some explanations in the README.md." % (license) + "The license id '%s' is not registered in https://spdx.org/licenses/." % license ) + return @test() def description(self):