
    -Ph"!                        d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	 ddl
Z
ddlmZmZmZmZ ddlmZ ddlmZ dd	lmZ e	rdd
lmZ g dZ G d d          ZddZdS )a  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).
    )annotationsN)chdir)TYPE_CHECKING)bluebolddisable_colourterminal_supports_colour)
build_main)_StrPath)rmtree)Sequence)) htmlzto make standalone HTML files)r   dirhtmlz2to make HTML files named index.html in directories)r   
singlehtmlz to make a single large HTML file)r   picklezto make pickle files)r   jsonzto 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   epubzto 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   textzto make text files)r   manzto make manual pages)r   texinfozto make Texinfo files)r   infoz3to make Texinfo files and run them through makeinfo)r   gettextzto 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                  Z    e Zd ZddZddZddZddZddZddZddZ	ddZ
	 dddZdS )Make
source_dirstr | os.PathLike[str]	build_diroptsSequence[str]returnNonec               h    t          |          | _        t          |          | _        g || _        d S N)r   r*   r,   r-   )selfr*   r,   r-   s       T/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/sphinx/cmd/make_mode.py__init__zMake.__init__<   s1     #:..!),,dG			    compsr   c                      | j         j        | S r2   )r,   joinpath)r3   r7   s     r4   build_dir_joinzMake.build_dir_joinG   s    &t~&..r6   intc                "   | j                                         }| j                                        }| j                                        sdS | j                                        st          d| j        z             dS ||k    rt          d| j        z             dS |                    |          rt          d| j        z             dS t          d| j        z             | j                                        D ]}t          |           dS )Nr   zError: '%s' is not a directory!   z(Error: '%s' is same as source directory!z0Error: '%s' directory contains source directory!z!Removing everything under '%s'...)	r*   resolver,   existsis_dirprintis_relative_toiterdirr   )r3   r*   r,   items       r4   build_cleanzMake.build_cleanJ   s   _,,..
N**,,	~$$&& 
	1&&(( 	3dnDEEE19$$<t~MNNN1&&y11 	Dt~UVVV11DNBCCCN**,, 	 	D4LLLLqr6   c           	        t                      st                       t          t          dt          j        z                       t          dt          d          fdz  z             t          D ]M\  }}}|rt          j	        |k    r5t          dt          |
                    d                     d|            Nd S )Nz
Sphinx v%sz'Please use `make %s' where %s is one oftarget   z  
   )r	   r   rA   r   sphinx__display_version__r   BUILDERSosnameljust)r3   osnamebnamedescriptions       r4   
build_helpzMake.build_help]   s    ')) 	d<&"<<==>>>7DNN;Lq;PQRRR*2 	C 	C&FE; CRW..A4B00AAKAABBB	C 	Cr6   c                   |                      d          dk    rdS t          j        dk    rdnd}t          j                            d|          }|                                                    d          st          d|z            	 t          | 
                    d                    5  d	| j        v rwt          d
dd          5 }t          j        |ddg|t          j                  }d d d            n# 1 swxY w Y   |r&t!          d| 
                    dd
          z             n_d| j        v r@t          j        |dddg          }|r%t!          d| 
                    d          z             nt          j        |dg          }|cd d d            S # 1 swxY w Y   d S # t"          $ r t!          d|z             Y dS w xY w)Nr   r   r=   win32make.batmakeMAKEInvalid $MAKE command: %rz-Q__LATEXSTDOUT__wzutf-8)encodingall-pdfzLATEXOPTS=-halt-on-error)stdoutstderrzLatex error: check %sz-qzLATEXMKOPTS=-silentz"Latex error: check .log file in %sError: Failed to run: %s)run_generic_buildsysplatformrM   environgetlower
startswithRuntimeErrorr   r:   r-   open
subprocesscallSTDOUTrA   OSError)r3   make_fallbackmakecmdoutfile
returncodes        r4   build_latexpdfzMake.build_latexpdfg   s   !!'**Q..1 '*lg&=&=

6*..77}}))&11 	F:WDEEE%	t**73344 !" !"49$$/wGGG 	7%/_ ' ) :
 $+#-#4& & &
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 " 3"11';LMMN   TY&&!+#%61	" "J " @"11'::;  
 ",'91E!F!FJ!C!" !" !" !" !" !" !" !" !" !" !" !" !" !" !" !" !" !"D  	 	 	,w677711	s[   
