-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.bat
141 lines (119 loc) · 2.89 KB
/
build.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
@echo off
cls
set OLDPATH=%PATH%
set PATH=d:\miktex\miktex\bin;%PATH%
echo ***
echo *** Cleanup and update basic info files
echo ***
set PROJECT=technical_indicators
rem PROJ_TYPE should be module (sdist only build) or anything else for sdist and binary builds
set PROJ_TYPE=module
python py_app_ver.py
for /f "delims=" %%f in (py_ver.txt) do set PY_VER=%%f
for /f "delims=" %%f in (app_ver.txt) do set APP_VER=%%f
del py_ver.txt
del app_ver.txt
rd /s /q build
rd /s /q dist
rd /s /q %PROJECT%.egg-info
rd /s /q %PROJECT%-%APP_VER%
if exist *.pyc del *.pyc
if exist %PROJECT%\*.pyc del %PROJECT%\*.pyc
copy /y AUTHORS.rst AUTHORS.txt > nul
copy /y ChangeLog.rst ChangeLog.txt > nul
copy /y README.rst README.txt > nul
copy /y LICENSE.rst LICENSE.txt > nul
copy /y README.txt %PROJECT% > nul
copy /y AUTHORS.txt %PROJECT% > nul
copy /y LICENSE.txt %PROJECT% > nul
copy /y ChangeLog.txt %PROJECT% > nul
echo ***
echo *** Create documentation
echo ***
set SPHINXOPTS=-W -E
ren doc\index.rst index.ori
python prep_rst2pdf.py
cd doc
cmd /c make clean
cmd /c make latex
cd _build\latex
pdflatex.exe %PROJECT%.tex
echo ***
echo *** Repeat to correct references
echo ***
pdflatex.exe %PROJECT%.tex
if not exist ..\..\..\%PROJECT%\doc md ..\..\..\%PROJECT%\doc
copy /y %PROJECT%.pdf ..\..\..\%PROJECT%\doc > nul
cd ..\..
del index.rst
ren index.ori index.rst
cmd /c make clean
cmd /c make html
xcopy /y /e _build\html\*.* ..\%PROJECT%\doc\ > nul
cmd /c make clean
cd ..
pause
cls
if "%1"=="test" goto :TEST
if "%1"=="pypi" goto :PYPI
if %PROJ_TYPE%==module goto :BUILD
if "%1"=="cxf" goto :CXF
if "%1"=="py2exe" goto :PY2EXE
:BUILD
echo ***
echo *** Build only
echo ***
if %PROJ_TYPE%==module python setup.py sdist
if not %PROJ_TYPE%==module python setup.py sdist bdist_egg bdist_wininst bdist_wheel
goto :EXIT
:TEST
echo ***
echo *** TEST: Register, build and upload
echo ***
python setup.py register -r test
echo ***
echo *** End register
echo ***
pause
cls
if %PROJ_TYPE%==module python setup.py sdist upload -r test
if not %PROJ_TYPE%==module python setup.py sdist bdist_egg bdist_wininst bdist_wheel upload -r test
goto :EXIT
:PYPI
echo ***
echo *** PYPI: Register, build and upload
echo ***
python setup.py register -r pypi
echo ***
echo *** End register
echo ***
pause
cls
if %PROJ_TYPE%==module python setup.py sdist upload -r pypi
if not %PROJ_TYPE%==module python setup.py sdist bdist_egg bdist_wininst bdist_wheel upload -r pypi
goto :EXIT
:CXF
echo ***
echo *** CXF build
echo ***
python cxf_setup.py build bdist_msi
rem python cxf_setup.py build_exe
rem cxfreeze cxf_setup.py build_exe
echo ***
echo *** Copy datafiles
echo ***
copy build\exe.win32-%PY_VER%\%PROJECT%\*.* build\exe.win32-%PY_VER%
goto :EXIT
:PY2EXE
echo ***
echo *** PY2EXE build
echo ***
python setup.py py2exe
if exist dist\__main__.exe ren dist\__main__.exe %PROJECT%.exe
goto :EXIT
:EXIT
set PATH=%OLDPATH%
set OLDPATH=
set PY_VER=
set APP_VER=
set PROJ_TYPE=