From 8be1459544ce74dcbaa3b40d34af75d914f18d31 Mon Sep 17 00:00:00 2001 From: CyberKitsune Date: Sat, 8 Apr 2023 00:26:51 -0700 Subject: [PATCH 1/4] CheckPython: Try and check for python and install it --- CheckPython.bat | 18 ++++++++++++++++++ RunVRCNowPlaying.bat | 1 + RunVRCSubs.bat | 1 + 3 files changed, 20 insertions(+) create mode 100644 CheckPython.bat diff --git a/CheckPython.bat b/CheckPython.bat new file mode 100644 index 0000000..9df770b --- /dev/null +++ b/CheckPython.bat @@ -0,0 +1,18 @@ +@echo off +python --help >nul 2>&1 +Setlocal EnableDelayedExpansion +IF !ERRORLEVEL! NEQ 0 ( + WHERE winget + IF !ERRORLEVEL! NEQ 0 ( + echo "It appears you do not have Python installed! Please install Python 3.9 or higher from python.org or the Microsoft Store." + pause + exit + ) ELSE ( + choice /C:yn /m "You do not have Python installed. Do you wish to install it? [Y] / [N]" + if !ERRORLEVEL! == 1 ( + winget install python + ) + ) +) ELSE ( + echo "Python is installed!" +) \ No newline at end of file diff --git a/RunVRCNowPlaying.bat b/RunVRCNowPlaying.bat index c6b2c69..afddfeb 100644 --- a/RunVRCNowPlaying.bat +++ b/RunVRCNowPlaying.bat @@ -1,4 +1,5 @@ @echo off +call CheckPython.bat call UpdateScripts.bat echo "Installing requirements (be sure to have python installed and in PATH)" python -m pip install -r VRCNowPlaying/Requirements.txt diff --git a/RunVRCSubs.bat b/RunVRCSubs.bat index 0400e9a..1a1aac1 100644 --- a/RunVRCSubs.bat +++ b/RunVRCSubs.bat @@ -1,4 +1,5 @@ @echo off +call CheckPython.bat call UpdateScripts.bat echo "Installing requirements (be sure to have python installed and in PATH)" python -m pip install -r VRCSubs/Requirements.txt From 9ae60e871234a6082a04747de47d95ea96681296 Mon Sep 17 00:00:00 2001 From: CyberKitsune Date: Sat, 8 Apr 2023 17:18:07 -0700 Subject: [PATCH 2/4] CheckPython: Setlocal at the top to fix the conditons --- CheckPython.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CheckPython.bat b/CheckPython.bat index 9df770b..c78ec68 100644 --- a/CheckPython.bat +++ b/CheckPython.bat @@ -1,6 +1,6 @@ @echo off -python --help >nul 2>&1 Setlocal EnableDelayedExpansion +python --help >nul 2>&1 IF !ERRORLEVEL! NEQ 0 ( WHERE winget IF !ERRORLEVEL! NEQ 0 ( From 1418c003984a0e442fe27fbc79783062925addab Mon Sep 17 00:00:00 2001 From: CyberKitsune Date: Sat, 8 Apr 2023 17:20:29 -0700 Subject: [PATCH 3/4] CheckPython: Handle winget errors better --- CheckPython.bat | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CheckPython.bat b/CheckPython.bat index c78ec68..3e4544b 100644 --- a/CheckPython.bat +++ b/CheckPython.bat @@ -10,7 +10,14 @@ IF !ERRORLEVEL! NEQ 0 ( ) ELSE ( choice /C:yn /m "You do not have Python installed. Do you wish to install it? [Y] / [N]" if !ERRORLEVEL! == 1 ( + echo "Please accept any licence agreements after this to install python by pressing Y then enter." winget install python + if !ERRORLEVEL! NEQ 0 ( + echo "For some reason Python failed to install with winget, install Python manually with the windows store or using python.org" + echo "Feel free to contact the vrc-osc-scripts Discord for more help" + pause + exit + ) ) ) ) ELSE ( From c00ef00b3f7b56fda1c61ef4d8eb34d723fd4a98 Mon Sep 17 00:00:00 2001 From: CyberKitsune Date: Thu, 27 Apr 2023 18:44:47 -0700 Subject: [PATCH 4/4] CheckPython: Code cleanup and better python checker --- CheckPython.bat | 14 +++++++------- CheckPython.py | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 CheckPython.py diff --git a/CheckPython.bat b/CheckPython.bat index 3e4544b..0efe7b2 100644 --- a/CheckPython.bat +++ b/CheckPython.bat @@ -1,25 +1,25 @@ @echo off Setlocal EnableDelayedExpansion -python --help >nul 2>&1 -IF !ERRORLEVEL! NEQ 0 ( +python CheckPython.py >nul 2>&1 +IF !ERRORLEVEL! NEQ 3 ( WHERE winget IF !ERRORLEVEL! NEQ 0 ( - echo "It appears you do not have Python installed! Please install Python 3.9 or higher from python.org or the Microsoft Store." + echo It appears you do not have Python installed! Please install Python 3.9 or higher from python.org or the Microsoft Store. pause exit ) ELSE ( choice /C:yn /m "You do not have Python installed. Do you wish to install it? [Y] / [N]" if !ERRORLEVEL! == 1 ( - echo "Please accept any licence agreements after this to install python by pressing Y then enter." + echo Please accept any licence agreements after this to install python by pressing Y then enter. winget install python if !ERRORLEVEL! NEQ 0 ( - echo "For some reason Python failed to install with winget, install Python manually with the windows store or using python.org" - echo "Feel free to contact the vrc-osc-scripts Discord for more help" + echo For some reason Python failed to install with winget, install Python manually with the windows store or using python.org + echo Feel free to contact the vrc-osc-scripts Discord for more help. pause exit ) ) ) ) ELSE ( - echo "Python is installed!" + echo Python is installed! ) \ No newline at end of file diff --git a/CheckPython.py b/CheckPython.py new file mode 100644 index 0000000..1154cfc --- /dev/null +++ b/CheckPython.py @@ -0,0 +1,4 @@ +# This script returns 3. + +if __name__ == "__main__": + exit(3) \ No newline at end of file