Skip to content

Commit

Permalink
condainstall.bat: Add conda.bat and activate.bat scripts again
Browse files Browse the repository at this point in the history
conda 4.5 no longer installs them
  • Loading branch information
ales-erjavec committed Nov 12, 2018
1 parent ee460d5 commit a71a777
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/windows/condainstall.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ rem Target install prefix
set PREFIX=%~1
rem Path to conda executable
set CONDA=%~2
rem Path to base conda env
for /f %%f in ( '"%CONDA%" info --root' ) do (
set "CONDA_BASE_PREFIX=%%f"
)

if not exist "%PREFIX%\python.exe" (
echo Creating a conda env in "%PREFIX%"
Expand All @@ -28,6 +32,25 @@ echo channels: > "%PREFIX%\.condarc"
echo - conda-forge >> "%PREFIX%\.condarc"
echo - defaults >> "%PREFIX%\.condarc"

rem # `conda create` (>=4.5) does not add the conda.bat script,
rem # so we create it manually.
set "CONDA_BAT=%PREFIX%\Scripts\conda.bat"
if not exist "%CONDA_BAT%" (
echo @echo off> "%CONDA_BAT%"
echo setlocal>> "%CONDA_BAT%"
echo set "CONDA=%CONDA%">> "%CONDA_BAT%"
echo set "CONDA_PREFIX=%PREFIX%">> "%CONDA_BAT%"
echo call "%CONDA%" %%*>> "%CONDA_BAT%"
echo endlocal>> "%CONDA_BAT%"
)

rem # same for activate.bat
set "ACTIVATE_BAT=%PREFIX%\Scripts\activate.bat"
if not exist "%ACTIVATE_BAT%" (
echo @echo off > "%ACTIVATE_BAT%"
echo call "%CONDA_BASE_PREFIX%\Scripts\activate.bat" "%PREFIX%" >> "%ACTIVATE_BAT%"
)

for %%f in ( *.tar.bz2 ) do (
echo Installing: %%f
"%CONDA%" install --yes --copy --quiet --prefix "%PREFIX%" "%CD%\%%f" ^
Expand Down

0 comments on commit a71a777

Please sign in to comment.