Skip to content

Commit fb9ba85

Browse files
committed
Only upgrade when it's safe to do so.
1 parent 1a7abdf commit fb9ba85

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

run-gui.bat

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1+
@echo off
2+
13
@rem Change the working directory to the location of this file so that relative paths will work
24
cd /D "%~dp0"
35

4-
@rem You will automatically get updates for all versions starting with "0.0.".
5-
python -m pip install rlbot==0.0.* --upgrade
6+
setlocal EnableDelayedExpansion
7+
8+
@rem Run the is_safe_to_upgrade function and save the output to a temp file.
9+
python -c "from rlbot.utils import public_utils; print(public_utils.is_safe_to_upgrade());" > %temp%\is_safe_to_upgrade.txt
10+
11+
IF %ERRORLEVEL% NEQ 0 (
12+
@rem The python command failed, so rlbot is probably not installed at all. Safe to 'upgrade'.
13+
set is_safe_to_upgrade=True
14+
) ELSE (
15+
@rem read the file containing the python output.
16+
set /p is_safe_to_upgrade= < %temp%\is_safe_to_upgrade.txt
17+
)
18+
del %temp%\is_safe_to_upgrade.txt
19+
20+
IF "!is_safe_to_upgrade!"=="True" (
21+
@rem You will automatically get updates for all versions starting with "0.0.".
22+
python -m pip install rlbot==0.0.* --upgrade
23+
) ELSE (
24+
echo Will not attempt to upgrade rlbot because files are in use.
25+
)
626

727
python -c "from rlbot.gui.qt_root import RLBotQTGui; RLBotQTGui.main();"

run.bat

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1+
@echo off
2+
13
@rem Change the working directory to the location of this file so that relative paths will work
24
cd /D "%~dp0"
35

4-
@rem You will automatically get updates for all versions starting with "0.0.".
5-
python -m pip install rlbot==0.0.* --upgrade
6+
setlocal EnableDelayedExpansion
7+
8+
@rem Run the is_safe_to_upgrade function and save the output to a temp file.
9+
python -c "from rlbot.utils import public_utils; print(public_utils.is_safe_to_upgrade());" > %temp%\is_safe_to_upgrade.txt
10+
11+
IF %ERRORLEVEL% NEQ 0 (
12+
@rem The python command failed, so rlbot is probably not installed at all. Safe to 'upgrade'.
13+
set is_safe_to_upgrade=True
14+
) ELSE (
15+
@rem read the file containing the python output.
16+
set /p is_safe_to_upgrade= < %temp%\is_safe_to_upgrade.txt
17+
)
18+
del %temp%\is_safe_to_upgrade.txt
19+
20+
IF "!is_safe_to_upgrade!"=="True" (
21+
@rem You will automatically get updates for all versions starting with "0.0.".
22+
python -m pip install rlbot==0.0.* --upgrade
23+
) ELSE (
24+
echo Will not attempt to upgrade rlbot because files are in use.
25+
)
626

727
python -c "from rlbot import runner; runner.main();"

0 commit comments

Comments
 (0)