Skip to content

Commit

Permalink
improved handling multiple licenses for PyPI packages
Browse files Browse the repository at this point in the history
Signed-off-by: Jacek Puchta <[email protected]>
  • Loading branch information
puchta committed Oct 25, 2023
1 parent 7f9ca48 commit e81c6c8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2443,13 +2443,14 @@ export const getPyMetadata = async function (pkgList, fetchDepsInfo) {
p.author = body.info.author_email.trim();
}
p.description = body.info.summary;
p.license = findLicenseId(body.info.license);
if (!p.license && body.info.classifiers) {
p.license = [];
if (body.info.license) p.license.push(findLicenseId(body.info.license));
if (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;
let licenseName = c.split(" :: ")[c.split(" :: ").length - 1];
let licenseId = findLicenseId(licenseName);
if (!p.license.includes(licenseId)) p.license.push(licenseId);
}
}
}
Expand Down

0 comments on commit e81c6c8

Please sign in to comment.