Your IP : 216.73.216.172


Current Path : /lib/python3/dist-packages/pbr/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/pbr/__pycache__/builddoc.cpython-38.pyc

U

jP�^�.�
@s6ddlmZddlZddlZddlZzddlZWnek
rLddlZYnXz^ddlZzddl	m
Z
dZWn$ek
r�ddlm
Z
dZYnXddlmZddlm
Z
Wn.ek
r�Zzeee���W5dZ[XYnXddlmZdd	lmZdd
lmZddd
dgZddgZdZdd�ZGdd�de
j�ZdS)�)�logN)�apidocFT)�application)�
setup_command)�git)�options)�version�autodoc_tree_index_modules�autodoc_index_modules�autodoc_tree_excludes�autodoc_exclude_modules�AUTODOC_TREE_INDEX_MODULES�AUTODOC_INDEX_MODULESzi%(heading)s
%(underline)s

.. automodule:: %(module)s
  :members:
  :undoc-members:
  :show-inheritance:
cCs@|D]6}|�d�r|dkrd|d|�dd�|dd�f<qdS)Nz.pyz__init__.pyTz%s.%s�/�.���)�endswith�replace)�arg�dirname�files�filename�r�./usr/lib/python3/dist-packages/pbr/builddoc.py�
_find_modulesIs�
�rc@sTeZdZdgZdZdZdd�Zddd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)�
LocalBuildDoc�html�build_sphinxFcCsj|j�d�}|j�d�}|�dd�\}}d|krHtj�|dd|�}nd|}tj�|�sft�|�|S)Nr�pbr�api_doc_dir)NZapi�
source_dir�zdoc/source/)�distribution�get_option_dict�get�os�path�join�exists�makedirs)�self�option_dictZpbr_option_dict�_rr rrr�_get_source_dirVs�
zLocalBuildDoc._get_source_dirNcs2t�dtj�tj��i}|��}|jjD].}d|kr,t�	|�D]\}}}t
|||�qBq,�fdd��t�fdd�|��D��}tj�
|d�}	t|	d���}
|
�d	�|D]x}tj�
|d
|�}d|}
dt|
�}t||
|d
�}t�d|�t|d��}|�t|�W5QRX|
�d|�q�W5QRXdS)Nz[pbr] Autodocumenting from %srcst�fdd��D��S)Nc3s|]}t��|�VqdS�N)�fnmatch)�.0Zpat��modulerr�	<genexpr>ns�zDLocalBuildDoc.generate_autoindex.<locals>.include.<locals>.<genexpr>)�anyr1)�excluded_modulesr1r�includems�z1LocalBuildDoc.generate_autoindex.<locals>.includec3s|]}�|�r|VqdSr.r)r0�mod)r6rrr3qsz3LocalBuildDoc.generate_autoindex.<locals>.<genexpr>z
autoindex.rst�wz.. toctree::
   :maxdepth: 1

z%s.rstzThe :mod:`%s` Module�=)r2�heading�	underlinez[pbr] Generating %sz
   %s.rst
)r�infor%r&�abspath�curdirr-r"Zpackages�walkr�sorted�keysr'�open�write�len�dict�
_rst_template)r*r5�modulesr �pkg�dirpathZdirnamesrZmodule_listZautoindex_filenameZ	autoindexr2Zoutput_filenamer:r;�valuesZoutput_filer)r5r6r�generate_autoindexcs:�
���z LocalBuildDoc.generate_autoindexcCs:|��}ddd|dg}tr&|�dd�t�||j�dS)Nz-HZModulesz-orrr)r-�apidoc_use_padding�insertr�mainr)r*r �cmdrrr�_sphinx_tree�s
zLocalBuildDoc._sphinx_treecCs^|jst��}ntj}i}|jr*|j|d<|jr:|j|d<|jrJ|j|d<|jrZ|j|d<|j	rrddddd	g|d
<t
j|j|j
|j|j|j|||j|jd�	}d|_	z|j|jd
�Wnttk
�r(}zTddlm}t||j��rtj�d�tj�|jd�dd��tj�d�n�W5d}~XYnX|j�rZ|j j!|jj"}|j�#d�}t$�%||�dS)N�projectr�release�todayzapp.add_directivezapp.add_rolezapp.add_generic_rolezapp.add_nodezimage.nonlocal_uriZsuppress_warnings)ZfreshenvZwarningiserrorT)Z	force_allr)�utilszreST markup error:
�ascii�backslashreplace�
�index)&�verbose�	cStringIO�StringIO�sys�stdoutrQrrRrS�sphinx_initializedrZSphinxr Z
config_dirZbuilder_target_dirZdoctree_dir�builderZ	fresh_env�warning_is_errorZbuildZ	all_files�	ExceptionZdocutilsrT�
isinstanceZ
SystemMessageZstderrC�stderr�args�encodeZ
link_indexZconfigZ
master_docZ
out_suffixZget_outfilenamer%�symlink)r*Z
status_streamZ
confoverridesZapp�errrT�srcZdstrrr�_sphinx_run�s\




