diff -r 7e818490d297 Doc/make.bat --- a/Doc/make.bat Thu Mar 07 18:46:09 2013 +0200 +++ b/Doc/make.bat Fri Mar 08 16:13:58 2013 -0600 @@ -1,59 +1,321 @@ -@@echo off -setlocal - -set SVNROOT=http://svn.python.org/projects -if "%PYTHON%" EQU "" set PYTHON=..\pcbuild\python -if "%HTMLHELP%" EQU "" set HTMLHELP=%ProgramFiles%\HTML Help Workshop\hhc.exe -if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON% tools/sphinxext/patchlevel.py`) do set DISTVERSION=%%v - -if "%1" EQU "" goto help -if "%1" EQU "html" goto build -if "%1" EQU "htmlhelp" goto build -if "%1" EQU "latex" goto build -if "%1" EQU "text" goto build -if "%1" EQU "suspicious" goto build -if "%1" EQU "linkcheck" goto build -if "%1" EQU "changes" goto build -if "%1" EQU "checkout" goto checkout -if "%1" EQU "update" goto update - -:help -set this=%~n0 -echo HELP -echo. -echo %this% checkout -echo %this% update -echo %this% html -echo %this% htmlhelp -echo %this% latex -echo %this% text -echo %this% suspicious -echo %this% linkcheck -echo %this% changes -echo. -goto end - -:checkout -svn co %SVNROOT%/external/Sphinx-1.0.7/sphinx tools/sphinx -svn co %SVNROOT%/external/docutils-0.6/docutils tools/docutils -svn co %SVNROOT%/external/Jinja-2.3.1/jinja2 tools/jinja2 -svn co %SVNROOT%/external/Pygments-1.5dev-20120930/pygments tools/pygments -goto end - -:update -svn update tools/sphinx -svn update tools/docutils -svn update tools/jinja2 -svn update tools/pygments -goto end - -:build -if not exist build mkdir build -if not exist build\%1 mkdir build\%1 -if not exist build\doctrees mkdir build\doctrees -cmd /C %PYTHON% --version -cmd /C %PYTHON% tools\sphinx-build.py -b%1 -dbuild\doctrees . build\%* -if "%1" EQU "htmlhelp" "%HTMLHELP%" build\htmlhelp\python%DISTVERSION:.=%.hhp -goto end - -:end +@echo off +rem The following variables can be set in your environment to change the way +rem this script executes: +rem PYTHON2 +rem PYTHON3 +rem SVNROOT +rem HTMLHELP +rem SPHINXOPTS +rem PAPER +rem SOURCES +rem DISTVERSION +rem +rem These can also be set from the command line, e.g. +rem make html "PYTHON2=py -2.7" +rem Note that there MUST be double quotes around the assignment! + + +setlocal +pushd %~dp0 + + + +rem Parse the command line arguments using horrific black magic of the +rem foulest kind. First argument becomes BUILDER, all others either become +rem part of SOURCES or set a variable of their own. + +set BUILDER=%1 + +:parse-arg-loop +shift +if [%1] EQU [] goto after-parse-loop + +echo %1 | findstr /C:"=" 1>nul + +if %ERRORLEVEL% EQU 1 ( + set SOURCES=%SOURCES% %1 +) else ( + set %1 +) +goto parse-arg-loop +:after-parse-loop + + + +rem Set defaults if there's nothing in the necessary variables. + +if "%PYTHON2%" EQU "" set PYTHON2=py -2 + +if "%PYTHON3%" EQU "" ( + if EXIST ..\PCbuild\amd64\python.exe ( + set PYTHON3=..\PCbuild\amd64\python.exe + ) else if EXIST ..\PCbuild\amd64\python_d.exe ( + set PYTHON3=..\PCbuild\amd64\python_d.exe + ) else if EXIST ..\PCbuild\python.exe ( + set PYTHON3=..\PCbuild\python.exe + ) else if EXIST ..\PCbuild\python_d.exe ( + set PYTHON3=..\PCbuild\python_d.exe + ) else ( + set PYTHON3=py -3 + ) +) + +if "%SNVROOT%" EQU "" set SVNROOT=http://svn.python.org/projects + +if DEFINED ProgramFiles(x86) set PRGMFLS=%ProgramFiles(x86)% +if NOT DEFINED ProgramFiles(x86) set PRGMFLS=%ProgramFiles% +if "%HTMLHELP%" EQU "" set HTMLHELP="%PRGMFLS%\HTML Help Workshop\hhc.exe" + +if "%DISTVERSION%" EQU "" for /f "usebackq" %%v in (`%PYTHON2% tools/sphinxext/patchlevel.py`) do set DISTVERSION=%%v + + + +rem Go to the appropriate target. If %BUILDER% is not in this list, fall +rem through to a help message. + +for %%x in ( + clean, update, html, htmlhelp, latex, text, epub, changes, + linkcheck, coverage, doctest, pydoc-topics, dist, suspicious, + check, serve +) do if "%BUILDER%" EQU "%%x" goto %%x + +set this=%~n0 +echo Please use "%this% " where ^ is one of +echo clean to remove build files +echo update to update build tools +echo html to make standalone HTML files +echo htmlhelp to make HTML files and a HTML help project +echo latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter +echo text to make plain text files +echo epub to make EPUB files +echo changes to make an overview over all changed/added/deprecated items +echo linkcheck to check all external links for integrity +echo coverage to check documentation coverage for library and C API +echo doctest to run doctests in the documentation +echo pydoc-topics to regenerate the pydoc topics file +echo dist to create a "dist" directory with archived docs for download +echo suspicious to check for suspicious markup in output text +echo check to run a check for frequent markup errors +echo serve to serve the documentation on the localhost (8000) +goto end + + + +:clean +pushd . +rmdir /S /Q build +rmdir /S /Q tools\sphinx +rmdir /S /Q tools\docutils +rmdir /S /Q tools\jinja2 +rmdir /S /Q tools\pygments +goto end + + + +:update +pushd . +call :clean +call :checkout +goto end + + + +:html +pushd . +call :build +echo Build finished; the HTML pages are in build\html. +goto end + + + +:htmlhelp +pushd . +call :build +echo Build finished; the HTML pages are in build\htmlhelp. + +cmd /C "%HTMLHELP% build\htmlhelp\python%DISTVERSION:.=%.hhp" + +if EXIST "%~dp0build\htmlhelp\python%DISTVERSION:.=%.chm" ( + echo The compiled help file is at build\htmlhelp\python%DISTVERSION:.=%.chm. +) else ( + echo HTML Help Workshop could not be built. There should be an + echo error message above. +) +goto end + + + +:latex +pushd . +call :build +echo Build finished; the LaTeX files are in build\latex. +goto end + + + +:text +pushd . +call :build +echo Build finished; the text files are in build\text. +goto end + + + +:epub +pushd . +call :build +echo Build finished; the epub files are in build\epub. +goto end + + + +:changes +pushd . +call :build +echo The overview file is in build\changes. +goto end + + + +:linkcheck +pushd . +call :build +echo Link check complete; look for any errors in the above output +echo or in build\linkcheck\output.txt. +goto end + + + +:coverage +pushd . +call :build +echo Coverage finished; see c.txt and python.txt in build\coverage. +goto end + + + +:doctest +pushd . +call :build +echo Testing of doctests in the sources finished, look at the +echo results in build\doctest\output.txt. +goto end + + + +:pydoc-topics +pushd . +call :build +echo Building finished, now copy build\pydoc-topics\topics.py +echo to ..\Lib\pydoc_data\topics.py. +goto end + + + +:dist +pushd . +if exist dist rmdir /S /Q dist +mkdir dist + +set SOURCES= + +set BUILDER=html +call :build +echo Copying html... +xcopy /E /I /Q build\html dist\python-%DISTVERSION%-docs-html + +set BUILDER=text +call :build +echo Copying text... +xcopy /E /I /Q build\text dist\python-%DISTVERSION%-docs-text + +set BUILDER=latex +if exist build\latex rmdir /S /Q build\latex +set PAPER=a4 +call :build +echo Copying LaTeX... +xcopy /E /I /Q build\latex dist\python-%DISTVERSION%-docs-latex-a4 + +rmdir /S /Q build\latex +set PAPER=letter +call :build +echo Copying LaTeX... +xcopy /E /I /Q build\latex dist\python-%DISTVERSION%-docs-latex-letter + +set BUILDER=epub +call :build +echo Copying epub... +xcopy /E /I /Q build\epub dist\python-%DISTVERSION%-docs-epub + +echo Docs are ready for packaging in the dist directory. The LaTeX files will +echo need to be compiled as well. +goto end + + + +:suspicious +pushd . +call :build +echo Suspicious check complete; look for any errors in the above output +echo or in build\suspicious\suspicious.csv. If all issues are false +echo positives, append that file to tools\sphinxext\susp-ignored.csv. +goto end + + + +:check +pushd . +cmd /C %PYTHON2% tools\rstlint.py -i tools +goto end + + + +:serve +pushd . +cmd /C %PYTHON3% ..\Tools\scripts\serve.py build/html +goto end + + + +:checkout +pushd . +if not exist tools\sphinx ( +echo Checking out Sphinx... +svn co %SVNROOT%/external/Sphinx-1.0.7/sphinx tools/sphinx) + +if not exist tools\docutils ( +echo Checking out Docutils... +svn co %SVNROOT%/external/docutils-0.6/docutils tools/docutils) + +if not exist tools\jinja2 ( +echo Checking out Jinja... +svn co %SVNROOT%/external/Jinja-2.3.1/jinja2 tools/jinja2) + +if not exist tools\pygments ( +echo Checking out Pygments... +svn co %SVNROOT%/external/Pygments-1.5dev-20120930/pygments tools/pygments) +goto end + + + +:build +pushd . +call :checkout + +if not exist build mkdir build +if not exist build\%BUILDER% mkdir build\%BUILDER% +if not exist build\doctrees mkdir build\doctrees + +set ALLSPHINXOPTS=-b %BUILDER% -d build/doctrees -D latex_paper_size=%PAPER% %SPHINXOPTS% . build/%BUILDER% %SOURCES% + +cmd /C %PYTHON2% --version +cmd /C %PYTHON2% tools\sphinx-build.py %ALLSPHINXOPTS% + +echo. + +goto end + + + +:end +popd