Skip to content

Commit 3629b7e

Browse files
committed
Fix condainstall script
* Use delayed expansion for ERRORLEVEL inside blocks. * Use full absolute paths to packages for compatibility with conda 4.2.12 * conda create call compatible with conda <= 4.1.11
1 parent c8e2ef5 commit 3629b7e

1 file changed

Lines changed: 14 additions & 16 deletions

File tree

scripts/windows/condainstall.bat

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,24 @@ set CONDA=%~2
99

1010
if not exist "%PREFIX%\python.exe" (
1111
echo Creating a conda env in "%PREFIX%"
12-
rem Create an empty initial skeleton to layout the conda, activate.bat and
13-
rem other things needed to manage the environment.
14-
"%CONDA%" create --yes --quiet --prefix "%PREFIX%" || exit /b %ERRORLEVEL%
15-
set BASEPKGS=
16-
for %%f in ( vs*_runtime*.tar.bz2 python-*.tar.bz2 ) do (
17-
set BASEPKGS=!BASEPKGS! %%f
12+
rem # Create an empty initial skeleton to layout the conda, activate.bat
13+
rem # and other things needed to manage the environment. conda 4.1.*
14+
rem # requires at least one package name to succeed
15+
for %%f in ( vs*_runtime*.tar.bz2 ) do (
16+
"%CONDA%" create --yes --quiet --prefix "%PREFIX%" "%CD%\%%f" ^
17+
|| exit /b !ERRORLEVEL!
1818
)
19-
"%CONDA%" install --yes --copy --quiet --prefix "%PREFIX%" !BASEPKGS!
20-
if errorlevel 1 (
21-
echo "Error creating a conda environment. conda command exited with "
22-
"%ERRORLEVEL%"
23-
exit /b %ERRORLEVEL%
19+
20+
rem # Also install python (msvc runtime and python might be required
21+
rem # for any post-link scripts).
22+
for %%f in ( python-*.tar.bz2 ) do (
23+
"%CONDA%" install --yes --copy --quiet --prefix "%PREFIX%" "%CD%\%%f" ^
24+
|| exit /b !ERRORLEVEL!
2425
)
2526
)
2627

2728
for %%f in ( *.tar.bz2 ) do (
2829
echo Installing: %%f
29-
"%CONDA%" install --yes --copy --quiet --prefix "%PREFIX%" %%f
30-
if errorlevel 1 (
31-
echo "Error installing %%f. conda command exited with %ERRORLEVEL%"
32-
exit /b %ERRORLEVEL%
33-
)
30+
"%CONDA%" install --yes --copy --quiet --prefix "%PREFIX%" "%CD%\%%f" ^
31+
|| exit /b !ERRORLEVEL!
3432
)

0 commit comments

Comments
 (0)