"F' ,F%C9-F9C=	=F C=	BFF' FF' !F"F' 'GGc                   |                      d          dk    rdS t          j        dk    rdnd}t          j                            d|          }|                                                    d          st          d|z            	 t          | 
                    d                    5  t          j        |d	g          cd d d            S # 1 swxY w Y   d S # t          $ r t          d
|z             Y dS w xY w)Nr   r   r=   rU   rV   rW   rX   rY   r]   r`   )ra   rb   rc   rM   rd   re   rf   rg   rh   r   r:   rj   rk   rm   rA   )r3   rn   ro   s      r4   build_latexpdfjazMake.build_latexpdfja   sL   !!'**Q..1 '*lg&=&=

6*..77}}))&11 	F:WDEEE	t**73344 = =!';<<= = = = = = = = = = = = = = = = = = 	 	 	,w677711	s6   
"C ,CC CC CC C<;C<c                   |                      d          dk    rdS t          j                            dd          }|                                                    d          st          d|z            	 t          |                     d                    5  t          j
        |dg          cd d d            S # 1 swxY w Y   d S # t          $ r t          d|z             Y dS w xY w)	Nr   r   r=   rX   rW   rY   r   r`   )ra   rM   rd   re   rf   rg   rh   r   r:   rj   rk   rm   rA   )r3   ro   s     r4   
build_infozMake.build_info   s7   !!),,q001 *..00}}))&11 	F:WDEEE	t**95566 : :!'899: : : : : : : : : : : : : : : : : : 	 	 	,w677711	s6   6"C B;.C ;B??C B?C C('C(c                l    |                      dd          }|                     d|          dk    rdS dS )Nr    z	.doctrees)
doctreedirr   r=   )r:   ra   )r3   dtdirs     r4   build_gettextzMake.build_gettext   s?    ##I{;;!!)!>>BB1qr6   Nbuilderstrrx   str | os.PathLike[str] | Nonec           
     ^   t          j        dd          }|dv r | j                            dd| dg           ||                     d          }d|d	t          |          t          | j                  t          |                     |                    g}t          || j        z             S )
NPAPERr   >   a4letterz-Dzlatex_elements.papersize=paperdoctreesz	--builderz--doctree-dir)rM   getenvr-   extendr:   r|   r*   r
   )r3   r{   rx   
paper_sizeargss        r4   ra   zMake.run_generic_build   s     Yw++
)))Id$Q
$Q$Q$QRSSS,,Z88J 
OO  ##G,,--
 $*+++r6   )r*   r+   r,   r+   r-   r.   r/   r0   )r7   r+   r/   r   )r/   r;   )r/   r0   r2   )r{   r|   rx   r}   r/   r;   )__name__
__module____qualname__r5   r:   rE   rS   rr   rt   rv   rz   ra    r6   r4   r)   r)   ;   s        	 	 	 	/ / / /   &C C C C. . . .`           IM, , , , , , ,r6   r)   r   r.   r/   r;   c                B   t          |           dk     rt          dt          j                   dS | d         }t	          | d         | d         | dd                    }d| }t          ||          r t          ||                      S |                    |          S )	N   zJError: at least 3 arguments (builder, source dir, build dir) are required.)filer=   r   rH   )r*   r,   r-   build_)lenrA   rb   r_   r)   hasattrgetattrra   )r   builder_namerW   
run_methods       r4   run_make_moder      s    
4yy1}},	
 	
 	
 	

 q7L47d1gDHEEED(,((JtZ   +(wtZ((***!!,///r6   )r   r.   r/   r;   )__doc__
__future__r   rM   rj   rb   
contextlibr   typingr   rJ   sphinx._cli.util.colourr   r   r   r	   sphinx.cmd.buildr
   sphinx.util._pathlibr   sphinx.util.osutilr   collections.abcr   rL   r)   r   r   r6   r4   <module>r      sC    # " " " " " 				     



                    X X X X X X X X X X X X ' ' ' ' ' ' ) ) ) ) ) ) % % % % % % )((((((  @S, S, S, S, S, S, S, S,l0 0 0 0 0 0r6   