forked from Cog-Creators/Red-DiscordBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.bat
48 lines (38 loc) · 1.29 KB
/
make.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
@echo off
if [%1] == [] goto help
REM This allows us to expand variables at execution
setlocal ENABLEDELAYEDEXPANSION
REM This will set PYFILES as a list of tracked .py files
set PYFILES=
for /F "tokens=* USEBACKQ" %%A in (`git ls-files "*.py"`) do (
set PYFILES=!PYFILES! %%A
)
goto %1
:reformat
black -l 99 --target-version py38 !PYFILES!
exit /B %ERRORLEVEL%
:stylecheck
black -l 99 --check --target-version py38 !PYFILES!
exit /B %ERRORLEVEL%
:newenv
py -3.8 -m venv --clear .venv
.\.venv\Scripts\python -m pip install -U pip setuptools
goto syncenv
:syncenv
.\.venv\Scripts\python -m pip install -Ur .\tools\dev-requirements.txt
exit /B %ERRORLEVEL%
:checkchangelog
REM This should be written for windows at some point I guess.
REM If we can swith to powershell, it can make this much easier.
echo This doesn^'t do anything on windows ^(yet^)
exit /b 0
:help
echo Usage:
echo make ^<command^>
echo.
echo Commands:
echo reformat Reformat all .py files being tracked by git.
echo stylecheck Check which tracked .py files need reformatting.
echo newenv Create or replace this project's virtual environment.
echo syncenv Sync this project's virtual environment to Red's latest
echo dependencies.