Skip to content

Commit 3c18388

Browse files
Merge pull request #25 from NicolaDonelli/wip-issue-23
update getMyPackageLicense to parse pyproject.toml configured according to setuptools standards
2 parents 232b674 + 1b2e458 commit 3c18388

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

licensecheck/packageinfo.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ def getClassifiersLicense() -> dict[str, Any]:
143143
return tool["poetry"]
144144
if "flit" in tool:
145145
return tool["flit"]["metadata"]
146+
if pyproject.get("project") is not None:
147+
return pyproject["project"]
148+
146149
return {"classifiers": [], "license": ""}
147150

148151

@@ -158,7 +161,10 @@ def getMyPackageLicense() -> str:
158161
if licenseClassifier != UNKNOWN:
159162
return licenseClassifier
160163
if "license" in metaData:
161-
return str(metaData["license"])
164+
if isinstance(metaData["license"], dict) and metaData["license"].get("text") is not None:
165+
return str(metaData["license"].get("text"))
166+
else:
167+
return str(metaData["license"])
162168
return input("Enter the project license")
163169

164170

0 commit comments

Comments
 (0)