hookmeup

A Git hook to automate your Pipenv and Django workflow
git clone git://git.danielmoch.com/hookmeup.git
Log | Files | Refs | README | LICENSE

commit cf0333ba74d1e10c1a5f83a63c1d99dfc6fad576
parent b48b887ca87fd4f813d96daf2b14ea467e20e900
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sat, 15 Sep 2018 08:24:08 -0400

Add make.bat and use in appveyor builds

Diffstat:
Mappveyor.yml | 14+++++++-------
Amake.bat | 173+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 180 insertions(+), 7 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml @@ -2,16 +2,16 @@ environment: matrix: # For Python versions available on Appveyor, see # http://www.appveyor.com/docs/installed-software#python - - PYTHON: "C:\\Python34" - - PYTHON: "C:\\Python35-x64" - - PYTHON: "C:\\Python36" - - PYTHON: "C:\\Python37" + - PYTHON: "C:\\Python34\\python.exe" + - PYTHON: "C:\\Python35-x64\\python.exe" + - PYTHON: "C:\\Python36\\python.exe" + - PYTHON: "C:\\Python37\\python.exe" install: - - "%PYTHON%\\python.exe -m pip install pipenv" - - "%PYTHON%\\python.exe -m pipenv --bare install --dev --skip-lock" + - "%PYTHON% -m pip install pipenv" + - "make test-install" build: off test_script: -- "%PYTHON%\\python.exe -m pipenv run python -m pytest" +- "make test" diff --git a/make.bat b/make.bat @@ -0,0 +1,173 @@ +@echo off +set BROWSER_PYSCRIPT=import os, webbrowser, sys^ + +try:^ + + from urllib import pathname2url^ + +except:^ + + from urllib.request import pathname2url^ + +webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))^ + +set PRINT_HELP_PYSCRIPT=import re, sys^ + +for line in sys.stdin:^ + + match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$', line)^ + + if match:^ + + target, help = match.groups()^ + + print("%-20s %s" % (target, help))^ + +if "%PYTHON%" == "" ( + set PYTHON=python +) +set PIPENV=python -m pipenv +set PIPRUN=%PIPENV% run +set PIPINST=%PIPENV% --bare install --dev --skip-lock +set BROWSER=%PYTHON% -c %BROWSER_PYSCRIPT% + +if "%1" == "help" ( + %PYTHON% -c "%PRINT_HELP_PYSCRIPT%" < %~f0 + goto :end +) + +if "%1" == "clean" ( + call :cleanbuild + call :cleanpyc + call :cleantest + goto :end +) + +if "%1" == "cleanbuild" ( + call :cleanbuild + goto :end +) + +if "%1" == "cleanpyc" ( + call :cleanpyc + goto :end +) + +if "%1" == "cleantest" ( + call :cleantest + goto :end +) + +if "%1" == "lint" ( + @echo on + %PIPRUN% pylint hookmeup tests --disable=parse-error + @echo off + goto :end +) + +if "%1" == "test" ( + @echo on + %PIPRUN% python -m pytest + @echo off + goto :end +) + +if "%1" == "test-all" ( + @echo on + %PIPRUN% tox + @echo off + goto :end +) + +if "%1" == "test-install" ( + @echo on + %PIPINST% + @echo off + goto :end +) + +if "%1" == "coverage" ( + @echo on + %PIPRUN% python -m pytest --cov=hookmeup + @echo off + goto :end +) + +if "%1" == "coverage-html" ( + @echo on + %PIPRUN% python -m pytest --cov=hookmeup + %PIPRUN% coverage html + %BROWSER% htmlcov\index.html + @echo off + goto :end +) + +if "%1" == "release" ( + @echo on + %PIPRUN% flit build + dir dist + %PIPRUN% flit publish + @echo off + goto :end +) + +if "%1" == "dist" ( + @echo on + %PIPRUN% flit build + dir dist + @echo off + goto :end +) + +if "%1" == "install" ( + @echo on + %PIPRUN% flit install --deps=none + @echo off + goto :end +) + +if "%1" == "run" ( + @echo on + %PIPRUN% python -m hookmeup %cmd% + @echo off + goto :end +) + +if "%1" == "debug" ( + @echo on + %PIPRUN% flit install --deps=none + %PIPRUN% pudb3 hookmeup %cmd% + @echo off + goto :end +) + +:cleanbuild +@echo on +rmdir /S /Q build +rmdir /S /Q dist +rmdir /S /Q .eggs +del /S *.egg-info +del /S *.egg +@echo off +exit /B 0 + +:cleanpyc +@echo on +del /S *.pyc +del /S *.pyo +del /S *~ +del /S __pycache__ +%PIPRUN% pip uninstall -y hookmeup +@echo off +exit /B 0 + +:cleantest +@echo on +del .coverage +rmdir /S /Q htmlcov +rmdir /S /Q .pytest_cache +rmdir /S /Q .tox +@echo on +exit /B 0 + +:end