Skip to content

Commit

Permalink
add name extraction from pyproject.toml for github repos (#472)
Browse files Browse the repository at this point in the history
* add name extraction from pyproject.toml for github repos

* Apply suggestions from code review

Co-authored-by: Marcelo Duarte Trevisani <[email protected]>

---------

Co-authored-by: Scott Staniewicz <[email protected]>
Co-authored-by: Scott Staniewicz <[email protected]>
  • Loading branch information
3 people authored Sep 19, 2023
1 parent 30f052d commit b1848ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions grayskull/strategy/py_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ def merge_setup_toml_metadata(setup_metadata: dict, pyproject_metadata: dict) ->
setup_metadata = defaultdict(dict, setup_metadata)
if not pyproject_metadata:
return setup_metadata
setup_metadata["name"] = setup_metadata.get("name") or pyproject_metadata["name"]
if pyproject_metadata["about"]["license"]:
setup_metadata["license"] = pyproject_metadata["about"]["license"]
if pyproject_metadata["about"]["summary"]:
Expand Down Expand Up @@ -792,6 +793,7 @@ def get_sdist_metadata(
dist = UnpackedSDist(path_pkg_info[0].parent)
for key in ("name", "version", "summary", "author"):
metadata[key] = getattr(dist, key, None)

return merge_setup_toml_metadata(metadata, pyproject_metadata)


Expand Down
1 change: 1 addition & 0 deletions grayskull/strategy/py_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def get_all_toml_info(path_toml: Union[Path, str]) -> dict:
metadata["about"]["dev_url"] = all_urls.get("Source", None)
metadata["about"]["home"] = all_urls.get("Homepage", None)
metadata["about"]["summary"] = toml_project.get("description")
metadata["name"] = metadata.get("name") or toml_project.get("name")

add_poetry_metadata(metadata, toml_metadata)

Expand Down

0 comments on commit b1848ba

Please sign in to comment.