Bug 1669251 - py3 compatibility changes for iceserver and websocketprocessbridge; r=ahal

This allows me to run iceserver and websocketprocessbridge in mochitests under python 3. Some
tests still fail for me, so follow-up is likely required, but these changes at least allow
the servers to run without obvious failures.

Differential Revision: https://phabricator.services.mozilla.com/D92667
This commit is contained in:
Geoff Brown 2020-10-06 21:31:47 +00:00
Родитель 88e30d29c4
Коммит 9224bd537c
2 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -13,8 +13,10 @@ import random
import operator
import os
import platform
import six
import string
import time
from functools import reduce
from string import Template
from twisted.internet import reactor, protocol
from twisted.internet.task import LoopingCall
@ -322,7 +324,7 @@ class StunMessage(object):
digest_buf = self.build(MESSAGE_INTEGRITY)
# Trim off the MESSAGE-INTEGRITY attr
digest_buf = digest_buf[:len(digest_buf) - 24]
password = passlib.utils.saslprep(unicode(password))
password = passlib.utils.saslprep(six.text_type(password))
key_string = "{}:{}:{}".format(username, realm, password)
md5 = hashlib.md5()
md5.update(key_string)
@ -755,7 +757,7 @@ def create_self_signed_cert(name):
if __name__ == "__main__":
random.seed()
if platform.system() is "Windows":
if platform.system() == "Windows":
# Windows is finicky about allowing real interfaces to talk to loopback.
interface_4 = v4_address
interface_6 = v6_address

Просмотреть файл

@ -9,6 +9,7 @@ import txws
import psutil
import argparse
import six
import sys
import os
@ -58,6 +59,7 @@ class SocketSide(protocol.Protocol):
self.processSide = ProcessSide(self)
# We deliberately crash if |data| isn't on the "menu",
# or there is some problem spawning.
data = six.ensure_str(data)
reactor.spawnProcess(self.processSide,
commands[data][0],
commands[data],