Skip to content

Commit

Permalink
Tidy ups and extra error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
FreddieAkeroyd committed Oct 30, 2024
1 parent 27df3b0 commit 84b3f7d
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 10 deletions.
3 changes: 2 additions & 1 deletion build_tools/check_builds_are_recent.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
setlocal
call "%~dp0..\installation_and_upgrade\define_latest_genie_python.bat"
IF %errorlevel% neq 0 EXIT /b %errorlevel%
set PYTHONUNBUFFERED=TRUE
REM use LATEST_PYTHON3 so not killed by stop_ibex_server
call "%LATEST_PYTHON3%" -u "%~dp0check_builds_are_recent.py"
call "%~dp0remove_genie_python.bat" %LATEST_PYTHON_DIR%
call "%~dp0..\installation_and_upgrade\remove_genie_python.bat" %LATEST_PYTHON_DIR%
8 changes: 5 additions & 3 deletions build_tools/purge_archive.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
setlocal EnableDelayedExpansion
REM Remove old builds from the archive

if not "%WORKSPACE%" == "" (
if "%WORKSPACE%" == "" (
call "%~dp0..\installation_and_upgrade\define_latest_genie_python.bat"
) else (
if exist "%WORKSPACE%\Python3" rd /s /q %WORKSPACE%\Python3
if !errorlevel! neq 0 exit /b 1
call "%~dp0..\installation_and_upgrade\define_latest_genie_python.bat" %WORKSPACE%\Python3
)

call "%~dp0..\installation_and_upgrade\define_latest_genie_python.bat" %WORKSPACE%\Python3
IF %errorlevel% neq 0 EXIT /b %errorlevel%

set PYTHONUNBUFFERED=TRUE
REM use LATEST_PYTHON3 to avoid process being killed
Expand Down
5 changes: 5 additions & 0 deletions installation_and_upgrade/define_latest_genie_python.bat
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ if "%~1" NEQ "" (
mkdir %LATEST_PYTHON_DIR%

CALL %genie_dir%\BUILD-%PYTHON_BUILD_NO%\genie_python_install.bat %LATEST_PYTHON_DIR%
IF %errorlevel% neq 0 goto ERROR

set "LATEST_PYTHON=%LATEST_PYTHON_DIR%\python.exe"
set "LATEST_PYTHON3=%LATEST_PYTHON_DIR%\python3.exe"
Expand All @@ -45,4 +46,8 @@ exit /b 0

:ERROR
@echo define_latest_genie_python failed
set PYTHON_BUILD_NO=
set LATEST_PYTHON_DIR=
set LATEST_PYTHON=
set LATEST_PYTHON3=
exit /b 1
1 change: 1 addition & 0 deletions installation_and_upgrade/developer_update.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
setlocal EnableDelayedExpansion
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases"
call "%~dp0define_latest_genie_python.bat"
IF %errorlevel% neq 0 EXIT /b %errorlevel%

set "STOP_IBEX=C:\Instrument\Apps\EPICS\stop_ibex_server"
set "START_IBEX=C:\Instrument\Apps\EPICS\start_ibex_server"
Expand Down
2 changes: 1 addition & 1 deletion installation_and_upgrade/instrument_install.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
setlocal
setlocal EnableDelayedExpansion

REM check if console has Administrative privileges
call "%~dp0check_for_admin_console.bat"
Expand Down
2 changes: 1 addition & 1 deletion installation_and_upgrade/instrument_save_settings.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
setlocal
setlocal EnableDelayedExpansion
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases"
call "%~dp0define_latest_genie_python.bat"
if %errorlevel% neq 0 goto ERROR
Expand Down
1 change: 1 addition & 0 deletions installation_and_upgrade/instrument_test.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
setlocal EnableDelayedExpansion
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases"
call "%~dp0define_latest_genie_python.bat"
if %errorlevel% neq 0 goto ERROR
Expand Down
2 changes: 1 addition & 1 deletion installation_and_upgrade/instrument_update.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
setlocal
setlocal EnableDelayedExpansion
call "%~dp0define_latest_genie_python.bat"
if %errorlevel% neq 0 goto ERROR
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases\4.0.0"
Expand Down
6 changes: 4 additions & 2 deletions installation_and_upgrade/remove_genie_python.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ if "%~1"=="" (
goto ERROR
)

set remove_genie_python_path=%~1
set "remove_genie_python_path=%~1"

REM Checks that supplied filepath exists.
if exist %remove_genie_python_path% (
if exist "%remove_genie_python_path%" (

REM Checks that "Python_Build_" is in the supplied filepath, so it is a python build.
echo.%remove_genie_python_path% | findstr /C:"Python_Build_">nul && (
Expand All @@ -22,6 +22,7 @@ if exist %remove_genie_python_path% (
set LATEST_PYTHON3=

@echo Successfully removed "%remove_genie_python_path%" and unset genie build variables.
set remove_genie_python_path=
exit /b 0

) || (
Expand All @@ -35,5 +36,6 @@ if exist %remove_genie_python_path% (
)

:ERROR
set remove_genie_python_path=
@echo remove_genie_python failed
exit /b 1
1 change: 1 addition & 0 deletions installation_and_upgrade/run_standalone_backup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
setlocal
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases"
call "%~dp0define_latest_genie_python.bat"
IF %errorlevel% neq 0 EXIT /b %errorlevel%
call cd "%~dp0"
set PYTHONPATH=.
@REM Uses Python from the Shares, set as LATEST_PYTHON
Expand Down
2 changes: 1 addition & 1 deletion installation_and_upgrade/truncate_database.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ exit /b 0
:ERROR
set errcode = %ERRORLEVEL%
call "%~dp0remove_genie_python.bat" %LATEST_PYTHON_DIR%
EXIT /b !errcode!
EXIT /b !errcode!
1 change: 1 addition & 0 deletions installation_and_upgrade/upgrade_mysql.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
setlocal EnableDelayedExpansion
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases"
call "%~dp0define_latest_genie_python.bat"
IF %errorlevel% neq 0 EXIT /b %errorlevel%

set "STOP_IBEX=C:\Instrument\Apps\EPICS\stop_ibex_server"
set "START_IBEX=C:\Instrument\Apps\EPICS\start_ibex_server"
Expand Down
1 change: 1 addition & 0 deletions installation_and_upgrade/vhd_build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ setlocal EnableDelayedExpansion
set PYTHONUNBUFFERED=1
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases"
call "%~dp0define_latest_genie_python.bat"
IF %errorlevel% neq 0 EXIT /b %errorlevel%

IF EXIST "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" (
start /wait cmd /c "C:\Instrument\Apps\EPICS\stop_ibex_server.bat"
Expand Down
1 change: 1 addition & 0 deletions installation_and_upgrade/vhd_build_force_cleanup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ setlocal EnableDelayedExpansion
set PYTHONUNBUFFERED=1
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases"
call "%~dp0define_latest_genie_python.bat"
IF %errorlevel% neq 0 EXIT /b %errorlevel%

IF EXIST "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" (
start /wait cmd /c "C:\Instrument\Apps\EPICS\stop_ibex_server.bat"
Expand Down
1 change: 1 addition & 0 deletions installation_and_upgrade/vhd_build_release.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ setlocal EnableDelayedExpansion
set PYTHONUNBUFFERED=1
set "SOURCE=\\isis.cclrc.ac.uk\inst$\Kits$\CompGroup\ICP\Releases"
call "%~dp0define_latest_genie_python.bat"
IF %errorlevel% neq 0 EXIT /b %errorlevel%

IF EXIST "C:\Instrument\Apps\EPICS\stop_ibex_server.bat" (
start /wait cmd /c "C:\Instrument\Apps\EPICS\stop_ibex_server.bat"
Expand Down

0 comments on commit 84b3f7d

Please sign in to comment.