setup.py fixes

This commit is contained in:
ingvar1995 2018-05-18 21:07:59 +03:00
parent a575312167
commit 88786b0398
2 changed files with 17 additions and 6 deletions

View File

@ -4,6 +4,8 @@ from platform import system
from subprocess import call from subprocess import call
import main import main
import sys import sys
import os
from utils.util import curr_directory, join_path
version = main.__version__ + '.0' version = main.__version__ + '.0'
@ -35,6 +37,15 @@ else:
MODULES.append('pydenticon') 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): class InstallScript(install):
"""This class configures Toxygen after installation""" """This class configures Toxygen after installation"""
@ -66,7 +77,7 @@ setup(name='Toxygen',
author='Ingvar', author='Ingvar',
maintainer='Ingvar', maintainer='Ingvar',
license='GPL3', license='GPL3',
packages=['toxygen', 'toxygen.plugins', 'toxygen.styles'], packages=get_packages(),
install_requires=MODULES, install_requires=MODULES,
include_package_data=True, include_package_data=True,
classifiers=[ classifiers=[
@ -75,8 +86,8 @@ setup(name='Toxygen',
'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.6',
], ],
entry_points={ entry_points={
'console_scripts': ['toxygen=toxygen.main:main'], 'console_scripts': ['toxygen=toxygen.main:main']
}, },
cmdclass={ cmdclass={
'install': InstallScript, 'install': InstallScript
}) })

View File

@ -38,13 +38,13 @@ class Friend(contact.Contact):
def clear_unsent_files(self): def clear_unsent_files(self):
self._corr = list(filter(lambda x: type(x) is not UnsentFileMessage, self._corr)) 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): def is_valid(message):
if type(message) is not UnsentFileMessage: if type(message) is not UnsentFileMessage:
return True return True
if message.get_data()[1] is not None: if message.data is not None:
return True return True
return os.path.exists(message.get_data()[0]) return os.path.exists(message.path)
self._corr = list(filter(is_valid, self._corr)) self._corr = list(filter(is_valid, self._corr))