@@ -37,13 +37,17 @@ def read(file: str) -> list:
3737 docs_compiler .start ()
3838 error_compiler .start ()
3939
40- with open ("pyrogram/__init__.py" , encoding = "utf-8" ) as f :
41- version = re .findall (r"__version__ = \"(.+)\"" , f .read ())[0 ]
4240
43- # PyPI doesn't like raw html
44- with open ("README.rst" , encoding = "utf-8" ) as f :
45- readme = re .sub (r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n" , "" , f .read ())
46- readme = re .sub (r"\|header\|" , "|logo|\n \n |description|\n \n |scheme| |tgcrypto|" , readme )
41+ def get_version ():
42+ with open ("pyrogram/__init__.py" , encoding = "utf-8" ) as f :
43+ return re .findall (r"__version__ = \"(.+)\"" , f .read ())[0 ]
44+
45+
46+ def get_readme ():
47+ # PyPI doesn't like raw html
48+ with open ("README.rst" , encoding = "utf-8" ) as f :
49+ readme = re .sub (r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n" , "" , f .read ())
50+ return re .sub (r"\|header\|" , "|logo|\n \n |description|\n \n |scheme| |tgcrypto|" , readme )
4751
4852
4953class Clean (Command ):
@@ -73,9 +77,9 @@ def run(self):
7377
7478setup (
7579 name = "Pyrogram" ,
76- version = version ,
80+ version = get_version () ,
7781 description = "Telegram MTProto API Client Library for Python" ,
78- long_description = readme ,
82+ long_description = get_readme () ,
7983 url = "https://github.com/pyrogram" ,
8084 download_url = "https://github.com/pyrogram/pyrogram/releases/latest" ,
8185 author = "Dan Tès" ,
0 commit comments