Turn version and readme into function
This commit is contained in:
parent
1e56f70b93
commit
c9a946bc02
14
setup.py
14
setup.py
@ -37,13 +37,17 @@ if len(argv) > 1 and argv[1] != "sdist":
|
|||||||
docs_compiler.start()
|
docs_compiler.start()
|
||||||
error_compiler.start()
|
error_compiler.start()
|
||||||
|
|
||||||
with open("pyrogram/__init__.py", encoding="utf-8") as f:
|
|
||||||
version = re.findall(r"__version__ = \"(.+)\"", f.read())[0]
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
with open("pyrogram/__init__.py", encoding="utf-8") as f:
|
||||||
|
return re.findall(r"__version__ = \"(.+)\"", f.read())[0]
|
||||||
|
|
||||||
|
|
||||||
|
def get_readme():
|
||||||
# PyPI doesn't like raw html
|
# PyPI doesn't like raw html
|
||||||
with open("README.rst", encoding="utf-8") as f:
|
with open("README.rst", encoding="utf-8") as f:
|
||||||
readme = re.sub(r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n", "", f.read())
|
readme = re.sub(r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n", "", f.read())
|
||||||
readme = re.sub(r"\|header\|", "|logo|\n\n|description|\n\n|scheme| |tgcrypto|", readme)
|
return re.sub(r"\|header\|", "|logo|\n\n|description|\n\n|scheme| |tgcrypto|", readme)
|
||||||
|
|
||||||
|
|
||||||
class Clean(Command):
|
class Clean(Command):
|
||||||
@ -73,9 +77,9 @@ class Clean(Command):
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="Pyrogram",
|
name="Pyrogram",
|
||||||
version=version,
|
version=get_version(),
|
||||||
description="Telegram MTProto API Client Library for Python",
|
description="Telegram MTProto API Client Library for Python",
|
||||||
long_description=readme,
|
long_description=get_readme(),
|
||||||
url="https://github.com/pyrogram",
|
url="https://github.com/pyrogram",
|
||||||
download_url="https://github.com/pyrogram/pyrogram/releases/latest",
|
download_url="https://github.com/pyrogram/pyrogram/releases/latest",
|
||||||
author="Dan Tès",
|
author="Dan Tès",
|
||||||
|
Loading…
Reference in New Issue
Block a user