2017-06-21 20:18:22 +03:00
|
|
|
#!/usr/bin/env python3
|
2016-09-18 12:59:12 +03:00
|
|
|
"""A setuptools based setup module.
|
|
|
|
|
|
|
|
See:
|
|
|
|
https://packaging.python.org/en/latest/distributing.html
|
|
|
|
https://github.com/pypa/sampleproject
|
2017-06-21 12:27:22 +03:00
|
|
|
|
|
|
|
Extra supported commands are:
|
|
|
|
* gen_tl, to generate the classes required for Telethon to run
|
|
|
|
* clean_tl, to clean these generated classes
|
2016-09-18 12:59:12 +03:00
|
|
|
"""
|
|
|
|
|
|
|
|
# To use a consistent encoding
|
|
|
|
from codecs import open
|
2017-06-21 12:27:22 +03:00
|
|
|
from sys import argv
|
2016-09-18 12:59:12 +03:00
|
|
|
from os import path
|
|
|
|
|
2016-11-30 00:29:42 +03:00
|
|
|
# Always prefer setuptools over distutils
|
|
|
|
from setuptools import find_packages, setup
|
|
|
|
|
2017-06-21 12:27:22 +03:00
|
|
|
try:
|
|
|
|
from telethon import TelegramClient
|
2017-06-24 22:39:43 +03:00
|
|
|
except ImportError:
|
2017-06-21 12:27:22 +03:00
|
|
|
TelegramClient = None
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if len(argv) >= 2 and argv[1] == 'gen_tl':
|
2017-07-04 12:02:32 +03:00
|
|
|
from telethon_generator.tl_generator import TLGenerator
|
2017-06-21 12:27:22 +03:00
|
|
|
generator = TLGenerator('telethon/tl')
|
|
|
|
if generator.tlobjects_exist():
|
|
|
|
print('Detected previous TLObjects. Cleaning...')
|
|
|
|
generator.clean_tlobjects()
|
|
|
|
|
|
|
|
print('Generating TLObjects...')
|
|
|
|
generator.generate_tlobjects(
|
|
|
|
'telethon_generator/scheme.tl', import_depth=2
|
|
|
|
)
|
|
|
|
print('Done.')
|
|
|
|
|
|
|
|
elif len(argv) >= 2 and argv[1] == 'clean_tl':
|
2017-07-04 12:02:32 +03:00
|
|
|
from telethon_generator.tl_generator import TLGenerator
|
2017-06-21 12:27:22 +03:00
|
|
|
print('Cleaning...')
|
|
|
|
TLGenerator('telethon/tl').clean_tlobjects()
|
|
|
|
print('Done.')
|
|
|
|
|
|
|
|
else:
|
|
|
|
if not TelegramClient:
|
|
|
|
print('Run `python3', argv[0], 'gen_tl` first.')
|
2017-06-24 19:15:31 +03:00
|
|
|
quit()
|
2017-06-21 12:27:22 +03:00
|
|
|
|
|
|
|
here = path.abspath(path.dirname(__file__))
|
|
|
|
|
|
|
|
# Get the long description from the README file
|
|
|
|
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
|
|
|
|
long_description = f.read()
|
|
|
|
|
|
|
|
setup(
|
|
|
|
name='Telethon',
|
|
|
|
|
|
|
|
# Versions should comply with PEP440.
|
|
|
|
version=TelegramClient.__version__,
|
|
|
|
description="Full-featured Telegram client library for Python 3",
|
|
|
|
long_description=long_description,
|
|
|
|
|
|
|
|
url='https://github.com/LonamiWebs/Telethon',
|
|
|
|
download_url='https://github.com/LonamiWebs/Telethon/releases',
|
|
|
|
|
|
|
|
author='Lonami Exo',
|
|
|
|
author_email='totufals@hotmail.com',
|
|
|
|
|
|
|
|
license='MIT',
|
|
|
|
|
|
|
|
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
|
|
|
classifiers=[
|
|
|
|
# 3 - Alpha
|
|
|
|
# 4 - Beta
|
|
|
|
# 5 - Production/Stable
|
|
|
|
'Development Status :: 3 - Alpha',
|
|
|
|
|
|
|
|
'Intended Audience :: Developers',
|
|
|
|
'Topic :: Communications :: Chat',
|
|
|
|
|
|
|
|
'License :: OSI Approved :: MIT License',
|
|
|
|
|
|
|
|
'Programming Language :: Python :: 3',
|
|
|
|
'Programming Language :: Python :: 3.3',
|
|
|
|
'Programming Language :: Python :: 3.4',
|
|
|
|
'Programming Language :: Python :: 3.5',
|
|
|
|
'Programming Language :: Python :: 3.6'
|
|
|
|
],
|
|
|
|
keywords='telegram api chat client library messaging mtproto',
|
|
|
|
packages=find_packages(exclude=[
|
|
|
|
'telethon_generator', 'telethon_tests', 'run_tests.py',
|
|
|
|
'try_telethon.py'
|
|
|
|
]),
|
|
|
|
install_requires=['pyaes']
|
|
|
|
)
|