From 4cb9d7422d545a9a08d544e07a9565b8c3fb9e60 Mon Sep 17 00:00:00 2001 From: Dan Jacques Date: Tue, 11 Jul 2017 00:09:53 +0000 Subject: [PATCH] [bootstrap/win] Enable revert from upcoming patch. The upcoming CL, https://chromium-review.googlesource.com/c/563036, updates "bootstrap/win"'s mechanism. However, if that patch needs to be reverted, its "python.bat" stub may still exist in the reverted repository, and will continue to point to the reverted toolchain. We don't have a good way to detect whether we should revert "python.bat". Instead, we will look a file generated by the CL, "//python_bin_reldir.txt". If we find it, we will assume that the updated "python.bat" is in use, and reinstall. Note that if that CL lands and does not require a revert, this logic will be deleted. It's just there as a safety mechanism to allow a safe revert. BUG=chromium:740171 TEST=local Change-Id: Ifc638cf0512d2a889c37fbf6b8e3f7a3269331b1 Reviewed-on: https://chromium-review.googlesource.com/566073 Commit-Queue: Daniel Jacques Reviewed-by: Robbie Iannucci --- bootstrap/win/win_tools.bat | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bootstrap/win/win_tools.bat b/bootstrap/win/win_tools.bat index 36cdc578ad..de121f9816 100644 --- a/bootstrap/win/win_tools.bat +++ b/bootstrap/win/win_tools.bat @@ -26,6 +26,18 @@ if "%1" == "force" ( :PYTHON_CHECK +:: Support revert from https://chromium-review.googlesource.com/c/563036 +:: +:: If the "python.bat" from that CL is installed, we will not know to +:: replace it if the CL is reverted. To support this, we will actively +:: destroy our "python.bat" if we detect a "python_bin_reldir.txt" file +:: present, causing us to reinstall Python. +if exist "%WIN_TOOLS_ROOT_DIR%\python_bin_reldir.txt" ( + del "%WIN_TOOLS_ROOT_DIR%\python.bat" + del "%WIN_TOOLS_ROOT_DIR%\python_bin_reldir.txt" + goto :PY27_INSTALL +) + if not exist "%WIN_TOOLS_ROOT_DIR%\python276_bin" goto :PY27_INSTALL if not exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :PY27_INSTALL set ERRORLEVEL=0