Skip to content

Commit

Permalink
add support for PEP 621: use project part of pyproject schema from ht…
Browse files Browse the repository at this point in the history
…tps://json.schemastore.org/pyproject.json and support strings in the license field (#708)
  • Loading branch information
radoering committed Sep 2, 2024
1 parent 886592f commit b57e32c
Show file tree
Hide file tree
Showing 6 changed files with 303 additions and 138 deletions.
11 changes: 8 additions & 3 deletions src/poetry/core/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,14 @@ def _configure_package_metadata(
"description", ""
)
if project_license := project.get("license"):
raw_license = project_license.get("text", "")
if not raw_license and (license_file := project_license.get("file", "")):
raw_license = (root / license_file).read_text(encoding="utf-8")
if isinstance(project_license, str):
raw_license = project_license
else:
raw_license = project_license.get("text", "")
if not raw_license and (
license_file := project_license.get("file", "")
):
raw_license = (root / license_file).read_text(encoding="utf-8")
else:
raw_license = tool_poetry.get("license", "")
try:
Expand Down
Loading

0 comments on commit b57e32c

Please sign in to comment.