diff --git a/installation_and_upgrade/define_latest_genie_python.bat b/installation_and_upgrade/define_latest_genie_python.bat index d96f0b8..f050575 100644 --- a/installation_and_upgrade/define_latest_genie_python.bat +++ b/installation_and_upgrade/define_latest_genie_python.bat @@ -1,27 +1,41 @@ @echo off 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 +REM KITS_ICP_PATH is set to ICP directory +REM LATEST_PYTHON is set to a version on genie_python that can be run + +REM Fetch newest python build from \\isis\inst$\Kits$\CompGroup\ICP\genie_python_3 +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" +set "genie_dir=%KITS_ICP_PATH%\genie_python_3" + +if exist "%genie_dir%\LATEST_BUILD.txt" ( -if exist "%GENIE_DIR%\LATEST_BUILD.txt" ( - for /f %%i in ( %GENIE_DIR%\LATEST_BUILD.txt ) do ( - set LATEST_PYTHON_DIR=%GENIE_DIR%\BUILD-%%i\Python\ - set LATEST_PYTHON=%GENIE_DIR%\BUILD-%%i\Python\python.exe - set LATEST_PYTHON3=%GENIE_DIR%\BUILD-%%i\Python\python3.exe + for /f %%i in ( %genie_dir%\LATEST_BUILD.txt ) do ( + + set LATEST_PYTHON_DIR=%tmp%\Python_Build_%%i + mkdir %LATEST_PYTHON_DIR% + + CALL %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 + ) + ) else ( + @echo Could not access LATEST_BUILD.txt goto ERROR + ) -@echo LATEST PYTHON: %LATEST_PYTHON% +rem @echo LATEST PYTHON: %LATEST_PYTHON% exit /b 0 :ERROR @echo define_latest_genie_python failed -exit /b 1 +exit /b 1 \ No newline at end of file diff --git a/installation_and_upgrade/remove_genie_python.bat b/installation_and_upgrade/remove_genie_python.bat new file mode 100644 index 0000000..cecc2c4 --- /dev/null +++ b/installation_and_upgrade/remove_genie_python.bat @@ -0,0 +1,22 @@ +@echo off + +if "%~1"=="" ( + echo No path provided as the first parameter. + exit /b 1 +) + +set substring=Python_Build_ +set path=%~1 +set modified_path=%path:%substring%=% + +if "%path%" neq "%modified_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