Remove last py2 workarounds
python3 is the only supported version of python in depot_tools.
Changes include:
* updating python version requirements
* removing third_party/six
Bug: 1475402
Change-Id: Ib86231413fcac494ceb27d1783e53b9d86533c26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4845292
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
diff --git a/git_cl.py b/git_cl.py
index 5ba2f4c..932b89f 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -24,6 +24,8 @@
import tempfile
import textwrap
import time
+import urllib.parse
+import urllib.request
import uuid
import webbrowser
import zlib
@@ -59,7 +61,6 @@
import swift_format
import watchlists
-from six.moves import urllib
__version__ = '2.0'
@@ -6436,7 +6437,9 @@
tool_dir = os.path.join(top_dir, xml_dir)
pretty_print_tool = os.path.join(tool_dir, 'pretty_print.py')
- cmd = ['vpython3', pretty_print_tool, '--non-interactive']
+ cmd = [
+ shutil.which('vpython3'), pretty_print_tool, '--non-interactive'
+ ]
# If the XML file is histograms.xml or enums.xml, add the xml path
# to the command as histograms/pretty_print.py now needs a relative
@@ -6458,12 +6461,7 @@
if opts.dry_run or opts.diff:
cmd.append('--diff')
- # TODO(isherman): Once this file runs only on Python 3.3+, drop the
- # `shell` param and instead replace `'vpython'` with
- # `shutil.which('frob')` above: https://stackoverflow.com/a/32799942
- stdout = RunCommand(cmd,
- cwd=top_dir,
- shell=sys.platform.startswith('win32'))
+ stdout = RunCommand(cmd, cwd=top_dir)
if opts.diff:
sys.stdout.write(stdout)
if opts.dry_run and stdout:
@@ -6616,7 +6614,7 @@
def main(argv):
- if sys.hexversion < 0x02060000:
+ if sys.version_info[0] < 3:
print('\nYour Python version %s is unsupported, please upgrade.\n' %
(sys.version.split(' ', 1)[0], ),
file=sys.stderr)