mirror of
https://github.com/pretix/pretix.git
synced 2026-04-29 00:12:38 +00:00
License check: improve license detection for DistInfoDistribution packages. (#2054)
This commit is contained in:
@@ -168,12 +168,11 @@ class LicenseCheckView(StaffMemberRequiredMixin, FormView):
|
||||
def _get_license_for_pkg(self, pkg):
|
||||
license, url = None, None
|
||||
try:
|
||||
pkgs = pkg_resources.require(pkg)
|
||||
pkg = pkgs[0]
|
||||
pkg = pkg_resources.get_distribution(pkg)
|
||||
except:
|
||||
return None, None
|
||||
try:
|
||||
for line in pkg.get_metadata_lines('PKG-INFO'):
|
||||
for line in pkg.get_metadata_lines(pkg.PKG_INFO):
|
||||
if ': ' in line:
|
||||
(k, v) = line.split(': ', 1)
|
||||
if k == "License":
|
||||
|
||||
Reference in New Issue
Block a user