-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.bat
84 lines (64 loc) · 1.79 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
@echo off
setlocal
REM Modular bat file for easy addition of new commands
REM Check command-line arguments
echo Command-line argument: %1
if "%1"=="clean" goto clean
if "%1"=="package" goto package
if "%1"=="compile" goto compile
if "%1"=="html" goto html
if "%1"=="profile" goto profile
REM Default case: no valid argument provided
echo No valid argument provided.
echo Usage: make.bat [clean|package|compile|html|profile [profile_file]]
goto end
:clean
echo Deleting all .c and .pyd files from the Sloth directory and its subdirectories...
del /s /q "Sloth\*.c"
del /s /q "Sloth\*.pyd"
echo Removing the build directory...
rmdir /s /q "build"
if exist "docs\build" (
echo Removing the docs\build directory...
rmdir /s /q "docs\build"
)
echo Removing the test\profile directory...
if exist "test\profile" (
rmdir /s /q "test\profile"
)
echo Cleanup completed.
goto end
:package
echo Packaging the project...
python setup.py sdist bdist_wheel
pip install .
goto end
:compile
echo Compiling Cython files...
python setup.py build_ext --inplace
goto end
:html
echo Building HTML documentation...
sphinx-build -M html ./docs/source ./docs/build/ -E
goto end
:profile
REM Create the test\profile directory if it doesn't exist
if not exist "tests\profile" (
mkdir "tests\profile"
)
set PROF_FILE=%2
if "%PROF_FILE%"=="" (
set PROF_FILE=Sloth.prof
)
set PROFILE_PATH=tests\profile\%PROF_FILE%
echo Profiling the project and saving to %PROFILE_PATH%...
REM Ensure the profile_example.py script is configured correctly to profile your code.
python -m cProfile -o %PROFILE_PATH% "tests\profiler.py"
if exist %PROFILE_PATH% (
gprof2dot -f pstats %PROFILE_PATH% | dot -Tpng -o %PROFILE_PATH%.png
echo Call graph generated as %PROFILE_PATH%.png
)
echo Profiling completed.
goto end
:end
endlocal