File tree 1 file changed +4
-7
lines changed 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 1
1
import argparse
2
- import email
3
2
from readme_renderer .markdown import render as render_md
4
3
from readme_renderer .rst import render as render_rst
5
4
from readme_renderer .txt import render as render_txt
6
5
import pathlib
7
- from pkg_resources import get_distribution
6
+ from importlib . metadata import metadata
8
7
import sys
9
8
from typing import Optional , List
10
9
@@ -24,14 +23,12 @@ def main(cli_args: Optional[List[str]] = None) -> None:
24
23
25
24
content_format = args .format
26
25
if args .package :
27
- distribution = get_distribution (args .input )
28
- pkg_info = distribution .get_metadata (distribution .PKG_INFO )
29
- message = email .message_from_string (pkg_info )
30
- source = message .get_payload ()
26
+ message = metadata (args .input )
27
+ source = message .get_payload () # type: ignore[attr-defined] # noqa: E501 https://peps.python.org/pep-0566/
31
28
32
29
# Infer the format of the description from package metadata.
33
30
if not content_format :
34
- content_type = message .get ("Description-Content-Type" , "text/x-rst" )
31
+ content_type = message .get ("Description-Content-Type" , "text/x-rst" ) # type: ignore[attr-defined] # noqa: E501 https://github.com/python/typeshed/issues/10021
35
32
if content_type == "text/x-rst" :
36
33
content_format = "rst"
37
34
elif content_type == "text/markdown" :
You can’t perform that action at this time.
0 commit comments