
    R&ix	                     P    d Z ddlZddlZddlZddlmZmZ dZd ZddddZ	d Z
dS )	z(Logic for interacting with sphinx-build.    N)ForeStyle))bbuilder)aN)EN)dpath)jN)cr
   )CN)Dzsetting=value)ttag)Az
name=value)nN)vN)qN)QN)wfile)WN)TN)r   N)PNc                ^    t          t          j         d| |  t          j                    d S )Nz[sphinx-autobuild] )printr   GREENr   	RESET_ALL)textcolours     c/home/geonatureadmin/si_en_reseau/tutos/venv/lib/python3.11/site-packages/sphinx_autobuild/build.py_logr#       s2    	TZ
K
KF
KD
K%/
K
KLLLLL    contextcommandc                     | t          | t          j                   |[t          |t          t
          f          sJ t          dd                    d |D                       z   t          j                   dS dS )zIShow context and command-to-be-executed, with nice formatting and colors.N)r!   z>  c              3   >   K   | ]}t          j        |          V  d S )N)shlexquote).0ss     r"   	<genexpr>zshow.<locals>.<genexpr>*   s*      ==U[^^======r$   )r#   r   CYAN
isinstancelisttuplejoinBLUEr%   s     r"   showr6   $   s    WTY'''''D%=11111TCHH==W======diPPPPPP r$   c                J     t           j        ddgz    fd}|S )z'Prepare the function that calls sphinx.z-msphinxc                     j         rt          dj                     	 D ])} t          d|            t          j        | d           *t          dgz              t          j        d           nB# t          j        $ r0}t          d	|j                    t          d
           Y d}~nd}~ww xY wj         rt          d d            dS dS # j         rt          d d            w w xY w)z,Generate the documentation using ``sphinx``.zDetected change: )r&   z	pre-buildr%   T)checkzsphinx-build)r'   zCommand exited with exit code: zThe server will continue serving the build folder, but the contents being served are no longer in sync with the documentation sources. Please fix the cause of the error above or press Ctrl+C to stop the server.NzServing on http://:)filepathr6   
subprocessrunCalledProcessErrorr   
returncode)r'   ehostportpre_build_commandssphinx_argssphinx_commandwatchers     r"   buildzget_builder.<locals>.build1   s    	A?W-=??@@@@	A- 4 4['::::wd33333.)K78888N>66666, 	 	 	BALBBCCC       	  A?$????@@@@@@A Aw A?$????@@@@@As0   AA9 8C 9B8&B3.C 3B88C  C<)sys
executable)rG   rE   rB   rC   rD   rH   rF   s   ````` @r"   get_builderrK   -   s^    ndH5CNA A A A A A A A A A6 Lr$   )__doc__r+   r=   rI   coloramar   r   SPHINX_BUILD_OPTIONSr#   r6   rK    r$   r"   <module>rP      s    . .      



                 .M M M $ Q Q Q Q Q    r$   