mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
Revert "Drop py2 support in gerrit and git related files"
This reverts commit b5c7f4b46c.
Reason for revert: missing a replace for urlparse.urlparse
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: Idd00fdfe0b3d62785da2789a7dfcc9fbc79b6385
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811623
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
15
git_cache.py
15
git_cache.py
@@ -5,7 +5,10 @@
|
||||
|
||||
"""A git command for managing a local cache of git repositories."""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import contextlib
|
||||
import errno
|
||||
import logging
|
||||
import optparse
|
||||
import os
|
||||
@@ -15,7 +18,11 @@ import sys
|
||||
import tempfile
|
||||
import threading
|
||||
import time
|
||||
import urllib.parse
|
||||
|
||||
try:
|
||||
import urlparse
|
||||
except ImportError: # For Py3 compatibility
|
||||
import urllib.parse as urlparse
|
||||
|
||||
from download_from_google_storage import Gsutil
|
||||
import gclient_utils
|
||||
@@ -135,7 +142,7 @@ class Mirror(object):
|
||||
b = os.getenv('OVERRIDE_BOOTSTRAP_BUCKET')
|
||||
if b:
|
||||
return b
|
||||
u = urllib.parse.urlparse(self.url)
|
||||
u = urlparse.urlparse(self.url)
|
||||
if u.netloc == 'chromium.googlesource.com':
|
||||
return 'chromium-git-cache'
|
||||
# Not recognized.
|
||||
@@ -157,7 +164,7 @@ class Mirror(object):
|
||||
url = os.path.splitdrive(url)[1]
|
||||
return url.replace('-', '--').replace(os.sep, '-')
|
||||
|
||||
parsed = urllib.parse.urlparse(url)
|
||||
parsed = urlparse.urlparse(url)
|
||||
norm_url = parsed.netloc + parsed.path
|
||||
if norm_url.endswith('.git'):
|
||||
norm_url = norm_url[:-len('.git')]
|
||||
@@ -352,7 +359,7 @@ class Mirror(object):
|
||||
|
||||
def supported_project(self):
|
||||
"""Returns true if this repo is known to have a bootstrap zip file."""
|
||||
u = urllib.parse.urlparse(self.url)
|
||||
u = urlparse.urlparse(self.url)
|
||||
return u.netloc in [
|
||||
'chromium.googlesource.com',
|
||||
'chrome-internal.googlesource.com']
|
||||
|
||||
Reference in New Issue
Block a user