File: //lib/python3/dist-packages/sphinx/cmd/__pycache__/build.cpython-310.pyc
o
�$�a�0 � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl m
Z
mZmZ ddl
mZ ddlZddlmZmZ ddlmZ ddlmZ ddlmZ dd lmZmZmZ dd
lmZmZmZm Z ddl!m"Z"m#Z# ej$fded
ede%de
ddf
dd�Z&de'de(fdd�Z)dej*fdd�Z+ej,dd� fdee' de(fdd�Z-ej,dd� fdee' de(fdd�Z.ej,dd� fdee' de(fdd�Z/e0d kr�e�1e/ej,dd� �� dS dS )!z�
sphinx.cmd.build
~~~~~~~~~~~~~~~~
Build documentation from a provided source.
:copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
� N)�IO�Any�List)�
SystemMessage)�__display_version__�package_dir)�Sphinx)�SphinxError)�__)�Tee�format_exception_cut_frames�save_traceback)�color_terminal�nocolor�red�
terminal_safe)�docutils_namespace�patch_docutils�app�args� exception�stderr�returnc C s& t |tj�rd S |jr$tttd��|d� t�� t� t
�� d � d S t|d� |js/|jr:t�d |� t|d� t |t
�rIttd�|d� d S t |t�retttd��|d� tt|jd �|d� d S t |t�rttd|j �|d� tt|�|d� d S t |t�r�tttd��|d� ttt|��|d� t| �}tttd �| �|d� d S t |t�r�d
t|�v r�tttd��|d� ttt|��|d� t|d� ttd�|d� td
|d� d S tttd��|d� tt� �� |d� t| �}tttd �| �|d� ttd�|d� ttd�|d� d S )Nz5Exception occurred while building, starting debugger:)�file� zInterrupted!zreST markup error:r z%s:zEncoding error:z[The full traceback has been saved in %s, if you want to report the issue to the developers.zrecursion depthzRecursion error:z�This can happen with very large or deeply nested source files. You can carefully increase the default Python recursion limit of 1000 in conf.py with e.g.:z+ import sys; sys.setrecursionlimit(1500)zException occurred:ziPlease also report this if it was a user error, so that a better error message can be provided next time.zbA bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!)�
isinstance�bdb�BdbQuit�pdb�printr r
� traceback� print_exc�post_mortem�sys�exc_info� verbosity�KeyboardInterruptr r r r �category�str�UnicodeErrorr
�RuntimeErrorr �rstrip)r r r r �tbpath� r- �2/usr/lib/python3/dist-packages/sphinx/cmd/build.py�handle_exception! sf �
�
�
�
���
�r/ �valuec C s2 | dkrt �� S t| �}|dkrt�td���|S )z�
Special type to handle 'auto' flags passed to 'sphinx-build' via -j flag. Can
be expanded to handle other special scaling requests, such as setting job count
to cpu_count.
�autor z&job number should be a positive number)�multiprocessing� cpu_count�int�argparse�ArgumentTypeErrorr
)r0 �jobsr- r- r. �
jobs_argumentU s r8 c C sx t jdtd�td�d�} | jddddt d � | jd
td�d� | jd
td�d� | jddtd�d� | �td��}|jddddtd�d� |jdddtd�d� |jddd td!�d� |jd"d#d$td%�d&� |jd'd(d)td*td+�d,� | �d-�}|jd.d#d/td0�d&� |jd1dd2td3�d� |jd4d5d6d7g td8�d9� |jd:d;d6d<g td=�d9� |jd>d?d6d@g tdA�d9� |jdBddCtdD�d� | �tdE��}|jdFdGdHdItdJ�dK� |jdLddMtdN�d� |jdOddPtdQ�d� |jdRdSdTdUtdV�dW� |jdXdYdZdSd[td\�d]� |jd^d_d`tda�d&� |jdbddctdd�d� |jdeddftdg�d� |jdhdditdj�d� |jdkddltdm�d� | S )nNz5%(prog)s [OPTIONS] SOURCEDIR OUTPUTDIR [FILENAMES...]z:For more information, visit <https://www.sphinx-doc.org/>.a�
Generate documentation from source files.
sphinx-build generates documentation from the files in SOURCEDIR and places it
in OUTPUTDIR. It looks for 'conf.py' in SOURCEDIR for the configuration
settings. The 'sphinx-quickstart' tool may be used to generate template files,
including 'conf.py'
sphinx-build can create documentation in different formats. A format is
selected by specifying the builder name on the command line; it defaults to
HTML. Builders can also perform other tasks related to documentation
processing.
By default, everything that is outdated is built. Output only for selected
files can be built by specifying individual filenames.
)�usage�epilog�descriptionz --version�version�show_versionz%%(prog)s %s)�action�destr<