Commit 39120911 authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

Use py3 for remaining tools in depot_tools path

R=apolito@google.com, dpranke@google.com

Bug: 1199102
Change-Id: I06ff344ac91464eb558e92598c87e43ecfa830dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2994488
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: 's avatarAnthony Polito <apolito@google.com>
Reviewed-by: 's avatarDirk Pranke <dpranke@google.com>
parent 61c72651
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
base_dir=$(dirname "$0") base_dir=$(dirname "$0")
PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/cit.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec python3 "$base_dir/cit.py" "$@"
...@@ -9,4 +9,4 @@ setlocal ...@@ -9,4 +9,4 @@ setlocal
set PATH=%PATH%;%~dp0 set PATH=%PATH%;%~dp0
:: Defer control. :: Defer control.
python "%~dp0\cit.py" %* python3 "%~dp0\cit.py" %*
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright (c) 2015 The Chromium Authors. All rights reserved. # Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
base_dir=$(dirname "$0") base_dir=$(dirname "$0")
PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/clang_format.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec python3 "$base_dir/clang_format.py" "$@"
...@@ -9,4 +9,4 @@ setlocal ...@@ -9,4 +9,4 @@ setlocal
set PATH=%PATH%;%~dp0 set PATH=%PATH%;%~dp0
:: Defer control. :: Defer control.
python "%~dp0\clang_format.py" %* python3 "%~dp0\clang_format.py" %*
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright 2014 The Chromium Authors. All rights reserved. # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
base_dir=$(dirname "$0") base_dir=$(dirname "$0")
PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/clang_format_merge_driver.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec python3 "$base_dir/clang_format_merge_driver.py" "$@"
...@@ -9,4 +9,4 @@ setlocal ...@@ -9,4 +9,4 @@ setlocal
set PATH=%PATH%;%~dp0 set PATH=%PATH%;%~dp0
:: Defer control. :: Defer control.
python "%~dp0\clang_format_merge_driver.py" %* python3 "%~dp0\clang_format_merge_driver.py" %*
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright 2016 The Chromium Authors. All rights reserved. # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
base_dir=$(dirname "$0") base_dir=$(dirname "$0")
PYTHONDONTWRITEBYTECODE=1 exec python -u "$base_dir/compile_single_file.py" "$@" PYTHONDONTWRITEBYTECODE=1 exec python3 -u "$base_dir/compile_single_file.py" "$@"
...@@ -8,4 +8,4 @@ setlocal ...@@ -8,4 +8,4 @@ setlocal
:: standalone, but allow other PATH manipulations to take priority. :: standalone, but allow other PATH manipulations to take priority.
set PATH=%PATH%;%~dp0 set PATH=%PATH%;%~dp0
python -u "%~dp0compile_single_file.py" %* python3 -u "%~dp0compile_single_file.py" %*
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright 2017 The Chromium Authors. All rights reserved. # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
......
...@@ -15,9 +15,9 @@ gclient_spec="solutions=[{'name':'src','url':None,'deps_file':'.DEPS.git'}]" ...@@ -15,9 +15,9 @@ gclient_spec="solutions=[{'name':'src','url':None,'deps_file':'.DEPS.git'}]"
kernel_name=$(uname -s) kernel_name=$(uname -s)
if [ "${kernel_name:0:5}" = "MINGW" ]; then if [ "${kernel_name:0:5}" = "MINGW" ]; then
dir="${0%\\*}" dir="${0%\\*}"
cmd "/C ${dir}\\python.bat ${dir}\\gclient.py runhooks --spec=$gclient_spec" cmd "/C ${dir}\\python3.bat ${dir}\\gclient.py runhooks --spec=$gclient_spec"
else else
dir="$(dirname $0)" dir="$(dirname $0)"
PYTHONDONTWRITEBYTECODE=1 exec python "$dir/gclient.py" runhooks --spec="$gclient_spec" PYTHONDONTWRITEBYTECODE=1 exec python3 "$dir/gclient.py" runhooks --spec="$gclient_spec"
fi fi
exit $? exit $?
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
base_dir=$(dirname "$0") base_dir=$(dirname "$0")
exec python "$base_dir/fake_cipd.py" "$@" exec python3 "$base_dir/fake_cipd.py" "$@"
...@@ -5,4 +5,4 @@ echo off ...@@ -5,4 +5,4 @@ echo off
setlocal setlocal
:: Defer control. :: Defer control.
python "%~dp0fake_cipd.py" %* python3 "%~dp0fake_cipd.py" %*
#!/usr/bin/env python #!/usr/bin/env python3
# Copyright (c) 2018 The Chromium Authors. All rights reserved. # Copyright (c) 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import argparse import argparse
import io
import os import os
import re import re
import shutil import shutil
...@@ -20,8 +21,10 @@ def parse_cipd(root, contents): ...@@ -20,8 +21,10 @@ def parse_cipd(root, contents):
line = line.strip() line = line.strip()
match = re.match(CIPD_SUBDIR_RE, line) match = re.match(CIPD_SUBDIR_RE, line)
if match: if match:
print('match')
current_subdir = os.path.join(root, *match.group(1).split('/')) current_subdir = os.path.join(root, *match.group(1).split('/'))
elif line and current_subdir: elif line and current_subdir:
print('no match')
tree.setdefault(current_subdir, []).append(line) tree.setdefault(current_subdir, []).append(line)
return tree return tree
...@@ -33,15 +36,15 @@ def main(): ...@@ -33,15 +36,15 @@ def main():
parser.add_argument('-root') parser.add_argument('-root')
args, _ = parser.parse_known_args() args, _ = parser.parse_known_args()
with open(args.ensure_file) as f: with io.open(args.ensure_file, 'r', encoding='utf-8') as f:
new_content = parse_cipd(args.root, f.readlines()) new_content = parse_cipd(args.root, f.readlines())
# Install new packages # Install new packages
for path, packages in new_content.items(): for path, packages in new_content.items():
if not os.path.exists(path): if not os.path.exists(path):
os.makedirs(path) os.makedirs(path)
with open(os.path.join(path, '_cipd'), 'wb') as f: with io.open(os.path.join(path, '_cipd'), 'w', encoding='utf-8') as f:
f.write('\n'.join(packages).encode('utf-8', 'replace')) f.write('\n'.join(packages))
# Save the ensure file that we got # Save the ensure file that we got
shutil.copy(args.ensure_file, os.path.join(args.root, '_cipd')) shutil.copy(args.ensure_file, os.path.join(args.root, '_cipd'))
......
#!/usr/bin/env python #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (c) 2011 The Chromium Authors. All rights reserved. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
...@@ -11,6 +11,7 @@ from __future__ import print_function ...@@ -11,6 +11,7 @@ from __future__ import print_function
import atexit import atexit
import datetime import datetime
import errno import errno
import io
import logging import logging
import os import os
import pprint import pprint
...@@ -49,7 +50,8 @@ def read_tree(tree_root): ...@@ -49,7 +50,8 @@ def read_tree(tree_root):
for f in [join(root, f) for f in files if not f.startswith('.')]: for f in [join(root, f) for f in files if not f.startswith('.')]:
filepath = f[len(tree_root) + 1:].replace(os.sep, '/') filepath = f[len(tree_root) + 1:].replace(os.sep, '/')
assert len(filepath), f assert len(filepath), f
tree[filepath] = gclient_utils.FileRead(join(root, f)) with io.open(join(root, f), encoding='utf-8') as f:
tree[filepath] = f.read()
return tree return tree
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment