aboutsummaryrefslogtreecommitdiffstats
path: root/python/servo/command_base.py
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2019-10-14 00:36:20 +0100
committermarmeladema <xademax@gmail.com>2019-10-16 00:22:07 +0100
commitf1d42fe787c20ff2d62b0aab00874fe9c79af352 (patch)
tree7aacb29eb1243018d2610de3274ef0ac0edf665e /python/servo/command_base.py
parentf063ea64a5023aa95f7165ed46d87c43c1f52340 (diff)
downloadservo-f1d42fe787c20ff2d62b0aab00874fe9c79af352.tar.gz
servo-f1d42fe787c20ff2d62b0aab00874fe9c79af352.zip
Use urllib from six module in order to be compatible with Python3
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r--python/servo/command_base.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 67f91e6a1d4..176ecd89e48 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -27,7 +27,7 @@ import tarfile
import zipfile
from xml.etree.ElementTree import XML
from servo.util import download_file
-import urllib2
+import six.moves.urllib as urllib
from bootstrap import check_gstreamer_lib
from mach.decorators import CommandArgument
@@ -506,15 +506,15 @@ class CommandBase(object):
nightly_date = nightly_date.strip()
# Fetch the filename to download from the build list
repository_index = NIGHTLY_REPOSITORY_URL + "?list-type=2&prefix=nightly"
- req = urllib2.Request(
+ req = urllib.request.Request(
"{}/{}/{}".format(repository_index, os_prefix, nightly_date))
try:
- response = urllib2.urlopen(req).read()
+ response = urllib.request.urlopen(req).read()
tree = XML(response)
namespaces = {'ns': tree.tag[1:tree.tag.index('}')]}
file_to_download = tree.find('ns:Contents', namespaces).find(
'ns:Key', namespaces).text
- except urllib2.URLError as e:
+ except urllib.error.URLError as e:
print("Could not fetch the available nightly versions from the repository : {}".format(
e.reason))
sys.exit(1)