Bug 1468902 [wpt PR 11516] - Fix Python 3 errors when doing ./wpt make-hosts-file, a=testonly

Automatic update from web-platform-testsFix Python 3 errors when doing ./wpt make-hosts-file (#11516)

--

wpt-commits: d7d545ab69e304b992ac1b3e0a78785779f57e3b
wpt-pr: 11516
This commit is contained in:
Ms2ger 2018-07-06 22:46:17 +00:00 committed by James Graham
parent d82ed22876
commit 871ecf3815
8 changed files with 19 additions and 22 deletions

View File

@ -13,7 +13,7 @@ import sys
import threading
import time
import traceback
import urllib2
from six.moves import urllib
import uuid
from collections import defaultdict, OrderedDict
from multiprocessing import Process, Event
@ -444,10 +444,10 @@ def check_subdomains(config):
connected = False
for i in range(10):
try:
urllib2.urlopen("http://%s:%d/" % (host, port))
urllib.request.urlopen("http://%s:%d/" % (host, port))
connected = True
break
except urllib2.URLError:
except urllib.error.URLError:
time.sleep(1)
if not connected:
@ -460,7 +460,7 @@ def check_subdomains(config):
continue
try:
urllib2.urlopen("http://%s:%d/" % (domain, port))
urllib.request.urlopen("http://%s:%d/" % (domain, port))
except Exception:
logger.critical("Failed probing domain %s. "
"You may need to edit /etc/hosts or similar, see README.md." % domain)

View File

@ -3,7 +3,7 @@ import os
from collections import defaultdict, Mapping
import sslutils
from . import sslutils
from .utils import get_port

View File

@ -7,7 +7,7 @@ import re
import time
import types
import uuid
from cStringIO import StringIO
from six.moves import StringIO
from six import text_type

View File

@ -1,7 +1,7 @@
import base64
import cgi
import Cookie
import StringIO
from six.moves.http_cookies import BaseCookie
from six.moves import StringIO
import tempfile
from six.moves.urllib.parse import parse_qsl, urlsplit
@ -52,7 +52,7 @@ class InputFile(object):
if length > self.max_buffer_size:
self._buf = tempfile.TemporaryFile()
else:
self._buf = StringIO.StringIO()
self._buf = StringIO()
@property
def _buf_position(self):
@ -314,7 +314,7 @@ class Request(object):
@property
def cookies(self):
if self._cookies is None:
parser = Cookie.BaseCookie()
parser = BaseCookie()
cookie_headers = self.headers.get("cookie", "")
parser.load(cookie_headers)
cookies = Cookies()

View File

@ -1,6 +1,6 @@
from collections import OrderedDict
from datetime import datetime, timedelta
import Cookie
from six.moves.http_cookies import BaseCookie, Morsel
import json
import types
import uuid
@ -134,7 +134,7 @@ class Response(object):
max_age = int(max_age.total_seconds())
max_age = "%.0d" % max_age
m = Cookie.Morsel()
m = Morsel()
def maybe_set(key, value):
if value is not None and value is not False:
@ -154,7 +154,7 @@ class Response(object):
def unset_cookie(self, name):
"""Remove a cookie from those that are being sent with the response"""
cookies = self.headers.get("Set-Cookie")
parser = Cookie.BaseCookie()
parser = BaseCookie()
for cookie in cookies:
parser.load(cookie)

View File

@ -1,8 +1,8 @@
import BaseHTTPServer
from six.moves import BaseHTTPServer
import errno
import os
import socket
from SocketServer import ThreadingMixIn
from six.moves.socketserver import ThreadingMixIn
import ssl
import sys
import threading

View File

@ -1,9 +1,6 @@
# flake8: noqa (not ideal, but nicer than adding noqa: F401 to every line!)
import openssl
import pregenerated
from base import NoSSLEnvironment
from openssl import OpenSSLEnvironment
from pregenerated import PregeneratedSSLEnvironment
from .base import NoSSLEnvironment
from .openssl import OpenSSLEnvironment
from .pregenerated import PregeneratedSSLEnvironment
environments = {"none": NoSSLEnvironment,
"openssl": OpenSSLEnvironment,

View File

@ -2,7 +2,7 @@ import socket
def invert_dict(dict):
rv = {}
for key, values in dict.iteritems():
for key, values in dict.items():
for value in values:
if value in rv:
raise ValueError