diff --git a/.github/workflows/premerge.yaml b/.github/workflows/premerge.yaml index fae4a10..03c2e13 100644 --- a/.github/workflows/premerge.yaml +++ b/.github/workflows/premerge.yaml @@ -15,12 +15,15 @@ jobs: tests: name: Python tests runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.12 + python-version: ${{ matrix.python-version }} - name: Run tests run: | - python -m unittest tests/rawdata.py + python -m unittest tests/*.py diff --git a/README.md b/README.md index 0fcfbb7..460f646 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Please follow the instructions provided over at https://github.com/xNul/palworld ### Prerequisites -1. Python. This can be installed from the Windows Store. +1. Python 3.9 or newer. You can install [Python 3.12 from the Microsoft Store](https://apps.microsoft.com/detail/9NCVDN91XZQP) ### Windows steps diff --git a/convenience_tools/convert-single-json-to-sav.cmd b/convenience_tools/convert-single-json-to-sav.cmd index 83f1db3..2940c30 100644 --- a/convenience_tools/convert-single-json-to-sav.cmd +++ b/convenience_tools/convert-single-json-to-sav.cmd @@ -16,28 +16,38 @@ pause exit /B 1 :Found -@REM Print Python version for debugging +:: Print Python version for debugging ECHO Python version: %PYTHON_BIN% --version -@REM Switch to script directory +:: Check that the minor version of python is at least 9. +FOR /F "tokens=1,2 delims=." %%G IN ('%PYTHON_BIN% --version') DO ( + SET PYTHON_VERSION_MINOR=%%H +) + +IF %PYTHON_VERSION_MINOR% LSS 9 ( + ECHO Python 3.9 or higher is required. + EXIT /B 1 +) + +:: Switch to script directory cd /D "%~dp0" -@REM Check if convert-single-json-to-sav.py exists +:: Check if convert-single-json-to-sav.py exists IF NOT EXIST "convert-single-json-to-sav.py" ( ECHO convert-single-json-to-sav.py is missing. PAUSE EXIT /B 1 ) -@REM Check if first argument exists +:: Check if first argument exists IF NOT EXIST "%~1" ( ECHO You must specify a .sav file to convert. PAUSE EXIT /B 1 ) -@REM Check if uesave.exe exists +:: Check if uesave.exe exists IF NOT EXIST "uesave/uesave.exe" ( ECHO uesave.exe is missing. Did you download the palworld-save-tools.zip from releases? MKDIR uesave @@ -48,7 +58,7 @@ IF NOT EXIST "uesave/uesave.exe" ( ECHO This will convert the save file "%~1" in JSON format in back to .sav format. ECHO This will overwrite your existing .sav file! ECHO Please make a backup of your .sav file before continuing! -@REM Ask user if they want to continue +:: Ask user if they want to continue CHOICE /C YN /M "Continue?" IF %ERRORLEVEL% NEQ 1 ( ECHO Exiting because aborted. diff --git a/convenience_tools/convert-single-sav-to-json.cmd b/convenience_tools/convert-single-sav-to-json.cmd index 3e2ec98..490eb2c 100644 --- a/convenience_tools/convert-single-sav-to-json.cmd +++ b/convenience_tools/convert-single-sav-to-json.cmd @@ -16,28 +16,38 @@ pause exit /B 1 :Found -@REM Print Python version for debugging +:: Print Python version for debugging ECHO Python version: %PYTHON_BIN% --version -@REM Switch to script directory +:: Check that the minor version of python is at least 9. +FOR /F "tokens=1,2 delims=." %%G IN ('%PYTHON_BIN% --version') DO ( + SET PYTHON_VERSION_MINOR=%%H +) + +IF %PYTHON_VERSION_MINOR% LSS 9 ( + ECHO Python 3.9 or higher is required. + EXIT /B 1 +) + +:: Switch to script directory cd /D "%~dp0" -@REM Check if convert-single-sav-to-json.py exists +:: Check if convert-single-sav-to-json.py exists IF NOT EXIST "convert-single-sav-to-json.py" ( ECHO convert-single-sav-to-json.py is missing. PAUSE EXIT /B 1 ) -@REM Check if first argument exists +:: Check if first argument exists IF NOT EXIST "%~1" ( ECHO You must specify a .sav file to convert. PAUSE EXIT /B 1 ) -@REM Check if uesave.exe exists +:: Check if uesave.exe exists IF NOT EXIST "uesave/uesave.exe" ( ECHO uesave.exe is missing. Did you download the palworld-save-tools.zip from releases? MKDIR uesave @@ -46,7 +56,6 @@ IF NOT EXIST "uesave/uesave.exe" ( ) ECHO This will convert the save file "%~1" to JSON format. -@REM Ask user if they want to continue CHOICE /C YN /M "Continue?" IF %ERRORLEVEL% NEQ 1 ( ECHO Exiting because aborted.