���zLocalBuildDoc._sphinx_runc	Cst|j�d�}t|����t�}ttdd�t��}|s8|rjd}|rP|dt|�7}|r`|d|7}t	�
|�t��r�tj
|d�tj|d�t�|dd	�}t�|d
d�}t�d�s�|r�|��|r�|�t|�d
ddg�d����|��tj�tj�t�dd�k}|�st	�
d�|jdgk�r:t	�
d�|�r:|j|_|�rLtj �!|�S|jD]}||_|��|�"��qRdS)NrcSs
t�|�Sr.)r%�getenv)�xrrr�<lambda>��z#LocalBuildDoc.run.<locals>.<lambda>z�The autodoc and autodoc_tree features are deprecated in 4.2 and will be removed in a future release. You should use the sphinxcontrib-apidoc Sphinx extension instead. Refer to the pbr documentation for more information.z Deprecated options: %sz% Deprecated environment variables: %s)r+r	r
r
rZSPHINX_DEBUGr�r!�zQ[pbr] Support for Sphinx < 1.6 will be dropped in pbr 4.0. Upgrade to Sphinx 1.6+ra'[pbr] Sphinx 1.6 added native support for specifying multiple builders in the '[sphinx_build] builder' configuration option, found in 'setup.cfg'. As a result, the '[sphinx_build] builders' option has been deprecated and will be removed in pbr 4.0. Migrate to the 'builder' configuration option.)#r"r#�setrA�intersection�_deprecated_options�list�filter�_deprecated_envsr�warnrZ_git_is_installedZwrite_git_changelogZgenerate_authorsrZget_boolean_optionr%rjrPrKr$�split�finalize_optionsrZSemanticVersionZfrom_pip_string�sphinx�__version__�buildersr_r�BuildDoc�runri)	r*r+Z	warn_optsZwarn_env�msgZ
tree_indexZ
auto_indexZis_multibuilder_sphinxr_rrrr}�sf
��
����
�


zLocalBuildDoc.runcCstj�|�dg|_dS)Nzsetup.py)rr|�initialize_optionsr)r*rrrrsz LocalBuildDoc.initialize_optionscCs�ddlm}tj�|�|j�d�}d|�dgg�dkrH|dd|_t	|jt
�sh|jrh|j�d�|_|j��|_
|j��|_|j��|_d}|j�d	�}||kr�|�||d�|_t|d
�s�d|_dS)Nr)�utilrzcommand liner_r!�,rrr`F)rr�rr|rxr"r#r$r{rbrsrwZget_namerQZget_versionrrRZsplit_multiliner�hasattrr`)r*r�r+Zoptrrrrxs$
�
zLocalBuildDoc.finalize_options)N)
�__name__�
__module__�__qualname__r{Zcommand_namer^r-rKrPrir}rrxrrrrrPs
#,Gr)Z	distutilsrr/r%r\rZ�ImportError�ioryZ
sphinx.extrrLrrra�e�strrrrrrrrurFrr|rrrrr�<module>s<
