Red-DiscordBot/make.bat
Michael H a80e20067c
do better with loop cleanup (#3245)
* do better with loop cleanup

* changelog

* remove redundant line

* Do this a bit better than the initial pass

* Improve windows support

Make some other things coroutines to work with improved design

* Wish we'd have done this right from the start...

* Update deps surrounding this

 - see bpo-23057
 - neccessary for windows users
 - nice for consistent support channel info / feature availability

* dep issue

* Fix tests

* duplication plugin py version

* actually handle this

* Reconfigure some checks with codeclimate, disable pylint for now

* style

* Is my exasperation showing yet?

* handle some stupid stuff

* meh

* dep changelog
2020-01-01 19:26:32 -05:00

49 lines
1.3 KiB
Batchfile

@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 py37 !PYFILES!
exit /B %ERRORLEVEL%
:stylecheck
black -l 99 --check --target-version py37 !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.