From 88786b03987fb6c320b365b89692889b00c8b73a Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Fri, 18 May 2018 21:07:59 +0300 Subject: [PATCH] setup.py fixes --- setup.py | 17 ++++++++++++++--- toxygen/contacts/friend.py | 6 +++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 8457ef5..fb80363 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,8 @@ from platform import system from subprocess import call import main import sys +import os +from utils.util import curr_directory, join_path version = main.__version__ + '.0' @@ -35,6 +37,15 @@ else: MODULES.append('pydenticon') +def get_packages(): + directory = join_path(curr_directory(__file__), 'toxygen') + for root, dirs, files in os.walk(directory): + packages = map(lambda d: 'toxygen.' + d, dirs) + packages = ['toxygen'] + list(packages) + + return packages + + class InstallScript(install): """This class configures Toxygen after installation""" @@ -66,7 +77,7 @@ setup(name='Toxygen', author='Ingvar', maintainer='Ingvar', license='GPL3', - packages=['toxygen', 'toxygen.plugins', 'toxygen.styles'], + packages=get_packages(), install_requires=MODULES, include_package_data=True, classifiers=[ @@ -75,8 +86,8 @@ setup(name='Toxygen', 'Programming Language :: Python :: 3.6', ], entry_points={ - 'console_scripts': ['toxygen=toxygen.main:main'], + 'console_scripts': ['toxygen=toxygen.main:main'] }, cmdclass={ - 'install': InstallScript, + 'install': InstallScript }) diff --git a/toxygen/contacts/friend.py b/toxygen/contacts/friend.py index 0bc7b99..9103463 100644 --- a/toxygen/contacts/friend.py +++ b/toxygen/contacts/friend.py @@ -38,13 +38,13 @@ class Friend(contact.Contact): def clear_unsent_files(self): self._corr = list(filter(lambda x: type(x) is not UnsentFileMessage, self._corr)) - def remove_invalid_unsent_files(self): # TODO: fix + def remove_invalid_unsent_files(self): def is_valid(message): if type(message) is not UnsentFileMessage: return True - if message.get_data()[1] is not None: + if message.data is not None: return True - return os.path.exists(message.get_data()[0]) + return os.path.exists(message.path) self._corr = list(filter(is_valid, self._corr))