-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.bat
226 lines (201 loc) · 9.2 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
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
@ECHO off
REM ###############################################################################
REM #
REM # Copyright (c) 2018 Florent TOURNOIS
REM #
REM # Permission is hereby granted, free of charge, to any person obtaining a copy
REM # of this software and associated documentation files (the "Software"), to deal
REM # in the Software without restriction, including without limitation the rights
REM # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
REM # copies of the Software, and to permit persons to whom the Software is
REM # furnished to do so, subject to the following conditions:
REM #
REM # The above copyright notice and this permission notice shall be included in
REM # all copies or substantial portions of the Software.
REM #
REM # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
REM # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
REM # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
REM # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
REM # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
REM # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
REM # SOFTWARE.
REM #
REM ###############################################################################
GOTO MAKE_ACTION
REM -------------------------------------------------------------------------------
:PRINT_LINE <textVar>
(
SET "LINE_HERE=%~1"
SETLOCAL EnableDelayedExpansion
@ECHO !LINE_HERE!
ENDLOCAL
exit /b
)
REM -------------------------------------------------------------------------------
:CONFIGURE_DISPLAY
(
CHCP 65001
MODE 100,40
exit /b
)
REM -------------------------------------------------------------------------------
:CLEAR_SCREEN
(
CLS
CALL :PRINT_LINE "╔══════════════════════════════════════════════════════════════════════════════════════════════════╗"
CALL :PRINT_LINE "║ _ _ _____ __ ║"
CALL :PRINT_LINE "║ | | | | | __ \ / _| ║"
CALL :PRINT_LINE "║ | | | | | |__) | __ ___| |_ ║"
CALL :PRINT_LINE "║ | | | | | ___/ '__/ _ \ _| ║"
CALL :PRINT_LINE "║ | |__| | | | | | | __/ | ║"
CALL :PRINT_LINE "║ \____/ |_| |_| \___|_| ║"
CALL :PRINT_LINE "║ ║"
CALL :PRINT_LINE "╚══════════════════════════════════════════════════════════════════════════════════════════════════╝"
exit /b
)
REM -------------------------------------------------------------------------------
:LINE_BREAK
(
CALL :PRINT_LINE "├──────────────────────────────────────────────────────────────────────────────────────────────────┤"
exit /b
)
REM -------------------------------------------------------------------------------
:UPDATE_PIP
(
python -V
pip -V
python -m pip install --upgrade pip wheel setuptools
exit /b
)
REM -------------------------------------------------------------------------------
:MAKE_ACTION
CALL :CONFIGURE_DISPLAY
CALL :CLEAR_SCREEN
SET MYPATH=%~dp0
cd %MYPATH%
CALL :PRINT_LINE " MYPATH=%MYPATH%"
CALL :LINE_BREAK
IF /I "%1" == "clean" GOTO :action_clean
IF /I "%1" == "requirements" GOTO :action_requirements
IF /I "%1" == "requirements-dev" GOTO :action_requirements_dev
IF /I "%1" == "requirements-docs" GOTO :action_requirements_docs
IF /I "%1" == "install-editable" GOTO :action_install_editable
IF /I "%1" == "test" GOTO :action_test
IF /I "%1" == "doxygen" GOTO :action_doxygen
IF /I "%1" == "sphinx" GOTO :action_sphinx
IF /I "%1" == "build" GOTO :action_build
IF /I "%1" == "increase_version" GOTO :action_increaseversion
IF /I "%1" == "upload" GOTO :action_upload
IF /I "%1" == "tag_version" GOTO :action_tag_version
CALL :PRINT_LINE " '%1' is not an action. Can not find the right action."
GOTO :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_clean
CALL :PRINT_LINE " Clean the folder"
REM -------------------------------------------------------------------------------
CALL :UPDATE_PIP
pip install -r requirements.txt
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_requirements
CALL :PRINT_LINE " Requirements python packages for running the lib"
REM -------------------------------------------------------------------------------
CALL :UPDATE_PIP
pip install -r requirements.txt
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_requirements_dev
CALL :PRINT_LINE " Requirements python packages for devs"
REM -------------------------------------------------------------------------------
CALL :UPDATE_PIP
pip install -r requirements-dev.txt
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_requirements_docs
CALL :PRINT_LINE " Requirements python packages for devs"
REM -------------------------------------------------------------------------------
CALL :UPDATE_PIP
pip install -r requirements-docs.txt
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_install_editable
CALL :PRINT_LINE " Install editable version"
REM -------------------------------------------------------------------------------
CALL :UPDATE_PIP
pip install -e .
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_test
CALL :PRINT_LINE " Launch test"
REM -------------------------------------------------------------------------------
pytest -v
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_doxygen
CALL :PRINT_LINE " Doxygen"
REM -------------------------------------------------------------------------------
cd docs
SET DOXYGEN_PATH=C:\\Program Files\\doxygen\\bin
SET DOXYGEN_EXE=doxygen.exe
SET DOXYGEN_CMD=%DOXYGEN_PATH%\\%DOXYGEN_EXE%
SET DOC_FOLDER=%~dp0\\docs
SET CONFIG_FILE="%DOC_FOLDER%\\config_doc.dox"
IF EXIST "%DOXYGEN_CMD%" (
ECHO "Found doxygen %DOXYGEN_CMD%"
) ELSE (
ECHO "%DOXYGEN_CMD%"
ECHO "Doxygen not found"
pause
GOTO :ENDOFFILE
)
IF EXIST "%CONFIG_FILE%" (
ECHO "Found config file %CONFIG_FILE%"
) ELSE (
ECHO "%CONFIG_FILE%"
ECHO "Config file not found"
pause
GOTO :ENDOFFILE
)
CALL :PRINT_LINE "Start doxygen generation"
"%DOXYGEN_CMD%" "%CONFIG_FILE%"
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_sphinx
CALL :PRINT_LINE " Launch sphinx documentation"
REM -------------------------------------------------------------------------------
set SPHINXBUILD=sphinx-build
set SOURCEDIR=docs
set BUILDDIR=build
%SPHINXBUILD% -M html %SOURCEDIR% %BUILDDIR%
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_build
CALL :PRINT_LINE " Build"
REM -------------------------------------------------------------------------------
python setup.py sdist bdist_wheel --universal
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_increaseversion
CALL :PRINT_LINE " Increase version"
REM -------------------------------------------------------------------------------
python setup.py increaseversion
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_upload
CALL :PRINT_LINE " Upload package"
REM -------------------------------------------------------------------------------
python setup.py upload
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:action_tag_version
CALL :PRINT_LINE " Tag version"
REM -------------------------------------------------------------------------------
python setup.py tagversion
goto :ENDOFFILE
REM -------------------------------------------------------------------------------
:ENDOFFILE
CALL :PRINT_LINE " End of the configuration"
CALL :LINE_BREAK
PAUSE
REM -------------------------------------------------------------------------------