From 851c8291a3eb25a73b32a070b1e50cd03a2a189e Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Wed, 12 Aug 2015 14:24:38 +0000 Subject: [PATCH] Fix gclient to work on a path containing space characters Patch contributed by Leung Wing Chung . Committed on his behalf due to Commit Queue's mishandling of CRLF files. Here is my procedure for testing for a new install 1. Download and unzip https://src.chromium.org/svn/trunk/tools/depot_tools.zip Note that the path should include a space character, e.g. "with a space" 2. Copy the three modified files to the unzipped folder 3. Convert the unzipped files into Windows CRLF. 4. REMOVE the following lines from update_depot_tools.bat (Should I file a separate bug for this?) :: Initialize/update virtualenv. cd /d "%DEPOT_TOOLS_DIR%." python -u bootstrap\bootstrap.py --deps_file bootstrap\deps.pyl --quiet ENV if errorlevel 1 goto :EOF 5. Run gclient. Installation should be okay until "git rebase" is run. R=maruel@chromium.org BUG=507301 Review URL: https://codereview.chromium.org/1232023004 . git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@296275 0039d316-1c4b-4281-b951-d872f2087c98 --- bootstrap/win/win_tools.bat | 4 ++-- gclient.bat | 4 ++-- update_depot_tools.bat | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bootstrap/win/win_tools.bat b/bootstrap/win/win_tools.bat index 278376fcc..02a1b310b 100644 --- a/bootstrap/win/win_tools.bat +++ b/bootstrap/win/win_tools.bat @@ -68,8 +68,8 @@ if %VERMAJOR% lss 5 set GIT_VERSION=%GIT_VERSION%-xp if %VERMAJOR% equ 5 if %VERMINOR% lss 2 set GIT_VERSION=%GIT_VERSION%-xp :: Clean up any release which doesn't match the one we want. -for /d %%i in (%WIN_TOOLS_ROOT_DIR%\git-*_bin) do ( - if not %%i == %WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin ( +for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do ( + if not "%%i" == "%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin" ( rmdir /s /q "%%i" ) ) diff --git a/gclient.bat b/gclient.bat index d73e64197..30a002628 100755 --- a/gclient.bat +++ b/gclient.bat @@ -8,7 +8,7 @@ setlocal PATH=%~dp0;%PATH% :: Synchronize the root directory before deferring control back to gclient.py. -call "%~dp0\update_depot_tools.bat" %* +call "%~dp0update_depot_tools.bat" %* :: Defer control. -%~dp0python "%~dp0\gclient.py" %* +"%~dp0python" "%~dp0gclient.py" %* diff --git a/update_depot_tools.bat b/update_depot_tools.bat index 983a29e5f..59744932d 100644 --- a/update_depot_tools.bat +++ b/update_depot_tools.bat @@ -10,13 +10,13 @@ setlocal :: Windows freaks out if a file is overwritten while it's being executed. Copy :: this script off to a temporary location and reinvoke from there before :: running any svn or git commands. -IF %~nx0==update_depot_tools.bat ( - COPY /Y %~dp0update_depot_tools.bat %TEMP%\update_depot_tools_tmp.bat >nul +IF "%~nx0"=="update_depot_tools.bat" ( + COPY /Y "%~dp0update_depot_tools.bat" "%TEMP%\update_depot_tools_tmp.bat" >nul if errorlevel 1 goto :EOF - %TEMP%\update_depot_tools_tmp.bat %~dp0 %* + "%TEMP%\update_depot_tools_tmp.bat" "%~dp0" %* ) -set DEPOT_TOOLS_DIR=%1 +set DEPOT_TOOLS_DIR=%~1 SHIFT set GIT_URL=https://chromium.googlesource.com/chromium/tools/depot_tools.git