Skip to content

Commit

Permalink
Fix importing dependencies during installing (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreif authored and Lonami committed Oct 28, 2017
1 parent e48f15b commit ef794bf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
19 changes: 4 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@
from codecs import open
from sys import argv
import os
import re

# Always prefer setuptools over distutils
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:
"""Switches the working directory to be the one on which this file lives,
Expand Down Expand Up @@ -94,21 +89,15 @@ def main():
fetch_errors(ERRORS_JSON)

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
with open('README.rst', encoding='utf-8') as f:
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(
name='Telethon',

# Versions should comply with PEP440.
version=version,
description="Full-featured Telegram client library for Python 3",
long_description=long_description,
Expand Down
5 changes: 4 additions & 1 deletion telethon/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from .telegram_bare_client import TelegramBareClient
from .telegram_client import TelegramClient
from .network import ConnectionMode
from . import tl
from . import tl, version


__version__ = version.__version__
4 changes: 2 additions & 2 deletions telethon/telegram_bare_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from threading import Lock
from time import sleep

from . import helpers as utils
from . import helpers as utils, version
from .crypto import rsa, CdnDecrypter
from .errors import (
RPCError, BrokenAuthKeyError, ServerError,
Expand Down Expand Up @@ -60,7 +60,7 @@ class TelegramBareClient:
"""

# Current TelegramClient version
__version__ = '0.15.3'
__version__ = version.__version__

# TODO Make this thread-safe, all connections share the same DC
_config = None # Server configuration (with .dc_options)
Expand Down
3 changes: 3 additions & 0 deletions telethon/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Versions should comply with PEP440.
# This line is parsed in setup.py:
__version__ = '0.15.3'

0 comments on commit ef794bf

Please sign in to comment.