From 7f9ca489a367a14b77b0a692e2a4b744584ea864 Mon Sep 17 00:00:00 2001 From: Jacek Puchta Date: Wed, 25 Oct 2023 11:16:42 +0200 Subject: [PATCH] Deducing license information for PyPI packages from classifiers (if not stated explicite) Signed-off-by: Jacek Puchta --- utils.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utils.js b/utils.js index 6a37ee112..74b32cf5e 100644 --- a/utils.js +++ b/utils.js @@ -2444,6 +2444,15 @@ export const getPyMetadata = async function (pkgList, fetchDepsInfo) { } p.description = body.info.summary; p.license = findLicenseId(body.info.license); + if (!p.license && body.info.classifiers) { + for (const c of body.info.classifiers) { + if (c.startsWith("License :: ")) { + let licenseText = c.split(" :: ")[c.split(" :: ").length - 1]; + p.license = findLicenseId(licenseText); + break; + } + } + } if (body.info.home_page) { if (body.info.home_page.includes("git")) { p.repository = { url: body.info.home_page };