diff --git a/bincrafters_conventions/actions/check_for_spdx_license.py b/bincrafters_conventions/actions/check_for_spdx_license.py deleted file mode 100644 index e54cc41..0000000 --- a/bincrafters_conventions/actions/check_for_spdx_license.py +++ /dev/null @@ -1,34 +0,0 @@ -import spdx_lookup -from conans.client import conan_api -from conans.errors import ConanException - - -def check_license(main, recipe_license): - if spdx_lookup.by_id(recipe_license): - main.output_result_check(passed=True, title="SPDX License identifier") - return True - else: - main.output_result_check(passed=False, title="SPDX License identifier", - reason="{} doesn't seem to be a valid SPDX one. " - "Have a look at https://spdx.org/licenses/".format(recipe_license)) - return False - - -def check_for_spdx_license(main, file): - conan_instance, _, _ = conan_api.Conan.factory() - try: - recipe_license = conan_instance.inspect(path=file, attributes=['license'])['license'] - if isinstance(recipe_license, str): - recipe_licenses = [recipe_license] - elif isinstance(recipe_license, tuple): - recipe_licenses = recipe_license - else: - main.output_result_check(passed=False, title="SPDX License identifier", - reason="license attribute is neither tuple nor string") - return False - - return all([check_license(main, recipe_license) for recipe_license in recipe_licenses]) - except ConanException: - main.output_result_check(passed=False, title="SPDX License identifier", - reason="could not get the license attribute from the Conanfile") - return False diff --git a/bincrafters_conventions/bincrafters_conventions.py b/bincrafters_conventions/bincrafters_conventions.py index 67a6512..c1aed2a 100644 --- a/bincrafters_conventions/bincrafters_conventions.py +++ b/bincrafters_conventions/bincrafters_conventions.py @@ -9,7 +9,6 @@ import requests import contextlib import re -from .actions.check_for_spdx_license import check_for_spdx_license from .actions.check_for_download_hash import check_for_download_hash from .actions.check_for_license import check_for_license from .actions.check_for_deprecated_generators import check_for_deprecated_generators @@ -375,7 +374,6 @@ def _run_conventions_checks(self, conanfile="conanfile.py"): return (check_for_license(self), check_for_required_attributes(self, conanfile), - check_for_spdx_license(self, conanfile), check_for_download_hash(self, conanfile), check_for_deprecated_generators(self, conanfile), check_for_deprecated_methods(self, conanfile), diff --git a/bincrafters_conventions/requirements.txt b/bincrafters_conventions/requirements.txt index 9d4e9c3..92c9c00 100644 --- a/bincrafters_conventions/requirements.txt +++ b/bincrafters_conventions/requirements.txt @@ -1,5 +1,4 @@ requests>=2.22.0 GitPython>=3.0.4 conan>=1.18.0 -spdx-lookup>=0.3.2 PyNaCl~=1.3.0