2016-07-05 20:43:51 +02:00
|
|
|
from setuptools import setup
|
|
|
|
from setuptools.command.install import install
|
|
|
|
from platform import system
|
2016-07-06 15:25:04 +02:00
|
|
|
from subprocess import call
|
2022-09-27 14:52:32 +02:00
|
|
|
import main
|
2016-07-27 14:45:34 +02:00
|
|
|
import sys
|
2022-09-27 14:52:32 +02:00
|
|
|
import os
|
|
|
|
from utils.util import curr_directory, join_path
|
2016-07-05 20:43:51 +02:00
|
|
|
|
|
|
|
|
2022-09-27 14:52:32 +02:00
|
|
|
version = main.__version__ + '.0'
|
2016-07-06 15:25:04 +02:00
|
|
|
|
2016-08-08 11:10:18 +02:00
|
|
|
|
2017-07-06 20:32:35 +02:00
|
|
|
if system() == 'Windows':
|
2022-09-27 15:51:50 +02:00
|
|
|
MODULES = ['PyQt5', 'PyAudio', 'numpy', 'opencv-python', 'pydenticon', 'cv2']
|
2017-07-09 12:17:51 +02:00
|
|
|
else:
|
2022-09-27 15:51:50 +02:00
|
|
|
MODULES = ['pydenticon']
|
2022-10-18 03:15:22 +02:00
|
|
|
MODULES.append('PyQt5')
|
2017-07-09 12:17:51 +02:00
|
|
|
try:
|
|
|
|
import pyaudio
|
|
|
|
except ImportError:
|
|
|
|
MODULES.append('PyAudio')
|
|
|
|
try:
|
|
|
|
import numpy
|
|
|
|
except ImportError:
|
|
|
|
MODULES.append('numpy')
|
2018-01-26 16:43:19 +01:00
|
|
|
try:
|
|
|
|
import cv2
|
|
|
|
except ImportError:
|
|
|
|
MODULES.append('opencv-python')
|
2022-09-27 14:52:32 +02:00
|
|
|
try:
|
2022-09-27 15:51:50 +02:00
|
|
|
import coloredlogs
|
2022-09-27 14:52:32 +02:00
|
|
|
except ImportError:
|
2022-09-27 15:51:50 +02:00
|
|
|
MODULES.append('coloredlogs')
|
2022-10-18 03:15:22 +02:00
|
|
|
try:
|
|
|
|
import pyqtconsole
|
|
|
|
except ImportError:
|
|
|
|
MODULES.append('pyqtconsole')
|
2022-09-27 14:52:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2016-07-06 15:25:04 +02:00
|
|
|
|
|
|
|
class InstallScript(install):
|
2016-07-11 16:24:39 +02:00
|
|
|
"""This class configures Toxygen after installation"""
|
2016-07-06 15:25:04 +02:00
|
|
|
|
2016-07-05 20:43:51 +02:00
|
|
|
def run(self):
|
|
|
|
install.run(self)
|
2016-07-26 18:09:57 +02:00
|
|
|
try:
|
2017-07-06 20:32:35 +02:00
|
|
|
if system() != 'Windows':
|
2016-07-26 18:09:57 +02:00
|
|
|
call(["toxygen", "--clean"])
|
|
|
|
except:
|
2016-07-27 14:45:34 +02:00
|
|
|
try:
|
|
|
|
params = list(filter(lambda x: x.startswith('--prefix='), sys.argv))
|
|
|
|
if params:
|
|
|
|
path = params[0][len('--prefix='):]
|
|
|
|
if path[-1] not in ('/', '\\'):
|
|
|
|
path += '/'
|
|
|
|
path += 'bin/toxygen'
|
2017-07-06 20:32:35 +02:00
|
|
|
if system() != 'Windows':
|
2016-07-27 14:45:34 +02:00
|
|
|
call([path, "--clean"])
|
|
|
|
except:
|
|
|
|
pass
|
2016-07-05 20:43:51 +02:00
|
|
|
|
2017-11-05 10:13:28 +01:00
|
|
|
|
2016-07-05 20:43:51 +02:00
|
|
|
setup(name='Toxygen',
|
2016-07-06 15:25:04 +02:00
|
|
|
version=version,
|
2016-07-05 20:43:51 +02:00
|
|
|
description='Toxygen - Tox client',
|
|
|
|
long_description='Toxygen is powerful Tox client written in Python3',
|
2022-10-18 03:15:22 +02:00
|
|
|
url='https://git.macaw.me/emdee/toxygen/',
|
|
|
|
keywords='toxygen Tox messenger',
|
2016-07-05 20:43:51 +02:00
|
|
|
author='Ingvar',
|
2022-10-18 03:15:22 +02:00
|
|
|
maintainer='',
|
2016-07-05 20:43:51 +02:00
|
|
|
license='GPL3',
|
2022-09-27 14:52:32 +02:00
|
|
|
packages=get_packages(),
|
2016-07-06 15:25:04 +02:00
|
|
|
install_requires=MODULES,
|
2016-07-05 20:43:51 +02:00
|
|
|
include_package_data=True,
|
|
|
|
classifiers=[
|
|
|
|
'Programming Language :: Python :: 3 :: Only',
|
2022-09-27 15:51:50 +02:00
|
|
|
'Programming Language :: Python :: 3.9',
|
2016-07-05 20:43:51 +02:00
|
|
|
],
|
|
|
|
entry_points={
|
2022-09-27 14:52:32 +02:00
|
|
|
'console_scripts': ['toxygen=toxygen.main:main']
|
2016-07-05 20:43:51 +02:00
|
|
|
},
|
|
|
|
cmdclass={
|
2022-09-27 14:52:32 +02:00
|
|
|
'install': InstallScript
|
2022-10-18 03:15:22 +02:00
|
|
|
},
|
|
|
|
zip_safe=False
|
|
|
|
)
|