Skip to content

Commit 1b2e458

Browse files
committed
update getMyPackageLicense to parse pyproject.toml configured according to setuptools standards
1 parent 232b674 commit 1b2e458

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)