summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py76
1 files changed, 41 insertions, 35 deletions
diff --git a/setup.py b/setup.py
index 5cae466..6a441f7 100755
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007 Andrew Resch <andrewresch@gmail.com>
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
@@ -9,20 +8,16 @@
# See LICENSE for more details.
#
-from __future__ import print_function
-
import glob
import os
import platform
import sys
-from distutils import cmd
from distutils.command.build import build as _build
from distutils.command.clean import clean as _clean
from distutils.command.install_data import install_data as _install_data
-from distutils.spawn import find_executable
-from shutil import rmtree
+from shutil import rmtree, which
-from setuptools import find_packages, setup
+from setuptools import Command, find_packages, setup
from setuptools.command.test import test as _test
import msgfmt
@@ -32,7 +27,7 @@ try:
from sphinx.setup_command import BuildDoc
except ImportError:
- class BuildDoc(object):
+ class BuildDoc:
pass
@@ -72,7 +67,7 @@ class PyTest(_test):
sys.exit(errcode)
-class CleanDocs(cmd.Command):
+class CleanDocs(Command):
description = 'Clean the documentation build and module rst files'
user_options = []
@@ -84,7 +79,7 @@ class CleanDocs(cmd.Command):
def run(self):
docs_build = 'docs/build'
- print('Deleting {}'.format(docs_build))
+ print(f'Deleting {docs_build}')
try:
rmtree(docs_build)
except OSError:
@@ -94,7 +89,7 @@ class CleanDocs(cmd.Command):
os.remove(module)
-class BuildWebUI(cmd.Command):
+class BuildWebUI(Command):
description = 'Minify WebUI files'
user_options = []
@@ -145,7 +140,7 @@ class BuildWebUI(cmd.Command):
create_gettext_js(deluge_all_path)
-class CleanWebUI(cmd.Command):
+class CleanWebUI(Command):
description = 'Clean the documentation build and rst files'
user_options = []
@@ -162,7 +157,7 @@ class CleanWebUI(cmd.Command):
for js_src_dir in BuildWebUI.JS_SRC_DIRS:
for file_type in ('.js', '-debug.js'):
js_file = os.path.join(js_basedir, js_src_dir + file_type)
- print('Deleting {}'.format(js_file))
+ print(f'Deleting {js_file}')
try:
os.remove(js_file)
except OSError:
@@ -170,14 +165,14 @@ class CleanWebUI(cmd.Command):
# Remove generated gettext.js
js_file = os.path.join(js_basedir, 'gettext.js')
- print('Deleting {}'.format(js_file))
+ print(f'Deleting {js_file}')
try:
os.remove(js_file)
except OSError:
pass
-class BuildTranslations(cmd.Command):
+class BuildTranslations(Command):
description = 'Compile .po files into .mo files & create .desktop file'
user_options = [
@@ -202,7 +197,7 @@ class BuildTranslations(cmd.Command):
basedir = os.path.join(self.build_lib, 'deluge', 'i18n')
intltool_merge = 'intltool-merge'
- if not windows_check() and find_executable(intltool_merge):
+ if not windows_check() and which(intltool_merge):
intltool_merge_opts = '--utf8 --quiet'
for data_file in (desktop_data, appdata_data):
# creates the translated file from .in file.
@@ -246,11 +241,11 @@ class BuildTranslations(cmd.Command):
upto_date = True
if upto_date:
- sys.stdout.write(' po files already upto date. ')
+ sys.stdout.write(' po files already up to date. ')
sys.stdout.write('\b\b \nFinished compiling translation files. \n')
-class CleanTranslations(cmd.Command):
+class CleanTranslations(Command):
description = 'Cleans translations files.'
user_options = [
('all', 'a', 'Remove all build output, not just temporary by-products')
@@ -270,7 +265,7 @@ class CleanTranslations(cmd.Command):
os.remove(path)
-class BuildPlugins(cmd.Command):
+class BuildPlugins(Command):
description = 'Build plugins into .eggs'
user_options = [
@@ -314,7 +309,7 @@ class BuildPlugins(cmd.Command):
)
-class CleanPlugins(cmd.Command):
+class CleanPlugins(Command):
description = 'Cleans the plugin folders'
user_options = [
('all', 'a', 'Remove all build output, not just temporary by-products')
@@ -361,7 +356,7 @@ class CleanPlugins(cmd.Command):
os.removedirs(path)
-class EggInfoPlugins(cmd.Command):
+class EggInfoPlugins(Command):
description = 'Create .egg-info directories for plugins'
user_options = []
@@ -394,7 +389,7 @@ class Build(_build):
try:
from deluge._libtorrent import LT_VERSION
- print('Info: Found libtorrent ({}) installed.'.format(LT_VERSION))
+ print(f'Info: Found libtorrent ({LT_VERSION}) installed.')
except ImportError as ex:
print('Warning: libtorrent (libtorrent-rasterbar) not found: %s' % ex)
@@ -443,6 +438,7 @@ cmdclass = {
'build_trans': BuildTranslations,
'build_plugins': BuildPlugins,
'build_docs': BuildDoc,
+ 'spellcheck_docs': BuildDoc,
'install_data': InstallData,
'clean_plugins': CleanPlugins,
'clean_trans': CleanTranslations,
@@ -458,7 +454,7 @@ if not windows_check() and not osx_check():
for icon_path in glob.glob('deluge/ui/data/icons/hicolor/*x*'):
size = os.path.basename(icon_path)
icons = glob.glob(os.path.join(icon_path, 'apps', 'deluge*.png'))
- _data_files.append(('share/icons/hicolor/{}/apps'.format(size), icons))
+ _data_files.append((f'share/icons/hicolor/{size}/apps', icons))
_data_files.extend(
[
(
@@ -483,11 +479,21 @@ if not windows_check() and not osx_check():
if os.path.isfile(appdata_data):
_data_files.append(('share/appdata', [appdata_data]))
+
+# Entry Points
_entry_points['console_scripts'] = [
'deluge-console = deluge.ui.console:start',
+]
+
+# On Windows use gui_scripts to hide cmd popup (no effect on Linux/MacOS)
+_entry_points['gui_scripts'] = [
+ 'deluge = deluge.ui.ui_entry:start_ui',
+ 'deluge-gtk = deluge.ui.gtk3:start',
'deluge-web = deluge.ui.web:start',
'deluged = deluge.core.daemon_entry:start_daemon',
]
+
+# Provide Windows 'debug' exes for stdin/stdout e.g. logging/errors
if windows_check():
_entry_points['console_scripts'].extend(
[
@@ -496,10 +502,7 @@ if windows_check():
'deluged-debug = deluge.core.daemon_entry:start_daemon',
]
)
-_entry_points['gui_scripts'] = [
- 'deluge = deluge.ui.ui_entry:start_ui',
- 'deluge-gtk = deluge.ui.gtk3:start',
-]
+
_entry_points['deluge.ui'] = [
'console = deluge.ui.console:Console',
'web = deluge.ui.web:Web',
@@ -542,17 +545,20 @@ install_requires = [
'rencode',
'pyopenssl',
'pyxdg',
- 'pillow',
'mako',
- 'chardet',
- 'six',
- 'setproctitle',
+ 'setuptools',
"pywin32; sys_platform == 'win32'",
- "py2-ipaddress; sys_platform == 'win32' and python_version == '2'",
"certifi; sys_platform == 'win32'",
'zope.interface',
]
-tests_require = ['pytest', 'pytest-twisted']
+extras_require = {
+ 'all': [
+ 'setproctitle',
+ 'pillow',
+ 'chardet',
+ 'ifaddr',
+ ]
+}
# Main setup
setup(
@@ -591,12 +597,12 @@ setup(
'Operating System :: POSIX',
'Topic :: Internet',
],
- python_requires='>=2.7',
+ python_requires='>=3.6',
license='GPLv3+',
cmdclass=cmdclass,
setup_requires=setup_requires,
install_requires=install_requires,
- tests_require=tests_require,
+ extras_require=extras_require,
data_files=_data_files,
package_data=_package_data,
exclude_package_data=_exclude_package_data,