Reland "Drop py2 support in gerrit and git related files"

This is a reland of commit b5c7f4b46c

Original change's description:
> Drop py2 support in gerrit and git related files
>
> python3 is the only supported version of python in depot_tools.
>
> Bug: 1475402
> Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

Bug: 1475402
Change-Id: I194180494071777b7b9dd91a5c8edabbbf5484c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811218
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
Gavin Mak
2023-08-28 17:01:52 +00:00
committed by LUCI CQ
parent b8164180d2
commit cc97655889
32 changed files with 67 additions and 264 deletions

View File

@@ -5,8 +5,6 @@
"""A git command for managing a local cache of git repositories."""
from __future__ import print_function
import contextlib
import logging
import optparse
@@ -17,11 +15,7 @@ import sys
import tempfile
import threading
import time
try:
import urlparse
except ImportError: # For Py3 compatibility
import urllib.parse as urlparse
import urllib.parse
from download_from_google_storage import Gsutil
import gclient_utils
@@ -141,7 +135,7 @@ class Mirror(object):
b = os.getenv('OVERRIDE_BOOTSTRAP_BUCKET')
if b:
return b
u = urlparse.urlparse(self.url)
u = urllib.parse.urlparse(self.url)
if u.netloc == 'chromium.googlesource.com':
return 'chromium-git-cache'
# Not recognized.
@@ -163,7 +157,7 @@ class Mirror(object):
url = os.path.splitdrive(url)[1]
return url.replace('-', '--').replace(os.sep, '-')
parsed = urlparse.urlparse(url)
parsed = urllib.parse.urlparse(url)
norm_url = parsed.netloc + parsed.path
if norm_url.endswith('.git'):
norm_url = norm_url[:-len('.git')]
@@ -358,7 +352,7 @@ class Mirror(object):
def supported_project(self):
"""Returns true if this repo is known to have a bootstrap zip file."""
u = urlparse.urlparse(self.url)
u = urllib.parse.urlparse(self.url)
return u.netloc in [
'chromium.googlesource.com',
'chrome-internal.googlesource.com']