From 0a836a3c2c8cb2f3a7b418f2c476b4b499cabdd1 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 4 Apr 2022 01:25:20 +0100 Subject: Fix dynamic readme --- setuptools/config/pyprojecttoml.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setuptools/config/pyprojecttoml.py b/setuptools/config/pyprojecttoml.py index d4024956..be812142 100644 --- a/setuptools/config/pyprojecttoml.py +++ b/setuptools/config/pyprojecttoml.py @@ -316,12 +316,17 @@ class _ConfigExpander: return None def _obtain_readme(self, dist: "Distribution") -> Optional[Dict[str, str]]: - if "readme" in self.dynamic: - dynamic_cfg = self.dynamic_cfg + if "readme" not in self.dynamic: + return None + + dynamic_cfg = self.dynamic_cfg + if "readme" in dynamic_cfg: return { "text": self._obtain(dist, "readme", {}), "content-type": dynamic_cfg["readme"].get("content-type", "text/x-rst"), } + + self._ensure_previously_set(dist, "readme") return None def _obtain_entry_points( -- cgit v1.2.1