Skip to content

Commit

Permalink
Deducing license information for PyPI packages from classifiers (if n…
Browse files Browse the repository at this point in the history
…ot stated explicite)

Signed-off-by: Jacek Puchta <[email protected]>
  • Loading branch information
puchta committed Oct 25, 2023
1 parent fe324c5 commit 7f9ca48
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit 7f9ca48

Please sign in to comment.