Commit 0e8b3107 authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

Remove py batch wrappers from root dir

This removes python.bat and python3.bat batch wrappers from root of this
repository. This change brings Windows set up closer to unix.

depot_tools provides batch wrappers in python-bin and python2-bin
directories and user can opt in to use it by adding them to PATH.

Bug: 777069
Change-Id: Ie7571a49f940e7a69b6c18779499c39aee94d06a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2742181Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: 's avatarDirk Pranke <dpranke@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
parent 1f9fc8b2
......@@ -228,15 +228,20 @@ def clean_up_old_installations(skip_dir):
that is using the bootstrapped Python!
"""
root_contents = os.listdir(ROOT_DIR)
for f in ('win_tools-*_bin', 'python27*_bin', 'git-*_bin', 'bootstrap-*_bin'):
cleanup_paths = ('win_tools-*_bin', 'python27*_bin', 'git-*_bin',
'bootstrap-*_bin', 'python.bat', 'python3.bat')
for f in cleanup_paths:
for entry in fnmatch.filter(root_contents, f):
full_entry = os.path.join(ROOT_DIR, entry)
if full_entry == skip_dir or not os.path.isdir(full_entry):
if full_entry == skip_dir:
continue
logging.info('Cleaning up old installation %r', entry)
if not _toolchain_in_use(full_entry):
_safe_rmtree(full_entry)
if os.path.isdir(full_entry):
_safe_rmtree(full_entry)
else:
os.remove(full_entry)
else:
logging.info('Toolchain at %r is in-use; skipping', full_entry)
......@@ -321,8 +326,6 @@ def main(argv):
git_postprocess(template, os.path.join(bootstrap_dir, 'git'))
templates = [
('git-bash.template.sh', 'git-bash', ROOT_DIR),
('python27.bat', 'python.bat', ROOT_DIR),
('python3.bat', 'python3.bat', ROOT_DIR),
]
for src_name, dst_name, dst_dir in templates:
# Re-evaluate and regenerate our root templated files.
......
......@@ -15,7 +15,7 @@ gclient_spec="solutions=[{'name':'src','url':None,'deps_file':'.DEPS.git'}]"
kernel_name=$(uname -s)
if [ "${kernel_name:0:5}" = "MINGW" ]; then
dir="${0%\\*}"
cmd "/C ${dir}\\python.bat ${dir}\\gclient.py runhooks --spec=$gclient_spec"
cmd "/C ${dir}\\python2-bin\\python.bat ${dir}\\gclient.py runhooks --spec=$gclient_spec"
else
dir="$(dirname $0)"
PYTHONDONTWRITEBYTECODE=1 exec python "$dir/gclient.py" runhooks --spec="$gclient_spec"
......
......@@ -3,5 +3,10 @@
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.
:: TODO(crbug.com/1003139): Remove.
:: Add Python 3 to PATH to work around crbug.com/1003139.
for /f %%i in (%~dp0python_bin_reldir.txt) do set PYTHON2_BIN_RELDIR=%%i
set PATH=%~dp0%PYTHON2_BIN_RELDIR%;%~dp0%PYTHON2_BIN_RELDIR%\Scripts;%~dp0%PYTHON2_BIN_RELDIR%\DLLs;%PATH%
call "%~dp0\cipd_bin_setup.bat" > nul 2>&1
"%~dp0\.cipd_bin\vpython.exe" -vpython-interpreter "%~dp0\python.bat" %*
"%~dp0\.cipd_bin\vpython.exe" -vpython-interpreter "%~dp0\%PYTHON2_BIN_RELDIR%\python.exe" %*
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