11@ echo off
22setlocal
33
4- REM ########################################################################
5- REM check if conda is available >
6- REM check that diff_check environment is available >
7- REM activate it
8- REM ########################################################################
4+ :: ########################################################################
5+ :: check if conda is available >
6+ :: check that diff_check environment is available >
7+ :: activate it
8+ :: ########################################################################
99
10- REM Check if conda command is available
10+ :: Check if conda command is available
1111echo Checking if conda command is available...
1212where conda > nul 2 > nul
1313if %ERRORLEVEL% equ 0 (
@@ -32,28 +32,29 @@ exit /b 1
3232:end
3333echo Anaconda3 found.
3434
35- REM Check if the diff_check environment is available
35+ :: check if a different environment then diff_check is activated, if so deactivate it
36+ for /f " delims=" %%i in ('conda env list ^ | findstr /C:" *" ') do set " active_env = %%i "
37+ for /f " delims= " %%j in (" %active_env% " ) do set " active_env_name = %%j "
38+ if not " %active_env_name% " == " diff_check" (
39+ echo You should deactivating %active_env_name% firs
40+ echo Call " conda deactivate"
41+ )
42+
43+ :: Check if the diff_check environment is available
3644call conda env list | findstr /C:" diff_check" > nul 2 > nul
3745if %ERRORLEVEL% neq 0 (
38- echo diff_check environment not found, creating it now...
39-
40- conda env create -f environment.yml && (
41- echo Environment created successfully.
42- ) || (
43- echo Failed to create diff_check environment, please check the environment.yml file.
44- exit /b 1
45- )
46+ echo diff_check environment not found, you should create one by running:
47+ echo $ conda env create -f environment.yml
48+ exit /b 1
4649) else (
4750 echo diff_check environment is available, updating it now...
48-
49- conda env update --name diff_check --file environment.yml --prune
50- if %ERRORLEVEL% neq 0 (
51+ conda env update --name diff_check --file environment.yml --prune && (
52+ echo Environment created successfully.
53+ ) || (
5154 echo Failed to update diff_check environment, please check the environment.yml file.
5255 exit /b 1
5356 )
5457)
5558echo diff_check environment is up to date.
5659
57- REM activate the diff_check environment
58- call conda activate diff_check
59- echo diff_check environment activated.
60+ echo you can start the cmake config now ...
0 commit comments