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
This commit is contained in:
parent
d21a6a660f
commit
fbfe96c505
240 changed files with 6336 additions and 6398 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# SAT plugin to export commands (experimental)
|
||||
|
|
@ -52,7 +52,7 @@ class ExportCommandProtocol(protocol.ProcessProtocol):
|
|||
def _clean(self, data):
|
||||
if not data:
|
||||
log.error("data should not be empty !")
|
||||
return u""
|
||||
return ""
|
||||
decoded = data.decode("utf-8", "ignore")[: -1 if data[-1] == "\n" else None]
|
||||
return clean_ustr(decoded)
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ class ExportCommandProtocol(protocol.ProcessProtocol):
|
|||
self.client.sendMessage(self.target, {"": self._clean(data)}, no_trigger=True)
|
||||
|
||||
def processEnded(self, reason):
|
||||
log.info(u"process finished: %d" % (reason.value.exitCode,))
|
||||
log.info("process finished: %d" % (reason.value.exitCode,))
|
||||
self.parent.removeProcess(self.target, self)
|
||||
|
||||
def write(self, message):
|
||||
|
|
@ -120,12 +120,12 @@ class CommandExport(object):
|
|||
|
||||
if spawned_key in self.spawned:
|
||||
try:
|
||||
body = message_elt.elements(C.NS_CLIENT, "body").next()
|
||||
body = next(message_elt.elements(C.NS_CLIENT, "body"))
|
||||
except StopIteration:
|
||||
# do not block message without body (chat state notification...)
|
||||
return True
|
||||
|
||||
mess_data = unicode(body) + "\n"
|
||||
mess_data = str(body) + "\n"
|
||||
processes_set = self.spawned[spawned_key]
|
||||
_continue = False
|
||||
exclusive = False
|
||||
|
|
@ -158,7 +158,7 @@ class CommandExport(object):
|
|||
raise jid.InvalidFormat
|
||||
_jid = _jid.userhostJID()
|
||||
except (RuntimeError, jid.InvalidFormat, AttributeError):
|
||||
log.info(u"invalid target ignored: %s" % (target,))
|
||||
log.info("invalid target ignored: %s" % (target,))
|
||||
continue
|
||||
process_prot = ExportCommandProtocol(self, client, _jid, options)
|
||||
self.spawned.setdefault((_jid, client.profile), set()).add(process_prot)
|
||||
|
|
|
|||
Loading…
Reference in a new issue