diff --git a/DEPENDS.md b/DEPENDS.md index 10d394584..cb587d339 100644 --- a/DEPENDS.md +++ b/DEPENDS.md @@ -12,7 +12,7 @@ All modules will require the [common](#common) section dependencies. ## Build - [setuptools] -- [intltool] - Translation file tool +- [intltool] - Optional: Desktop file translation for \*nix. - [closure-compiler] - Minify javascript (alternative is [slimit]) ## Common @@ -20,37 +20,33 @@ All modules will require the [common](#common) section dependencies. - [Twisted] _>= 16.6_ - Use `TLS` extras for `service_identity` and `idna`. - [OpenSSL] _>= 1.0.1_ - [pyOpenSSL] -- [Chardet] -- [gettext] -- [PyXDG] +- [PyXDG] - Access freedesktop.org standards for \*nix. +- [xdg-utils] - Provides xdg-open for \*nix. - [six] - [zope.interface] -- [xdg-utils] - -#### Optional - -- [setproctitle] - Support correctly naming Deluge processes. -- [Pillow] - Image library for `.ico` support. -- [rencode] _>= 1.0.2_ - Encoding library with Python port bundled. -- [dbus-python] +- [chardet] - Optional: Encoding detection. +- [setproctitle] - Optional: Renaming processes. +- [Pillow] - Optional: Enable `.ico` support. +- [rencode] _>= 1.0.2_ - Optional: Encoding library (Python port is bundled). +- [dbus-python] - Optional: Show item location in filemanager. #### Windows OS - [pywin32] - [certifi] -- [py2-ipaddress] - Optional for Python 2 IPv6 lookup +- [py2-ipaddress] - Optional: Add IPv6 lookup for Python 2. ## Core (deluged daemon) - [libtorrent] _>= 1.1.1_ -- [GeoIP] - Optional (_Debian: `python-geoip`_) +- [GeoIP] - Optional: IP address location lookup. (_Debian: `python-geoip`_) ## GTK UI - PyGTK - [pycairo] - [librsvg] _>= 2_ -- [python-appindicator] - Optional +- [python-appindicator] - Optional: Ubuntu system tray icon. #### MacOS @@ -64,10 +60,8 @@ All modules will require the [common](#common) section dependencies. ### Notifications -Optional dependencies for this plugin. - -- [pygame] - Sound -- [python-notify] - Desktop popup +- [pygame] - Optional: Play sounds +- [python-notify] - Optional: Desktop popups. [python]: https://www.python.org/ [setuptools]: https://setuptools.readthedocs.io/en/latest/ @@ -87,7 +81,6 @@ Optional dependencies for this plugin. [setproctitle]: https://pypi.org/project/setproctitle/ [gtkosxapplication]: https://github.com/jralls/gtk-mac-integration [chardet]: https://chardet.github.io/ -[gettext]: https://www.gnu.org/software/gettext/ [rencode]: https://github.com/aresch/rencode [pyxdg]: https://www.freedesktop.org/wiki/Software/pyxdg/ [six]: https://pythonhosted.org/six/ diff --git a/deluge/common.py b/deluge/common.py index 6bb2fb043..e9f33036c 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -26,12 +26,16 @@ import sys import tarfile import time -import chardet import pkg_resources from deluge.decorators import deprecated from deluge.error import InvalidPathError +try: + import chardet +except ImportError: + chardet = None + try: from urllib.parse import unquote_plus, urljoin from urllib.request import pathname2url @@ -983,12 +987,10 @@ def decode_bytes(byte_str, encoding='utf8'): elif not isinstance(byte_str, bytes): return byte_str - encodings = [ - lambda: ('utf8', 'strict'), - lambda: ('iso-8859-1', 'strict'), - lambda: (chardet.detect(byte_str)['encoding'], 'strict'), - lambda: (encoding, 'ignore'), - ] + encodings = [lambda: ('utf8', 'strict'), lambda: ('iso-8859-1', 'strict')] + if chardet: + encodings.append(lambda: (chardet.detect(byte_str)['encoding'], 'strict')) + encodings.append(lambda: (encoding, 'ignore')) if encoding.lower() not in ['utf8', 'utf-8']: encodings.insert(0, lambda: (encoding, 'strict')) diff --git a/setup.py b/setup.py index d5fe90933..40ade8b6b 100755 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ 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 setuptools import find_packages, setup @@ -206,8 +207,8 @@ class BuildTranslations(cmd.Command): else: basedir = os.path.join(self.build_lib, 'deluge', 'i18n') - if not windows_check(): - intltool_merge = 'intltool-merge' + intltool_merge = 'intltool-merge' + if not windows_check() and find_executable(intltool_merge): intltool_merge_opts = '--utf8 --quiet' for data_file in (desktop_data, appdata_data): # creates the translated file from .in file.