Skip to content

Instantly share code, notes, and snippets.

@matthewdeanmartin
Created June 2, 2015 15:58
Show Gist options
  • Save matthewdeanmartin/e9a6a0f7bf5d5674751c to your computer and use it in GitHub Desktop.
Save matthewdeanmartin/e9a6a0f7bf5d5674751c to your computer and use it in GitHub Desktop.
My Python Build Script
REM assumes pywin, sphynx, nose, virtualenv, and py2exe
pushd %~dp0
REM Version switching
cd C:\Python33
CALL pywin setdefault 3.3
REM Virtual environment
echo %workon_home%
CALL workon nist33
REM cd %workon_home%\..\projects\my_code
popd
REM Make Doc Tests Pass
cd docs
CALL make doctest
if errorlevel 1 (
echo %ERRORLEVEL%
echo Docstring tests failed %errorlevel%
cd ..
exit /b %errorlevel%
)
REM Generate documents.
CALL make html
if errorlevel 1 (
echo %ERRORLEVEL%
echo Document generation failed %errorlevel%
cd ..
exit /b %errorlevel%
)
cd ..
cd my_code
nosetests -d
if errorlevel 1 (
echo %ERRORLEVEL%
echo Unit tests failed %errorlevel%
cd ..
exit /b %errorlevel%
)
cd ..
REM LINT
set pythonpath=%cd%
cd lint
del *.txt
pylint --rcfile=pylint.cfg --files-output=y my_code
cd ..
REM Compile to native and run it.
CALL pywin setup_py2exe.py py2exe
mkdir dist\img\
copy my_code\img\*.gif dist\img\
copy my_code\settings.ini dist
copy my_code\*.ico dist
REM For real customers, provide Cpp redist runtime installer
copy CppRedist\*.* dist
copy *.ico dist
cd dist
REM execute (it happens to be main.exe)
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment