| OLD | NEW |
| 1 @echo off | 1 @echo off |
| 2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 :: Use of this source code is governed by a BSD-style license that can be | 3 :: Use of this source code is governed by a BSD-style license that can be |
| 4 :: found in the LICENSE file. | 4 :: found in the LICENSE file. |
| 5 | 5 |
| 6 :: This script will try to find if svn and python are accessible and it not, | 6 :: This script will try to find if svn and python are accessible and it not, |
| 7 :: it will try to download it and 'install' it in depot_tools. | 7 :: it will try to download it and 'install' it in depot_tools. |
| 8 | 8 |
| 9 :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly | 9 :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly |
| 10 :: returned. | 10 :: returned. |
| 11 | 11 |
| 12 set WIN_TOOLS_ROOT_URL=https://src.chromium.org/svn/trunk/tools | 12 set WIN_TOOLS_ROOT_URL=https://src.chromium.org/svn/trunk/tools |
| 13 :: It used to be %~dp0 but ADODB.Stream may fail to write to this directory if | 13 :: It used to be %~dp0 but ADODB.Stream may fail to write to this directory if |
| 14 :: the directory DACL is set to elevated integrity level. | 14 :: the directory DACL is set to elevated integrity level. |
| 15 set ZIP_DIR=%TEMP% | 15 set ZIP_DIR=%TEMP% |
| 16 | 16 |
| 17 :: Get absolute root directory (.js scripts don't handle relative paths well). | 17 :: Get absolute root directory (.js scripts don't handle relative paths well). |
| 18 pushd %~dp0..\.. | 18 pushd %~dp0..\.. |
| 19 set WIN_TOOLS_ROOT_DIR=%CD% | 19 set WIN_TOOLS_ROOT_DIR=%CD% |
| 20 popd | 20 popd |
| 21 | 21 |
| 22 if "%1" == "force" ( | 22 if "%1" == "force" ( |
| 23 set WIN_TOOLS_FORCE=1 | 23 set WIN_TOOLS_FORCE=1 |
| 24 shift /1 | 24 shift /1 |
| 25 ) | 25 ) |
| 26 | 26 |
| 27 | 27 |
| 28 :PYTHON_CHECK |
| 29 if not exist "%WIN_TOOLS_ROOT_DIR%\python276_bin" goto :PY27_INSTALL |
| 30 if not exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :PY27_INSTALL |
| 31 set ERRORLEVEL=0 |
| 32 goto :GIT_CHECK |
| 33 |
| 34 |
| 35 :PY27_INSTALL |
| 36 echo Installing python 2.7.6... |
| 37 :: Cleanup python directory if it was existing. |
| 38 if exist "%WIN_TOOLS_ROOT_DIR%\python276_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\p
ython276_bin" |
| 39 if exist "%ZIP_DIR%\python276.zip" del "%ZIP_DIR%\python276.zip" |
| 40 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/python276_bin.zip |
| 41 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/python276_bin.zip "%ZIP_DIR%\python276_bin.zip" |
| 42 if errorlevel 1 goto :PYTHON_FAIL |
| 43 :: Will create python276_bin\... |
| 44 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\python276_bin.zip" "%WIN
_TOOLS_ROOT_DIR%" |
| 45 :: Create the batch files. |
| 46 call copy /y "%~dp0python276.new.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul |
| 47 call copy /y "%~dp0pylint.new.bat" "%WIN_TOOLS_ROOT_DIR%\pylint.bat" 1>nul |
| 48 del "%ZIP_DIR%\python276_bin.zip" |
| 49 set ERRORLEVEL=0 |
| 50 goto :GIT_CHECK |
| 51 |
| 52 |
| 53 :PYTHON_FAIL |
| 54 echo ... Failed to checkout python automatically. |
| 55 echo Please visit http://python.org to download the latest python 2.7.x client b
efore |
| 56 echo continuing. |
| 57 echo You can also get the "prebaked" version used at %WIN_TOOLS_ROOT_URL%/third_
party/ |
| 58 set ERRORLEVEL=1 |
| 59 goto :END |
| 60 |
| 61 |
| 62 |
| 28 :GIT_CHECK | 63 :GIT_CHECK |
| 29 if "%DEPOT_TOOLS_GIT_1852%" == "1" goto :GIT_1852_CHECK | 64 if "%DEPOT_TOOLS_GIT_1852%" == "1" goto :GIT_1852_CHECK |
| 30 :: Our new build of git doesn't work on some systems (e.g. uses newer APIs than | 65 :: Our new build of git doesn't work on some systems (e.g. uses newer APIs than |
| 31 :: available in XP), so force systems back to the old git while the failures | 66 :: available in XP), so force systems back to the old git while the failures |
| 32 :: are investigated, unless the new git was explicitly requested above. | 67 :: are investigated, unless the new git was explicitly requested above. |
| 33 goto :GIT_180_FORCE | 68 goto :GIT_180_FORCE |
| 34 | 69 |
| 35 | 70 |
| 36 :GIT_1852_CHECK | 71 :GIT_1852_CHECK |
| 37 set GIT_VERSION=1.8.5.2.chromium.1 | 72 set GIT_VERSION=1.8.5.2.chromium.1 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 echo ... Failed to checkout git automatically. | 141 echo ... Failed to checkout git automatically. |
| 107 echo Please visit http://code.google.com/p/msysgit to download the latest git | 142 echo Please visit http://code.google.com/p/msysgit to download the latest git |
| 108 echo client before continuing. | 143 echo client before continuing. |
| 109 echo You can also get the "prebaked" version used at %GIT_ZIP_URL% | 144 echo You can also get the "prebaked" version used at %GIT_ZIP_URL% |
| 110 set ERRORLEVEL=1 | 145 set ERRORLEVEL=1 |
| 111 goto :END | 146 goto :END |
| 112 | 147 |
| 113 | 148 |
| 114 :SVN_CHECK | 149 :SVN_CHECK |
| 115 :: If the batch file exists, skip the svn check. | 150 :: If the batch file exists, skip the svn check. |
| 116 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :PYTHON_CHECK | 151 if exist "%WIN_TOOLS_ROOT_DIR%\svn.bat" goto :END |
| 117 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL | 152 if "%WIN_TOOLS_FORCE%" == "1" goto :SVN_INSTALL |
| 118 call svn --version 2>nul 1>nul | 153 call svn --version 2>nul 1>nul |
| 119 if errorlevel 1 goto :SVN_INSTALL | 154 if errorlevel 1 goto :SVN_INSTALL |
| 120 goto :PYTHON_CHECK | 155 goto :END |
| 121 | 156 |
| 122 | 157 |
| 123 :SVN_INSTALL | 158 :SVN_INSTALL |
| 124 echo Installing subversion ... | 159 echo Installing subversion ... |
| 125 :: svn is not accessible; check it out and create 'proxy' files. | 160 :: svn is not accessible; check it out and create 'proxy' files. |
| 126 if exist "%ZIP_DIR%\svn.zip" del "%ZIP_DIR%\svn.zip" | 161 if exist "%ZIP_DIR%\svn.zip" del "%ZIP_DIR%\svn.zip" |
| 127 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/svn_bin.zip | 162 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/svn_bin.zip |
| 128 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/svn_bin.zip "%ZIP_DIR%\svn.zip" | 163 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/svn_bin.zip "%ZIP_DIR%\svn.zip" |
| 129 if errorlevel 1 goto :SVN_FAIL | 164 if errorlevel 1 goto :SVN_FAIL |
| 130 :: Cleanup svn directory if it was existing. | 165 :: Cleanup svn directory if it was existing. |
| 131 if exist "%WIN_TOOLS_ROOT_DIR%\svn\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\svn" | 166 if exist "%WIN_TOOLS_ROOT_DIR%\svn\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\svn" |
| 132 if exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\svn_bin
" | 167 if exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\svn_bin
" |
| 133 :: Will create svn_bin\... | 168 :: Will create svn_bin\... |
| 134 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\svn.zip" "%WIN_TOOLS_ROO
T_DIR%" | 169 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\svn.zip" "%WIN_TOOLS_ROO
T_DIR%" |
| 135 if errorlevel 1 goto :SVN_FAIL | 170 if errorlevel 1 goto :SVN_FAIL |
| 136 if not exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." goto :SVN_FAIL | 171 if not exist "%WIN_TOOLS_ROOT_DIR%\svn_bin\." goto :SVN_FAIL |
| 137 del "%ZIP_DIR%\svn.zip" | 172 del "%ZIP_DIR%\svn.zip" |
| 138 :: Create the batch file. | 173 :: Create the batch file. |
| 139 call copy /y "%~dp0svn.new.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul | 174 call copy /y "%~dp0svn.new.bat" "%WIN_TOOLS_ROOT_DIR%\svn.bat" 1>nul |
| 140 call copy /y "%~dp0svnversion.new.bat" "%WIN_TOOLS_ROOT_DIR%\svnversion.bat" 1>n
ul | 175 call copy /y "%~dp0svnversion.new.bat" "%WIN_TOOLS_ROOT_DIR%\svnversion.bat" 1>n
ul |
| 141 goto :PYTHON_CHECK | 176 goto :END |
| 142 | 177 |
| 143 | 178 |
| 144 :SVN_FAIL | 179 :SVN_FAIL |
| 145 echo ... Failed to checkout svn automatically. | 180 echo ... Failed to checkout svn automatically. |
| 146 echo Please visit http://subversion.tigris.org to download the latest subversion
client | 181 echo Please visit http://subversion.tigris.org to download the latest subversion
client |
| 147 echo before continuing. | 182 echo before continuing. |
| 148 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third
_party/ | 183 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third
_party/ |
| 149 set ERRORLEVEL=1 | 184 set ERRORLEVEL=1 |
| 150 goto :END | 185 goto :END |
| 151 | 186 |
| 152 | 187 |
| 153 :PYTHON_CHECK | |
| 154 :: Note: while the variable talks about 2.7.5, we are now installing 2.7.6. | |
| 155 :: Sorry for the confusion. :( | |
| 156 if "%DEPOT_TOOLS_PYTHON_275%" == "0" goto :PY26_CHECK | |
| 157 if "%DEPOT_TOOLS_PYTHON_27%" == "0" goto :PY26_CHECK | |
| 158 goto :PY27_CHECK | |
| 159 | |
| 160 | |
| 161 :PY26_CHECK | |
| 162 if not exist "%WIN_TOOLS_ROOT_DIR%\python_bin" goto :PY26_INSTALL | |
| 163 if not exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :PY26_INSTALL | |
| 164 set ERRORLEVEL=0 | |
| 165 goto :END | |
| 166 | |
| 167 | |
| 168 :PY27_CHECK | |
| 169 if not exist "%WIN_TOOLS_ROOT_DIR%\python276_bin" goto :PY27_INSTALL | |
| 170 if not exist "%WIN_TOOLS_ROOT_DIR%\python.bat" goto :PY27_INSTALL | |
| 171 set ERRORLEVEL=0 | |
| 172 goto :END | |
| 173 | |
| 174 | |
| 175 :PY27_INSTALL | |
| 176 echo Installing python 2.7.6... | |
| 177 :: Cleanup python directory if it was existing. | |
| 178 if exist "%WIN_TOOLS_ROOT_DIR%\python276_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\p
ython276_bin" | |
| 179 if exist "%ZIP_DIR%\python276.zip" del "%ZIP_DIR%\python276.zip" | |
| 180 echo Fetching from %WIN_TOOLS_ROOT_URL%/third_party/python276_bin.zip | |
| 181 cscript //nologo //e:jscript "%~dp0get_file.js" %WIN_TOOLS_ROOT_URL%/third_party
/python276_bin.zip "%ZIP_DIR%\python276_bin.zip" | |
| 182 if errorlevel 1 goto :PYTHON_FAIL | |
| 183 :: Will create python276_bin\... | |
| 184 cscript //nologo //e:jscript "%~dp0unzip.js" "%ZIP_DIR%\python276_bin.zip" "%WIN
_TOOLS_ROOT_DIR%" | |
| 185 :: Create the batch files. | |
| 186 call copy /y "%~dp0python276.new.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul | |
| 187 call copy /y "%~dp0pylint.new.bat" "%WIN_TOOLS_ROOT_DIR%\pylint.bat" 1>nul | |
| 188 del "%ZIP_DIR%\python276_bin.zip" | |
| 189 set ERRORLEVEL=0 | |
| 190 goto :END | |
| 191 | |
| 192 | |
| 193 :PY26_INSTALL | |
| 194 echo Installing python 2.6... | |
| 195 :: Cleanup python directory if it was existing. | |
| 196 if exist "%WIN_TOOLS_ROOT_DIR%\python_bin\." rd /q /s "%WIN_TOOLS_ROOT_DIR%\pyth
on_bin" | |
| 197 call svn co -q %WIN_TOOLS_ROOT_URL%/third_party/python_26 "%WIN_TOOLS_ROOT_DIR%\
python_bin" | |
| 198 if errorlevel 1 goto :PYTHON_FAIL | |
| 199 :: Create the batch files. | |
| 200 call copy /y "%~dp0python.new.bat" "%WIN_TOOLS_ROOT_DIR%\python.bat" 1>nul | |
| 201 call copy /y "%~dp0pylint.new.bat" "%WIN_TOOLS_ROOT_DIR%\pylint.bat" 1>nul | |
| 202 set ERRORLEVEL=0 | |
| 203 goto :END | |
| 204 | |
| 205 | |
| 206 :PYTHON_FAIL | |
| 207 echo ... Failed to checkout python automatically. | |
| 208 echo Please visit http://python.org to download the latest python 2.7.x client b
efore | |
| 209 echo continuing. | |
| 210 echo You can also get the "prebacked" version used at %WIN_TOOLS_ROOT_URL%/third
_party/ | |
| 211 set ERRORLEVEL=1 | |
| 212 goto :END | |
| 213 | |
| 214 | |
| 215 :returncode | 188 :returncode |
| 216 set WIN_TOOLS_ROOT_URL= | 189 set WIN_TOOLS_ROOT_URL= |
| 217 set WIN_TOOLS_ROOT_DIR= | 190 set WIN_TOOLS_ROOT_DIR= |
| 218 exit /b %ERRORLEVEL% | 191 exit /b %ERRORLEVEL% |
| 219 | 192 |
| 220 :END | 193 :END |
| 221 call :returncode %ERRORLEVEL% | 194 call :returncode %ERRORLEVEL% |
| OLD | NEW |