Drop py2 support from metrics files
python3 is the only supported version of python in depot_tools.
Bug: 1475402
Change-Id: Ic925af3a79311b11a953f1d0d4602754488a9de3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4824480
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
diff --git a/metrics.py b/metrics.py
index 71bcb6d..4641bf2 100644
--- a/metrics.py
+++ b/metrics.py
@@ -13,11 +13,7 @@
import threading
import time
import traceback
-
-try:
- import urllib2 as urllib
-except ImportError: # For Py3 compatibility
- import urllib.request as urllib
+import urllib.request
import detect_host_arch
import gclient_utils
@@ -87,9 +83,9 @@
# check if we can reach the page. An external developer would get access
# denied.
try:
- req = urllib.urlopen(metrics_utils.APP_URL + '/should-upload')
+ req = urllib.request.urlopen(metrics_utils.APP_URL + '/should-upload')
self._config['is-googler'] = req.getcode() == 200
- except (urllib.URLError, urllib.HTTPError):
+ except (urllib.request.URLError, urllib.request.HTTPError):
self._config['is-googler'] = False
# Make sure the config variables we need are present, and initialize them to