From ca4fdfd874678496dbae685b9e719fa9f124614d Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Thu, 10 Oct 2013 17:57:20 +0000 Subject: [PATCH] Add python 2.7.5 support on Windows. Not enabled by default. - Python2.7.5 will be installed only if DEPOT_TOOLS_PYTHON_275=1, otherwise 2.6 is installed. - Eventually the default will be changed to install python 2.7.5 for new users. - Afterward, python 2.7.5 will be always installed when not detected and 2.6 will be ignored. README.chromium contains the exact instructions how to recreate python275_bin.zip that was committed independently. I tested it on a vanilla Windows XP image and documented how to install the VC90 CRT redistributable in that specific case in README.chromium. R=iannucci@chromium.org BUG=241769,257696 Review URL: https://codereview.chromium.org/26326002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@227961 0039d316-1c4b-4281-b951-d872f2087c98 --- bootstrap/win/python275.new.bat | 8 ++++++++ bootstrap/win/win_tools.bat | 28 ++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 bootstrap/win/python275.new.bat diff --git a/bootstrap/win/python275.new.bat b/bootstrap/win/python275.new.bat new file mode 100644 index 0000000000..f57dd6c723 --- /dev/null +++ b/bootstrap/win/python275.new.bat @@ -0,0 +1,8 @@ +@echo off +:: Copyright 2013 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 PATH=%~dp0python275_bin;%~dp0python275_bin\Scripts;%PATH% +"%~dp0python275_bin\python.exe" %* diff --git a/bootstrap/win/win_tools.bat b/bootstrap/win/win_tools.bat index e2c9511227..9fa3d2d672 100644 --- a/bootstrap/win/win_tools.bat +++ b/bootstrap/win/win_tools.bat @@ -43,6 +43,7 @@ rmdir /S /Q "%WIN_TOOLS_ROOT_DIR%\%GIT_BIN_DIR%" echo Installing git (avg 1-2 min download) ... :: git is not accessible; check it out and create 'proxy' files. if exist "%~dp0git.zip" del "%~dp0git.zip" +echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/git-1.8.0_bin.zip cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party/git-1.8.0_bin.zip "%~dp0git.zip" if errorlevel 1 goto :GIT_FAIL :: Cleanup svn directory if it was existing. @@ -85,6 +86,7 @@ goto :PYTHON_CHECK echo Installing subversion ... :: svn is not accessible; check it out and create 'proxy' files. if exist "%~dp0svn.zip" del "%~dp0svn.zip" +echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/svn_bin.zip cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party/svn_bin.zip "%~dp0svn.zip" if errorlevel 1 goto :SVN_FAIL :: Cleanup svn directory if it was existing. @@ -124,7 +126,29 @@ goto :END :PYTHON_INSTALL -echo Installing python ... +if "%DEPOT_TOOLS_PYTHON_275%" == "1" goto :PY275_INSTALL +goto :PY26_INSTALL + + +:PY275_INSTALL +echo Installing python 2.7.5... +:: Cleanup python directory if it was existing. +if exist "%WIN_TOOLS_ROOT_DIR%\python275_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\python275_bin" +if exist "%~dp0python275.zip" del "%~dp0python275.zip" +echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/python275_bin.zip +cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party/python275_bin.zip "%~dp0python275_bin.zip" +if errorlevel 1 goto :PYTHON_FAIL +:: Will create python275_bin\... +cscript //nologo //e:jscript "%~dp0unzip.js" "%~dp0python275_bin.zip" "%WIN_TOOLS_ROOT_DIR%" +:: Create the batch files. +call copy /y "%~dp0python275.new.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul +call copy /y "%~dp0pylint.new.bat" "%WIN_TOOLS_ROOT_DIR%\pylint.bat" 1>nul +set ERRORLEVEL=0 +goto :END + + +:PY26_INSTALL +echo Installing python 2.6... :: Cleanup python directory if it was existing. if exist "%WIN_TOOLS_ROOT_DIR%\python_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\python_bin" call svn co -q %WIN_TOOLS_ROOT_URL%/third_party/python_26 "%WIN_TOOLS_ROOT_DIR%\python_bin" @@ -138,7 +162,7 @@ goto :END :PYTHON_FAIL echo ... Failed to checkout python automatically. -echo Please visit http://python.org to download the latest python 2.x client before +echo Please visit http://python.org to download the latest python 2.7.x client before echo continuing. echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third_party/ set ERRORLEVEL=1