Update setup.py

This commit is contained in:
Dan 2019-05-13 17:17:20 +02:00
parent 90115448ac
commit 9a2602ff2a

View File

@ -27,22 +27,14 @@ from compiler.api import compiler as api_compiler
from compiler.docs import compiler as docs_compiler from compiler.docs import compiler as docs_compiler
from compiler.error import compiler as error_compiler from compiler.error import compiler as error_compiler
with open("requirements.txt", encoding="utf-8") as r:
requires = [i.strip() for i in r]
def read(file: str) -> list: with open("pyrogram/__init__.py", encoding="utf-8") as f:
with open(file, encoding="utf-8") as r: version = re.findall(r"__version__ = \"(.+)\"", f.read())[0]
return [i.strip() for i in r]
with open("README.md", encoding="utf-8") as f:
def get_version(): readme = f.read()
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
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|schema| |tgcrypto|", readme)
class Clean(Command): class Clean(Command):
@ -128,23 +120,24 @@ class Generate(Command):
if len(argv) > 1 and argv[1] in ["bdist_wheel", "install", "develop"]: if len(argv) > 1 and argv[1] in ["bdist_wheel", "install", "develop"]:
error_compiler.start()
api_compiler.start() api_compiler.start()
docs_compiler.start() error_compiler.start()
setup( setup(
name="Pyrogram", name="Pyrogram",
version=get_version(), version=version,
description="Telegram MTProto API Client Library for Python", description="Telegram MTProto API Client Library for Python",
long_description=get_readme(), long_description=readme,
long_description_content_type="text/markdown",
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",
author_email="admin@pyrogram.ml", author_email="admin@pyrogram.ml",
license="LGPLv3+", license="LGPLv3+",
classifiers=[ classifiers=[
"Development Status :: 3 - Alpha", "Development Status :: 4 - Beta",
"Intended Audience :: Developers", "Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Operating System :: OS Independent", "Operating System :: OS Independent",
"Programming Language :: Python", "Programming Language :: Python",
@ -152,6 +145,8 @@ setup(
"Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation", "Programming Language :: Python :: Implementation",
"Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: PyPy",
@ -175,10 +170,9 @@ setup(
"pyrogram.client.ext": ["mime.types"] "pyrogram.client.ext": ["mime.types"]
}, },
zip_safe=False, zip_safe=False,
install_requires=read("requirements.txt"), install_requires=requires,
extras_require={ extras_require={
"tgcrypto": ["tgcrypto==1.1.1"], # TODO: Remove soon "fast": ["tgcrypto==1.1.1"]
"fast": ["tgcrypto==1.1.1"],
}, },
cmdclass={ cmdclass={
"clean": Clean, "clean": Clean,