diff --git a/installation_and_upgrade/define_latest_genie_python.bat b/installation_and_upgrade/define_latest_genie_python.bat index f050575..690989a 100644 --- a/installation_and_upgrade/define_latest_genie_python.bat +++ b/installation_and_upgrade/define_latest_genie_python.bat @@ -1,4 +1,5 @@ @echo off +setlocal enabledelayedexpansion REM Get latest python build and kits icp path REM KITS_ICP_PATH is set to ICP directory REM LATEST_PYTHON is set to a version on genie_python that can be run @@ -8,20 +9,19 @@ REM Use genie_python_install to install it into a temporary directory REM Need to make sure that after every use of this bat that these variables are undefined and the temp dir is removed set "KITS_ICP_PATH=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP" - set "genie_dir=%KITS_ICP_PATH%\genie_python_3" if exist "%genie_dir%\LATEST_BUILD.txt" ( for /f %%i in ( %genie_dir%\LATEST_BUILD.txt ) do ( - set LATEST_PYTHON_DIR=%tmp%\Python_Build_%%i - mkdir %LATEST_PYTHON_DIR% + set "LATEST_PYTHON_DIR=%tmp%\Python_Build_%%i" + mkdir !LATEST_PYTHON_DIR! - CALL %genie_dir%\BUILD-%%i\genie_python_install.bat %LATEST_PYTHON_DIR% + %genie_dir%\BUILD-%%i\genie_python_install.bat !LATEST_PYTHON_DIR! - set LATEST_PYTHON=%LATEST_PYTHON_DIR%\python.exe - set LATEST_PYTHON3=%LATEST_PYTHON_DIR%\python3.exe + set LATEST_PYTHON=!LATEST_PYTHON_DIR!\python.exe + set LATEST_PYTHON3=!LATEST_PYTHON_DIR!\python3.exe ) @@ -38,4 +38,4 @@ exit /b 0 :ERROR @echo define_latest_genie_python failed -exit /b 1 \ No newline at end of file +exit /b 1 diff --git a/installation_and_upgrade/remove_genie_python.bat b/installation_and_upgrade/remove_genie_python.bat index cecc2c4..a0b8e4e 100644 --- a/installation_and_upgrade/remove_genie_python.bat +++ b/installation_and_upgrade/remove_genie_python.bat @@ -1,8 +1,8 @@ @echo off if "%~1"=="" ( - echo No path provided as the first parameter. - exit /b 1 + @echo No path provided as the first parameter. + goto ERROR ) set substring=Python_Build_ @@ -10,13 +10,21 @@ set path=%~1 set modified_path=%path:%substring%=% if "%path%" neq "%modified_path%" ( - + + RMDIR /S /Q %path% && @echo Successfully removed %path%. + set LATEST_PYTHON_DIR= set LATEST_PYTHON= set LATEST_PYTHON3= - RMDIR /S /Q %path% ) else ( - echo Could not find the specified path: %path%. -) \ No newline at end of file + @echo Could not find the specified path: %path%. + goto ERROR +) + +exit /b 0 + +:ERROR +@echo remove_genie_python failed +exit /b 1