use Python instead of bash

This commit is contained in:
beauxq
2024-04-16 01:27:51 -07:00
parent 3779ff09ab
commit 6d4942302d
4 changed files with 26 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
{
"include": [
"type_check.py",
"../worlds/AutoSNIClient.py",
"../Patch.py"
],
@@ -16,7 +17,7 @@
"reportMissingTypeStubs": true,
"pythonVersion": "3.8",
"pythonPlatform": "Linux",
"pythonPlatform": "Windows",
"executionEnvironments": [
{

23
.github/type_check.py vendored Normal file
View File

@@ -0,0 +1,23 @@
from pathlib import Path
import subprocess
import sys
config = Path(__file__).parent / "pyright-config.json"
command = ("pyright", "-p", str(config))
print(" ".join(command))
try:
result = subprocess.run(
("pyright", "-p", str(config)),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
except FileNotFoundError as e:
print(f"{e} - Is pyright installed?")
exit(1)
sys.stdout.write((result.stdout or b"").decode())
sys.stderr.write((result.stderr or b"").decode())
exit(result.returncode)

View File

@@ -1,5 +0,0 @@
if [ "$(basename "$(pwd)")" = ".github" ]; then
cd ..
fi
pyright -p .github/pyright-config.json

View File

@@ -4,14 +4,12 @@ on:
pull_request:
paths:
- "**.py"
- ".github/type_check.sh"
- ".github/pyright-config.json"
- ".github/workflows/strict-type-check.yml"
- "**.pyi"
push:
paths:
- "**.py"
- ".github/type_check.sh"
- ".github/pyright-config.json"
- ".github/workflows/strict-type-check.yml"
- "**.pyi"
@@ -32,4 +30,4 @@ jobs:
python ModuleUpdate.py --append "WebHostLib/requirements.txt" --force --yes
- name: "pyright: strict check on specific files"
run: .github/type_check.sh
run: python .github/type_check.py