Skip to content

Commit

Permalink
Created/Changed scripts to install/remove local python build
Browse files Browse the repository at this point in the history
  • Loading branch information
jackbdoughty committed Aug 29, 2024
1 parent 57bfd48 commit 8fd170c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
34 changes: 24 additions & 10 deletions installation_and_upgrade/define_latest_genie_python.bat
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions installation_and_upgrade/remove_genie_python.bat
Original file line number Diff line number Diff line change
@@ -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%.
)

0 comments on commit 8fd170c

Please sign in to comment.