Revert "Remove py batch wrappers from root dir"
This reverts commit 0e8b3107e056f22f04ed82d6906560e7dd83baae.
Reason for revert: wrappers aren't being created in python2-bin, other disruptions
Original change's description:
> 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/+/2742181
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Bug: 777069
Change-Id: Ieaadb032249fa5d6eea39668355c0c7de06dfbeb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2747702
Auto-Submit: Dirk Pranke <dpranke@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py
index 6f60205..3966588 100644
--- a/bootstrap/bootstrap.py
+++ b/bootstrap/bootstrap.py
@@ -228,20 +228,15 @@
that is using the bootstrapped Python!
"""
root_contents = os.listdir(ROOT_DIR)
- cleanup_paths = ('win_tools-*_bin', 'python27*_bin', 'git-*_bin',
- 'bootstrap-*_bin', 'python.bat', 'python3.bat')
- for f in cleanup_paths:
+ for f in ('win_tools-*_bin', 'python27*_bin', 'git-*_bin', 'bootstrap-*_bin'):
for entry in fnmatch.filter(root_contents, f):
full_entry = os.path.join(ROOT_DIR, entry)
- if full_entry == skip_dir:
+ if full_entry == skip_dir or not os.path.isdir(full_entry):
continue
logging.info('Cleaning up old installation %r', entry)
if not _toolchain_in_use(full_entry):
- if os.path.isdir(full_entry):
- _safe_rmtree(full_entry)
- else:
- os.remove(full_entry)
+ _safe_rmtree(full_entry)
else:
logging.info('Toolchain at %r is in-use; skipping', full_entry)
@@ -326,6 +321,8 @@
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.
diff --git a/git-runhooks b/git-runhooks
index e487447..5bb503e 100755
--- a/git-runhooks
+++ b/git-runhooks
@@ -15,7 +15,7 @@
kernel_name=$(uname -s)
if [ "${kernel_name:0:5}" = "MINGW" ]; then
dir="${0%\\*}"
- cmd "/C ${dir}\\python2-bin\\python.bat ${dir}\\gclient.py runhooks --spec=$gclient_spec"
+ cmd "/C ${dir}\\python.bat ${dir}\\gclient.py runhooks --spec=$gclient_spec"
else
dir="$(dirname $0)"
PYTHONDONTWRITEBYTECODE=1 exec python "$dir/gclient.py" runhooks --spec="$gclient_spec"
diff --git a/vpython.bat b/vpython.bat
index a5c7d63..ca5fe39 100644
--- a/vpython.bat
+++ b/vpython.bat
@@ -3,10 +3,5 @@
:: 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\%PYTHON2_BIN_RELDIR%\python.exe" %*
+"%~dp0\.cipd_bin\vpython.exe" -vpython-interpreter "%~dp0\python.bat" %*