Plan Python3 - gazpachoking/deluge GitHub Wiki
This page provides more detailed information on porting to Python 3 started in ticket #1328.
The current consensus is that the core and common files should be prepared for a future Twisted release with full Python 3 support and UI's worked on at a later date.
It is best to read these other documents on Python 3 porting
Django https:--wiki.ubuntu.com-Python-3 https:--twistedmatrix.com-trac-wiki-Plan-Python3
Deluge relies on all dependant packages supporting Python 3 with twisted being the most crucial. At the time of writing there is minimal Python 3 support in Twisted >= 12.3 but work is still ongoing: Twisted Python 3 Plan.
Although 2to3
will highlight areas requiring changes it cannot be relied upon to make the correct decisions especially concerting bytes and unicode strings so do not commit code changes generated by it.
- Change setup.py from
setuptools
todistribute
- Magic Method
__cmp__
incommon.py
replaced with__lt__
- Found at least one instance of raise with three args in Blocklist plugin
- peerguardian.py in Blocklist plugin - Rename
next()
to__next__()
and addnext = __next__
to class -
iteritems()
where needed replace with try/except: http://python3porting.com/differences.html#dictionary-methods
from __future__ import unicode_literals
::
Likely to be applied to all files to ensure byte, Unicode string separation
from __future__ import division
and from __future__ import print_function
::
Added to files where required
from __future__ import absolute_import
::
Should not be required if the imports are properly set up. See: http://python3porting.com/differences.html#imports
It might be easier and simpler to add this module but should first determine how much of the code can be converted without using it.