Skip to content

Commit

Permalink
Allow dev init in a folder with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mingwandroid committed Mar 27, 2019
1 parent 9654407 commit fb7ac5f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
10 changes: 7 additions & 3 deletions conda/core/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,20 @@ def initialize_dev(shell, dev_env_prefix=None, conda_source_root=None):
]
print("\n".join(builder))
elif shell == 'cmd.exe':
if context.dev:
dev_arg = '--dev'
else:
dev_arg = ''
builder = []
builder += ["@IF NOT \"%CONDA_PROMPT_MODIFIER%\" == \"\" @CALL "
"SET \"PROMPT=%%PROMPT:%CONDA_PROMPT_MODIFIER%=%_empty_not_set_%%%\""]
builder += ["@SET %s=" % unset_env_var for unset_env_var in unset_env_vars]
builder += ['@SET "%s=%s"' % (key, env_vars[key]) for key in sorted(env_vars)]
builder += [
'@CALL \"%s\"' % join(dev_env_prefix, 'condabin', 'conda_hook.bat'),
'@CALL \"%s\" %s' % (join(dev_env_prefix, 'condabin', 'conda_hook.bat'), dev_arg),
'@IF %errorlevel% NEQ 0 @EXIT /B %errorlevel%',
'@CALL \"%s\" activate \"%s\"' % (join(dev_env_prefix, 'condabin', 'conda.bat'),
dev_env_prefix),
'@CALL \"%s\" activate %s \"%s\"' % (join(dev_env_prefix, 'condabin', 'conda.bat'),
dev_arg, dev_env_prefix),
'@IF %errorlevel% NEQ 0 @EXIT /B %errorlevel%',
]
if not context.dry_run:
Expand Down
2 changes: 1 addition & 1 deletion conda/shell/condabin/_conda_activate.bat
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@SETLOCAL EnableDelayedExpansion
@SET _sysp=%_sysp:~0,-1%
@SET PATH=%_sysp%;%_sysp%\Library\mingw-w64\bin;%_sysp%\Library\usr\bin;%_sysp%\Library\bin;%_sysp%\Scripts;%_sysp%\bin;%PATH%
@SET CONDA_EXES=%CONDA_EXE% %_CE_M% %_CE_CONDA%
@SET "CONDA_EXES=%CONDA_EXE% %_CE_M% %_CE_CONDA%"
@FOR /F %%i IN ('%CONDA_EXES% shell.cmd.exe %*') DO @SET "_TEMP_SCRIPT_PATH=%%i"
@FOR /F "delims=" %%A in (""!_TEMP_SCRIPT_PATH!"") DO @ENDLOCAL & @SET "_TEMP_SCRIPT_PATH=%%~A"
@IF "%_TEMP_SCRIPT_PATH%" == "" @EXIT /B 1
Expand Down
2 changes: 1 addition & 1 deletion conda/shell/condabin/conda.bat
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@SETLOCAL
@SET _sysp=%_sysp:~0,-1%
@SET PATH=%_sysp%;%_sysp%\Library\mingw-w64\bin;%_sysp%\Library\usr\bin;%_sysp%\Library\bin;%_sysp%\Scripts;%_sysp%\bin;%PATH%
@SET CONDA_EXES=%CONDA_EXE% %_CE_M% %_CE_CONDA%
@SET "CONDA_EXES=%CONDA_EXE% %_CE_M% %_CE_CONDA%"
@CALL %CONDA_EXES% %*
@ENDLOCAL

Expand Down
14 changes: 7 additions & 7 deletions dev/start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ conda install -y defaults::git
@ECHO exit at this point.

:ALREADY
call %devenv%\Scripts\activate.bat
call "%devenv%"\Scripts\activate.bat

@REM Unset some variables that get in the way
set CONDA_BAT=
Expand All @@ -36,12 +36,12 @@ set CONDA_SHLVL=
set PYTHONPATH=
set PYTHONHOME=

@ECHO ^>^> conda update -p %devenv% -yq --all
@CALL "%devenv%\Scripts\conda" update -p %devenv% -yq --all
@ECHO ^>^> conda install -yp \%devenv% defaults::git
@CALL "%devenv%\Scripts\conda" install -yp %devenv% defaults::git
@ECHO ^>^> conda install -yq -p %devenv% --file dev/test-requirements.txt -c defaults -c conda-forge
@CALL "%devenv%\Scripts\conda" install -yq -p %devenv% --file dev/test-requirements.txt -c defaults -c conda-forge
@ECHO ^>^> conda update -p "%devenv%" -yq --all
@CALL "%devenv%\Scripts\conda" update -p "%devenv%" -yq --all
@ECHO ^>^> conda install -yp "%devenv%" defaults::git
@CALL "%devenv%\Scripts\conda" install -yp "%devenv%" defaults::git
@ECHO ^>^> conda install -yq -p "%devenv%" --file dev/test-requirements.txt -c defaults -c conda-forge
@CALL "%devenv%\Scripts\conda" install -yq -p "%devenv%" --file dev/test-requirements.txt -c defaults -c conda-forge

@CALL "%devenv%\python" -m conda init --dev cmd.exe > NUL

Expand Down

0 comments on commit fb7ac5f

Please sign in to comment.