1212
1313import logging
1414import os
15- from collections .abc import Mapping
1615from email .headerregistry import Address
1716from functools import partial , reduce
1817from inspect import cleandoc
2221 TYPE_CHECKING ,
2322 Any ,
2423 Callable ,
24+ Dict ,
25+ Mapping ,
2526 Union ,
26- cast ,
2727)
2828from .._path import StrPath
2929from ..errors import RemovedConfigError
3535 from setuptools .dist import Distribution # noqa
3636
3737EMPTY : Mapping = MappingProxyType ({}) # Immutable dict-like
38- _DictOrStr = Union [dict , str ]
38+ _ProjectReadmeValue = Union [str , Dict [ str , str ] ]
3939_CorrespFn = Callable [["Distribution" , Any , StrPath ], None ]
4040_Correspondence = Union [str , _CorrespFn ]
4141
@@ -149,15 +149,16 @@ def _guess_content_type(file: str) -> str | None:
149149 raise ValueError (f"Undefined content type for { file } , { msg } " )
150150
151151
152- def _long_description (dist : Distribution , val : _DictOrStr , root_dir : StrPath ):
152+ def _long_description (dist : Distribution , val : _ProjectReadmeValue , root_dir : StrPath ):
153153 from setuptools .config import expand
154154
155+ file : str | tuple [()]
155156 if isinstance (val , str ):
156- file : str | list = val
157+ file = val
157158 text = expand .read_files (file , root_dir )
158- ctype = _guess_content_type (val )
159+ ctype = _guess_content_type (file )
159160 else :
160- file = val .get ("file" ) or []
161+ file = val .get ("file" ) or ()
161162 text = val .get ("text" ) or expand .read_files (file , root_dir )
162163 ctype = val ["content-type" ]
163164
@@ -167,7 +168,7 @@ def _long_description(dist: Distribution, val: _DictOrStr, root_dir: StrPath):
167168 _set_config (dist , "long_description_content_type" , ctype )
168169
169170 if file :
170- dist ._referenced_files .add (cast ( str , file ) )
171+ dist ._referenced_files .add (file )
171172
172173
173174def _license (dist : Distribution , val : dict , root_dir : StrPath ):
0 commit comments