make_doc.bat 1.55 KB
@echo off

echo This batch must be launched with PowerShell in administrator mode.
call :ResolvePath path_guitastro %cd%\..
echo Guitastro in the directory %path_guitastro%

rem Search where is Anaconda
set path_anacondas=c:\Users\%USERNAME%\Anaconda3 C:\ProgramData\Anaconda3
for %%p in (%path_anacondas%) do ( 
    rem echo %%p
	if exist %%p (
		rem file exists
		set path_anaconda=%%p
	)
)
echo Anaconda found in the directory %path_anaconda%

rem pyreverse
set pyreverse=%path_anaconda%\Scripts\pyreverse
echo ===== Analyze source code with %pyreverse%
echo cd %path_guitastro%\src
cd %path_guitastro%\src
echo %pyreverse% -p guitastro -o png guitastro
%pyreverse% -p guitastro -o png guitastro
echo move classes_guitastro.png %path_guitastro%\docs\source\doc_images\generated
move classes_guitastro.png %path_guitastro%\docs\source\doc_images\generated
echo move packages_guitastro.png %path_guitastro%\docs\source\doc_images\generated
move packages_guitastro.png %path_guitastro%\docs\source\doc_images\generated

rem sphinx
echo Compile doc with sphinx
set sphinx=%path_anaconda%\Scripts\sphinx-build.exe
echo ===== Compile doc with %sphinx%
echo cd %path_guitastro%\docs
cd %path_guitastro%\docs
echo %sphinx% -b html .\source .\build\html
%sphinx% -b html .\source .\build\html
%sphinx% -b pdf .\source .\build\pdf
	
exit /b
rem === Functions ===

rem Resolve path to absolute.
rem Param 1: Name of output variable.
rem Param 2: Path to resolve.
rem Return: Resolved absolute path.
:ResolvePath
    set %1=%~dpfn2
    exit /b