There is a bug in Py2 setuptools where the build fails if unicode dict keys
are passed to package_data:
`package_data must be a dictionary mapping package names to lists of wildcard patterns`
The easiest workaround is to remove unicode_literals use in setup.py as it is not that important.
- Python 3 renames `unicode` type to `str` and introduces `bytes` type.
- Python 2.7 has `bytes` but is only an alias for `str` so restricted
to comparisons but helps keep compatibility.
- To test for unicode string on Py2 and Py3 uses the "''.__class__" type.
- Remove usage of utf8encode and just encode, problems with bytes being passed
in code will be picked up faster.
- Where possible refactor out isinstance for try..except duck-typing.
- Switch to using Python 3 naming convention where str now refers to unicode
and bytes are encoded strings.
- Cleanup docs and code
- Also rename convert_to_utf8 to utf8_encode_structure to clarify functionality.
* Added a new convert_to_utf8 function to common that is handy for
any nested dictionaries etc.
* Small refactor to get rid of duplicate code and comment will be
encoded by convert_to_utf8 function.
* Passes test_maketorrent.
* Twisted methods require byte-string arguments.
* The headers str conversion in httpdownloader _download_file was
incorrent and left the dict key still as unicode so replaced with
a dict comprehension (py2.7 requirement).
* Added `from __future__ import unicode_literals` to every file so
now all strings in code are forced to be unicode strings unless
marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`.
This is a large change but we have been working towards the goal of unicode
strings passed in the code so decoding external input and encoding
output as byte strings (where applicable).
Note that in Python 2 the `str` type still refers to byte strings.
* Replaced the use of `str` for `basestring` in isinstance comparison as
this was the original intention but breaks code when encoutering unicode strings.
* Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly
related to gobject signal names.
- Using DYLD_LIBRARY_PATH seems to have the unintended effect of making associated apps
unusable (unable to locate dylds) when opening a file from within Deluge. The workaround
for now is to switch to using DYLD_FALLBACK_LIBRARY_PATH.
* There is a problem with Twisted 17 and the setup for travis and tox
using site-packages with an old openssh package.
AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
* The simplest workaround for now is to pin Twisted to 16.6.