Fix another FileNotFoundError in license check

This commit is contained in:
Raphael Michel
2021-04-26 13:07:09 +02:00
parent 2cd67d6036
commit 8921ccb8c1

View File

@@ -172,13 +172,17 @@ class LicenseCheckView(StaffMemberRequiredMixin, FormView):
pkg = pkgs[0] pkg = pkgs[0]
except: except:
return None, None return None, None
for line in pkg.get_metadata_lines('PKG-INFO'): try:
if ': ' in line: for line in pkg.get_metadata_lines('PKG-INFO'):
(k, v) = line.split(': ', 1) if ': ' in line:
if k == "License": (k, v) = line.split(': ', 1)
license = v if k == "License":
if k == "Home-page": license = v
url = v if k == "Home-page":
url = v
except FileNotFoundError:
license = '?'
url = '?'
return license, url return license, url
def _check_results(self, input): def _check_results(self, input):