comparison twisted/plugins/sat_plugin.py @ 3028:ab2696e34d29

Python 3 port: /!\ this is a huge commit /!\ starting from this commit, SàT is needs Python 3.6+ /!\ SàT maybe be instable or some feature may not work anymore, this will improve with time This patch port backend, bridge and frontends to Python 3. Roughly this has been done this way: - 2to3 tools has been applied (with python 3.7) - all references to python2 have been replaced with python3 (notably shebangs) - fixed files not handled by 2to3 (notably the shell script) - several manual fixes - fixed issues reported by Python 3 that where not handled in Python 2 - replaced "async" with "async_" when needed (it's a reserved word from Python 3.7) - replaced zope's "implements" with @implementer decorator - temporary hack to handle data pickled in database, as str or bytes may be returned, to be checked later - fixed hash comparison for password - removed some code which is not needed anymore with Python 3 - deactivated some code which needs to be checked (notably certificate validation) - tested with jp, fixed reported issues until some basic commands worked - ported Primitivus (after porting dependencies like urwid satext) - more manual fixes
author Goffi <goffi@goffi.org>
date Tue, 13 Aug 2019 19:08:41 +0200
parents c5543fba97e8
children fee60f17ebac
comparison
equal deleted inserted replaced
3027:ff5bcb12ae60 3028:ab2696e34d29
26 pdb.set_trace = ipdb.set_trace 26 pdb.set_trace = ipdb.set_trace
27 pdb.post_mortem = ipdb.post_mortem 27 pdb.post_mortem = ipdb.post_mortem
28 except ImportError: 28 except ImportError:
29 pass 29 pass
30 30
31 from zope.interface import implements 31 from zope.interface import implementer
32 from twisted.python import usage 32 from twisted.python import usage
33 from twisted.plugin import IPlugin 33 from twisted.plugin import IPlugin
34 from twisted.application.service import IServiceMaker 34 from twisted.application.service import IServiceMaker
35 35
36 # XXX: We need to configure logs before any log method is used, so here is the best place. 36 # XXX: We need to configure logs before any log method is used, so here is the best place.
47 47
48 class Options(usage.Options): 48 class Options(usage.Options):
49 optParameters = [] 49 optParameters = []
50 50
51 51
52 class SatMaker(object): 52 @implementer(IPlugin, IServiceMaker)
53 implements(IServiceMaker, IPlugin) 53 class SatMaker:
54 54
55 tapname = C.APP_NAME_FILE 55 tapname = C.APP_NAME_FILE
56 description = _(u"%s XMPP client backend") % C.APP_NAME_FULL 56 description = _("%s XMPP client backend") % C.APP_NAME_FULL
57 options = Options 57 options = Options
58 58
59 def makeService(self, options): 59 def makeService(self, options):
60 from twisted.internet import gireactor 60 from twisted.internet import gireactor
61 gireactor.install() 61 gireactor.install()