How to use the pyroma.classifiers.CODE_LICENSES function in pyroma

To help you get started, we’ve selected a few pyroma examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github regebro / pyroma / pyroma / ratings.py View on Github external
classifiers = data.get("classifiers", [])
        licenses = set()
        for classifier in classifiers:
            parts = [p.strip() for p in classifier.split("::")]
            if parts[0] == "License":
                # license classifier exist
                licenses.add(classifier)

        if not license and not licenses:
            self._message = (
                "Your package does neither have a license field "
                "nor any license classifiers."
            )
            return False

        if license in CODE_LICENSES:
            if not CODE_LICENSES[license].intersection(licenses):
                self._message = (
                    "The license '%s' specified is not listed in "
                    "your classifiers." % license
                )
                return False

        return True