You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_tools/bootstrap/win/python27.new.bat

47 lines
2.1 KiB
Batchfile

[win_tools] Use bundled Python CIPD packages (#2). Re-land of bf1446791e4b1c5b102559de9fb090ed5ba50cf5. Enable bundled Python CIPD packages in bleeding-edge mode. This replaces the ZIP unpacking approach used before, and introduces validation and management through the CIPD tool. The bleeding edge version will only install if a sentinel file is present in the "depot_tools" root; otherwise, default behavior will continue. This method adds a upgrade and downgrade path to/from ZIP and CIPD installations. This is done by rewriting the "win_tools.bat" process: 1) Ensure that a bootstrap Python is present. 2) Use it to run "win_tools.py", which has the functionality of "git_bootstrap.py" plus Python installation. 3) Run "win_tools.py" with appropriate flags. Some tricks were employed to handle cases where there is an already-running Python instance that uses the current Python installation and executable. This happens on bots because the system uses the same "depot_tools" checkout at multiple launch layers. To this end, we use the "python.bat" as the "current Python" authority and refrain from cleaning up old Python directories if their "python.exe" binaries are currently in use. We change the Git bleeding edge file to share the same sentinel file as Python, ".bleeding_edge". The new Python should have the same facilities as the original Python bundle. BUG=chromium:740171 TEST=local Change-Id: I51ba6415c60b95c2aaba94b6e21bd9b3fc82f35d Reviewed-on: https://chromium-review.googlesource.com/568524 Reviewed-by: Robbie Iannucci <iannucci@chromium.org> Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
8 years ago
@echo off
:: Copyright 2017 The Chromium Authors. All rights reserved.
:: Use of this source code is governed by a BSD-style license that can be
:: found in the LICENSE file.
setlocal
set PYTHON_BAT_RUNNER=1
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This file is automatically generated by "bootstrap\win\win_tools.py", and
:: should not be modified.
::
:: The previous "::" block acts as a nop-sled. Each time a batch file executes
:: a command, it reloads itself and seeks to its previous execution offset to
:: begin execution. Updating this batch file is, therefore, risky, since any
:: running Python instance that is using the old batch file will reload the new
:: batch file once the Python command terminates and resume at some unknown
:: offset.
::
:: With the sled in place, a previous instance will resume mid-label. We are
:: assuming that the offset of the Python invocation is greater than the
:: PYTHON_BAT_RUNNER set command, which is the case since the old instance has
:: a large PATH set block before the Python execution. Old instances will hit
:: the next block of code without PYTHON_BAT_RUNNER set. New instances will have
:: it set.
::
:: We remedy this in the future by having the batch file load its core paths
:: from an external file with for/set, removing the need to modify "python.bat"
[win_tools] Use bundled Python CIPD packages (#2). Re-land of bf1446791e4b1c5b102559de9fb090ed5ba50cf5. Enable bundled Python CIPD packages in bleeding-edge mode. This replaces the ZIP unpacking approach used before, and introduces validation and management through the CIPD tool. The bleeding edge version will only install if a sentinel file is present in the "depot_tools" root; otherwise, default behavior will continue. This method adds a upgrade and downgrade path to/from ZIP and CIPD installations. This is done by rewriting the "win_tools.bat" process: 1) Ensure that a bootstrap Python is present. 2) Use it to run "win_tools.py", which has the functionality of "git_bootstrap.py" plus Python installation. 3) Run "win_tools.py" with appropriate flags. Some tricks were employed to handle cases where there is an already-running Python instance that uses the current Python installation and executable. This happens on bots because the system uses the same "depot_tools" checkout at multiple launch layers. To this end, we use the "python.bat" as the "current Python" authority and refrain from cleaning up old Python directories if their "python.exe" binaries are currently in use. We change the Git bleeding edge file to share the same sentinel file as Python, ".bleeding_edge". The new Python should have the same facilities as the original Python bundle. BUG=chromium:740171 TEST=local Change-Id: I51ba6415c60b95c2aaba94b6e21bd9b3fc82f35d Reviewed-on: https://chromium-review.googlesource.com/568524 Reviewed-by: Robbie Iannucci <iannucci@chromium.org> Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
8 years ago
:: during upgrade.
::
:: After all of the old batch files are believed to be replaced, we can remove
:: the PYTHON_BAT_RUNNER block and the sled. For this update, old instances
:: will resume past the end of the file and terminate.
if not "%PYTHON_BAT_RUNNER%" == "1" goto :END
for /f %%i in (%~dp0python_bin_reldir.txt) do set PYTHON_BIN_RELDIR=%%i
[win_tools] Use bundled Python CIPD packages (#2). Re-land of bf1446791e4b1c5b102559de9fb090ed5ba50cf5. Enable bundled Python CIPD packages in bleeding-edge mode. This replaces the ZIP unpacking approach used before, and introduces validation and management through the CIPD tool. The bleeding edge version will only install if a sentinel file is present in the "depot_tools" root; otherwise, default behavior will continue. This method adds a upgrade and downgrade path to/from ZIP and CIPD installations. This is done by rewriting the "win_tools.bat" process: 1) Ensure that a bootstrap Python is present. 2) Use it to run "win_tools.py", which has the functionality of "git_bootstrap.py" plus Python installation. 3) Run "win_tools.py" with appropriate flags. Some tricks were employed to handle cases where there is an already-running Python instance that uses the current Python installation and executable. This happens on bots because the system uses the same "depot_tools" checkout at multiple launch layers. To this end, we use the "python.bat" as the "current Python" authority and refrain from cleaning up old Python directories if their "python.exe" binaries are currently in use. We change the Git bleeding edge file to share the same sentinel file as Python, ".bleeding_edge". The new Python should have the same facilities as the original Python bundle. BUG=chromium:740171 TEST=local Change-Id: I51ba6415c60b95c2aaba94b6e21bd9b3fc82f35d Reviewed-on: https://chromium-review.googlesource.com/568524 Reviewed-by: Robbie Iannucci <iannucci@chromium.org> Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
8 years ago
set PATH=%~dp0%PYTHON_BIN_RELDIR%;%~dp0%PYTHON_BIN_RELDIR%\Scripts;%PATH%
"%~dp0%PYTHON_BIN_RELDIR%\python.exe" %*
:END