summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2023-01-19 12:02:42 +0000
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2023-01-19 12:02:42 +0000
commit7285f004a410343a24903b4a73a7a57164bcba50 (patch)
tree9af455cca8632ecccaee6ca0491af72c340d00d6 /setuptools
parent902385f5fc5774a71914c52e8edab782c354b71d (diff)
downloadpython-setuptools-git-7285f004a410343a24903b4a73a7a57164bcba50.tar.gz
Ensure file referenced by 'readme' in pyproject.toml is added to sdist
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/config/_apply_pyprojecttoml.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/setuptools/config/_apply_pyprojecttoml.py b/setuptools/config/_apply_pyprojecttoml.py
index 8af55616..22388e4f 100644
--- a/setuptools/config/_apply_pyprojecttoml.py
+++ b/setuptools/config/_apply_pyprojecttoml.py
@@ -16,7 +16,7 @@ from functools import partial, reduce
from itertools import chain
from types import MappingProxyType
from typing import (TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple,
- Type, Union)
+ Type, Union, cast)
from setuptools._deprecation_warning import SetuptoolsDeprecationWarning
@@ -142,16 +142,22 @@ def _long_description(dist: "Distribution", val: _DictOrStr, root_dir: _Path):
from setuptools.config import expand
if isinstance(val, str):
- text = expand.read_files(val, root_dir)
+ file: Union[str, list] = val
+ text = expand.read_files(file, root_dir)
ctype = _guess_content_type(val)
else:
- text = val.get("text") or expand.read_files(val.get("file", []), root_dir)
+ file = val.get("file") or []
+ text = val.get("text") or expand.read_files(file, root_dir)
ctype = val["content-type"]
_set_config(dist, "long_description", text)
+
if ctype:
_set_config(dist, "long_description_content_type", ctype)
+ if file:
+ dist._referenced_files.add(cast(str, file))
+
def _license(dist: "Distribution", val: dict, root_dir: _Path):
from setuptools.config import expand