From b1848bab2bfa8df13080a6e8a37cd092bc117142 Mon Sep 17 00:00:00 2001 From: Marcelo Duarte Trevisani Date: Tue, 19 Sep 2023 09:05:57 -0300 Subject: [PATCH] add name extraction from pyproject.toml for github repos (#472) * add name extraction from pyproject.toml for github repos * Apply suggestions from code review Co-authored-by: Marcelo Duarte Trevisani --------- Co-authored-by: Scott Staniewicz Co-authored-by: Scott Staniewicz --- grayskull/strategy/py_base.py | 2 ++ grayskull/strategy/py_toml.py | 1 + 2 files changed, 3 insertions(+) diff --git a/grayskull/strategy/py_base.py b/grayskull/strategy/py_base.py index 224578965..fc04cfc92 100644 --- a/grayskull/strategy/py_base.py +++ b/grayskull/strategy/py_base.py @@ -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"]: @@ -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) diff --git a/grayskull/strategy/py_toml.py b/grayskull/strategy/py_toml.py index a27deb6d0..d4ff4acab 100644 --- a/grayskull/strategy/py_toml.py +++ b/grayskull/strategy/py_toml.py @@ -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)