mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 04:43:45 +03:00
Fix importing dependencies during installing (#384)
This commit is contained in:
parent
e48f15be80
commit
ef794bf75d
19
setup.py
19
setup.py
|
@ -15,16 +15,11 @@ Extra supported commands are:
|
||||||
from codecs import open
|
from codecs import open
|
||||||
from sys import argv
|
from sys import argv
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
# Always prefer setuptools over distutils
|
# Always prefer setuptools over distutils
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
|
||||||
try:
|
|
||||||
from telethon import TelegramClient
|
|
||||||
except Exception as e:
|
|
||||||
print('Failed to import TelegramClient due to', e)
|
|
||||||
TelegramClient = None
|
|
||||||
|
|
||||||
|
|
||||||
class TempWorkDir:
|
class TempWorkDir:
|
||||||
"""Switches the working directory to be the one on which this file lives,
|
"""Switches the working directory to be the one on which this file lives,
|
||||||
|
@ -94,21 +89,15 @@ def main():
|
||||||
fetch_errors(ERRORS_JSON)
|
fetch_errors(ERRORS_JSON)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if not TelegramClient:
|
|
||||||
gen_tl()
|
|
||||||
from telethon import TelegramClient as TgClient
|
|
||||||
version = TgClient.__version__
|
|
||||||
else:
|
|
||||||
version = TelegramClient.__version__
|
|
||||||
|
|
||||||
# Get the long description from the README file
|
# Get the long description from the README file
|
||||||
with open('README.rst', encoding='utf-8') as f:
|
with open('README.rst', encoding='utf-8') as f:
|
||||||
long_description = f.read()
|
long_description = f.read()
|
||||||
|
|
||||||
|
with open('telethon/version.py', encoding='utf-8') as f:
|
||||||
|
version = re.search(r"^__version__\s+=\s+'(.*)'$",
|
||||||
|
f.read(), flags=re.MULTILINE).group(1)
|
||||||
setup(
|
setup(
|
||||||
name='Telethon',
|
name='Telethon',
|
||||||
|
|
||||||
# Versions should comply with PEP440.
|
|
||||||
version=version,
|
version=version,
|
||||||
description="Full-featured Telegram client library for Python 3",
|
description="Full-featured Telegram client library for Python 3",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
from .telegram_bare_client import TelegramBareClient
|
from .telegram_bare_client import TelegramBareClient
|
||||||
from .telegram_client import TelegramClient
|
from .telegram_client import TelegramClient
|
||||||
from .network import ConnectionMode
|
from .network import ConnectionMode
|
||||||
from . import tl
|
from . import tl, version
|
||||||
|
|
||||||
|
|
||||||
|
__version__ = version.__version__
|
||||||
|
|
|
@ -9,7 +9,7 @@ from signal import signal, SIGINT, SIGTERM, SIGABRT
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from . import helpers as utils
|
from . import helpers as utils, version
|
||||||
from .crypto import rsa, CdnDecrypter
|
from .crypto import rsa, CdnDecrypter
|
||||||
from .errors import (
|
from .errors import (
|
||||||
RPCError, BrokenAuthKeyError, ServerError,
|
RPCError, BrokenAuthKeyError, ServerError,
|
||||||
|
@ -60,7 +60,7 @@ class TelegramBareClient:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Current TelegramClient version
|
# Current TelegramClient version
|
||||||
__version__ = '0.15.3'
|
__version__ = version.__version__
|
||||||
|
|
||||||
# TODO Make this thread-safe, all connections share the same DC
|
# TODO Make this thread-safe, all connections share the same DC
|
||||||
_config = None # Server configuration (with .dc_options)
|
_config = None # Server configuration (with .dc_options)
|
||||||
|
|
3
telethon/version.py
Normal file
3
telethon/version.py
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Versions should comply with PEP440.
|
||||||
|
# This line is parsed in setup.py:
|
||||||
|
__version__ = '0.15.3'
|
Loading…
Reference in New Issue
Block a user