o ×$•a´ã@s dZddlZddlZddlZddlmZddlmZddlZddlm Z ddl m Z m Z m Z mZddlmZmZgd¢ZGd d „d ƒZd eed efd d„ZdS)aÓ sphinx.cmd.make_mode ~~~~~~~~~~~~~~~~~~~~ sphinx-build -M command-line handling. This replaces the old, platform-dependent and once-generated content of Makefile / make.bat. This is in its own module so that importing it is fast. It should not import the main Sphinx modules (like sphinx.applications, sphinx.builders). :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. éN)Úpath)ÚList)Ú build_main)ÚblueÚboldÚcolor_terminalÚnocolor)ÚcdÚrmtree))ÚÚhtmlzto make standalone HTML files)r Údirhtmlz2to make HTML files named index.html in directories)r Ú singlehtmlz to make a single large HTML file)r Úpicklezto make pickle files)r Újsonzto make JSON files)r Úhtmlhelpz+to make HTML files and an HTML help project)r Úqthelpz'to make HTML files and a qthelp project)r Údevhelpz(to make HTML files and a Devhelp project)r Úepubzto make an epub)r Úlatexz9to make LaTeX files, you can set PAPER=a4 or PAPER=letter)ÚposixÚlatexpdfz.to make LaTeX and PDF files (default pdflatex))rÚ latexpdfjaz8to make LaTeX files and run them through platex/dvipdfmx)r Útextzto make text files)r Úmanzto make manual pages)r Útexinfozto make Texinfo files)rÚinfoz3to make Texinfo files and run them through makeinfo)r Úgettextzto make PO message catalogs)r Úchangesz9to make an overview of all changed/added/deprecated items)r Úxmlz!to make Docutils-native XML files)r Ú pseudoxmlz0to make pseudoxml-XML files for display purposes)r Ú linkcheckz)to check all external links for integrity)r Údoctestz>to run all doctests embedded in the documentation (if enabled))r Úcoveragez7to run coverage check of the documentation (if enabled))r Úcleanz+to remove everything in the build directoryc@s¤eZdZdededeeddfdd„Zdedefd d „Zdefd d „Zdd d„Z defdd„Z defdd„Z defdd„Z defdd„Z ddededefdd„ZdS)ÚMakeÚsrcdirÚbuilddirÚoptsÚreturnNcCs&||_||_||_tj dd¡|_dS)NÚMAKEÚmake)r&r'r(ÚosÚenvironÚgetÚmakecmd)Úselfr&r'r(©r1ú6/usr/lib/python3/dist-packages/sphinx/cmd/make_mode.pyÚ__init__:sz Make.__init__ÚcompscGstj|jg|¢RŽS©N)rÚjoinr')r0r4r1r1r2Ú builddir_join@szMake.builddir_joincCs¶t |j¡}t |j¡}t |j¡sdSt |j¡s#td|jƒdS||kr0td|jƒdSt ||g¡|krBtd|jƒdStd|jƒt  |j¡D] }t |  |¡ƒqOdS)NrzError: %r is not a directory!éz&Error: %r is same as source directory!z.Error: %r directory contains source directory!zRemoving everything under %r...) rÚabspathr&r'ÚexistsÚisdirÚprintÚ commonpathr,Úlistdirr r7)r0r&r'Úitemr1r1r2Ú build_cleanCs"    zMake.build_cleancCsptƒstƒttdtjƒƒtdtdƒfdƒtD]\}}}|r(tj |kr5tdt|  d¡ƒ|fƒqdS)Nz Sphinx v%sz'Please use `make %s' where %s is one ofÚtargetéz %s %sé ) rrr<rÚsphinxÚ__display_version__rÚBUILDERSr,ÚnameÚljust)r0ÚosnameÚbnameÚ descriptionr1r1r2Ú build_helpVs€þzMake.build_helpcCó˜| d¡dkr dStjdkrtj dd¡}n|j}z"t| d¡ƒt   |dg¡WdƒWS1s4wYWdSt yKt d|ƒYdSw© Nrrr8Úwin32r*zmake.batzall-pdfúError: Failed to run: %s© Úrun_generic_buildÚsysÚplatformr,r-r.r/r r7Ú subprocessÚcallÚOSErrorr<©r0r/r1r1r2Úbuild_latexpdf`ó  (ÿ  þzMake.build_latexpdfcCrMrNrQrXr1r1r2Úbuild_latexpdfjaorZzMake.build_latexpdfjacCs|| d¡dkr dSz#t| d¡ƒt |jdg¡WdƒWS1s%wYWdSty=td|jƒYdSw)Nrrr8rrP)rRr r7rUrVr/rWr<)r0r1r1r2Ú build_info~s(ÿ þzMake.build_infocCs&| dd¡}|jd|ddkrdSdS)Nrz .doctrees)Ú doctreedirrr8)r7rR)r0Údtdirr1r1r2Ú build_gettextˆs zMake.build_gettextÚbuilderr]cCsft dd¡}|j}|dvr| dd|dg¡|dur!| d¡}d|d ||j| |¡g}t||ƒS) NÚPAPERr )Úa4Úletterz-Dzlatex_elements.papersize=ÚpaperÚdoctreesz-bz-d)r,Úgetenvr(Úextendr7r&r)r0r`r]Ú papersizer(Úargsr1r1r2rRŽs  ý zMake.run_generic_build)r)Nr5)Ú__name__Ú __module__Ú __qualname__Ústrrr3r7Úintr@rLrYr[r\r_rRr1r1r1r2r%9s   r%rir)cCsjt|ƒdkrtdtjddSt|d|d|dd…ƒ}d|d}t||ƒr.t||ƒƒS| |d¡S)NézJError: at least 3 arguments (builder, source dir, build dir) are required.)Úfiler8rBÚbuild_r)Úlenr<rSÚstderrr%ÚhasattrÚgetattrrR)rir+Ú run_methodr1r1r2Ú run_make_modežs ÿ   rw)Ú__doc__r,rUrSrÚtypingrrDÚsphinx.cmd.buildrÚsphinx.util.consolerrrrÚsphinx.util.osutilr r rFr%rmrnrwr1r1r1r2Ús   e