Skip to content

Commit 0a836a3

Browse files
committed
Fix dynamic readme
1 parent ba7dc9e commit 0a836a3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

setuptools/config/pyprojecttoml.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,17 @@ def _obtain_version(self, dist: "Distribution", package_dir: Mapping[str, str]):
316316
return None
317317

318318
def _obtain_readme(self, dist: "Distribution") -> Optional[Dict[str, str]]:
319-
if "readme" in self.dynamic:
320-
dynamic_cfg = self.dynamic_cfg
319+
if "readme" not in self.dynamic:
320+
return None
321+
322+
dynamic_cfg = self.dynamic_cfg
323+
if "readme" in dynamic_cfg:
321324
return {
322325
"text": self._obtain(dist, "readme", {}),
323326
"content-type": dynamic_cfg["readme"].get("content-type", "text/x-rst"),
324327
}
328+
329+
self._ensure_previously_set(dist, "readme")
325330
return None
326331

327332
def _obtain_entry_points(

0 commit comments

Comments
 (0)