forked from CGM_Public/pretix_original
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):
|
def _get_license_for_pkg(self, pkg):
|
||||||
license, url = None, None
|
license, url = None, None
|
||||||
try:
|
try:
|
||||||
pkgs = pkg_resources.require(pkg)
|
pkg = pkg_resources.get_distribution(pkg)
|
||||||
pkg = pkgs[0]
|
|
||||||
except:
|
except:
|
||||||
return None, None
|
return None, None
|
||||||
try:
|
try:
|
||||||
for line in pkg.get_metadata_lines('PKG-INFO'):
|
for line in pkg.get_metadata_lines(pkg.PKG_INFO):
|
||||||
if ': ' in line:
|
if ': ' in line:
|
||||||
(k, v) = line.split(': ', 1)
|
(k, v) = line.split(': ', 1)
|
||||||
if k == "License":
|
if k == "License":
|
||||||
|
|||||||
Reference in New Issue
Block a user