Turn version and readme into function
This commit is contained in:
parent
1e56f70b93
commit
c9a946bc02
20
setup.py
20
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]
|
|
||||||
|
|
||||||
# PyPI doesn't like raw html
|
def get_version():
|
||||||
with open("README.rst", encoding="utf-8") as f:
|
with open("pyrogram/__init__.py", encoding="utf-8") as f:
|
||||||
readme = re.sub(r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n", "", f.read())
|
return re.findall(r"__version__ = \"(.+)\"", f.read())[0]
|
||||||
readme = re.sub(r"\|header\|", "|logo|\n\n|description|\n\n|scheme| |tgcrypto|", readme)
|
|
||||||
|
|
||||||
|
def get_readme():
|
||||||
|
# PyPI doesn't like raw html
|
||||||
|
with open("README.rst", encoding="utf-8") as f:
|
||||||
|
readme = re.sub(r"\.\. \|.+\| raw:: html(?:\s{4}.+)+\n\n", "", f.read())
|
||||||
|
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