Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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