Current File : //usr/lib/python3/dist-packages/setuptools/_distutils/command/__pycache__/check.cpython-312.pyc
�


_�d����dZddlZddlmZddlmZeje�5ddlZ	ddl
Z	ddlZ	ddlZ	Gd�de	jj�Zddd�Gd�d	e�Zy#1swY�xYw)
zCdistutils.command.check

Implements the Distutils 'check' command.
�N�)�Command)�DistutilsSetupErrorc�.��eZdZ				d�fd�	Zd�Z�xZS)�SilentReporterc	�>��g|_t�|�	|||||||�y�N)�messages�super�__init__)	�self�source�report_level�
halt_level�stream�debug�encoding�
error_handler�	__class__s	        ��E/usr/lib/python3/dist-packages/setuptools/_distutils/command/check.pyrzSilentReporter.__init__s(����D�M��G����j�&�%��=�
�c��|jj||||f�tjj|g|��||j
|d�|��S)N)�level�type)r
�append�docutils�nodes�system_message�levels)r
r�message�children�kwargss     rrzSilentReporter.system_message sZ���M�M� � �%��(�F�!C�D��>�>�0�0���@H��$�4�;�;�u�+=��LR��
r)Nr�ascii�replace)�__name__�
__module__�__qualname__rr�
__classcell__)rs@rrrs������#�
	�	rrc�N�eZdZdZdZgd�Zgd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�checkz1This command checks the meta-data of the package.z"perform some checks on the package))�metadata�mzVerify meta-data)�restructuredtext�rzEChecks if long string meta-data syntax are reStructuredText-compliant)�strict�sz(Will exit with an error if a check fails)r+r-r/c�<�d|_d|_d|_d|_y)z Sets default values for options.r�N)r-r+r/�	_warnings�r
s r�initialize_optionszcheck.initialize_options:s�� !�����
������rc��yr	�r4s r�finalize_optionszcheck.finalize_optionsAs��rc�X�|xjdz
c_tj||�S)z*Counts the number of warnings that occurs.r2)r3r�warn)r
�msgs  rr:z
check.warnDs!�����!����|�|�D�#�&�&rc�V�|jr|j�|jr5dt�vr	|j	�n|jrt
d��|jr|jdkDrt
d��yy#t
$r}t
t|���d}~wwxYw)zRuns the command.rNzThe docutils package is needed.rzPlease correct your package.)
r+�check_metadatar-�globals�check_restructuredtext�	TypeErrorr�strr/r3)r
�excs  r�runz	check.runIs����=�=����!�� � ��W�Y�&�8��/�/�1����)�*K�L�L��;�;�4�>�>�A�-�%�&D�E�E�.�;��!�8�-�c�#�h�7�7��8�s�B�	B(�B#�#B(c���|jj}g}dD]!}t||d�r�|j|��#|r$|j	ddj|�z�yy)z�Ensures that all required elements of meta-data are supplied.

        Required fields:
            name, version

        Warns if any are missing.
        )�name�versionNzmissing required meta-data: %sz, )�distributionr+�getattrrr:�join)r
r+�missing�attrs    rr=zcheck.check_metadata\sf���$�$�-�-����%�	%�D��8�T�4�0����t�$�	%���I�I�6����7�9K�K�L�rc���|jj�}|j|�D]D}|djd�}|�|d}ndj	|d|�}|j|��Fy)z4Checks if the long string fields are reST-compliant.����lineNr2z{} (line {}))rG�get_long_description�_check_rst_data�get�formatr:)r
�data�warningrNs    rr?zcheck.check_restructuredtextnsr��� � �5�5�7���+�+�D�1�	�G��2�;�?�?�6�*�D��|�!�!�*��(�/�/���
�D�A���I�I�g��
	rc	��|jjxsd}tjjj�}tjjtjjj
f��j�}d|_	d|_
d|_t||j|j|j|j |j"|j$��}tj&j)|||��}|j+|d�	|j-||�|j0S#t.$r7}|j0j3dd|zd	if�Yd}~|j0Sd}~wwxYw)
z8Returns warnings when the provided data doesn't compile.zsetup.py)�
components�N)rrrr)rrMz!Could not finish the parsing: %s.�)rG�script_namer�parsers�rst�Parser�frontend�OptionParser�get_default_values�	tab_width�pep_references�rfc_referencesrrr�warning_streamr�error_encoding�error_encoding_error_handlerr�document�note_source�parse�AttributeErrorr
r)r
rS�source_path�parser�settings�reporterrf�es        rrPzcheck._check_rst_dataysg���'�'�3�3�A�z���!�!�%�%�,�,�.���$�$�1�1� �(�(�,�,�3�3�5�2�
�
�
�
�	����"&���"&���!���!�!�����*�*��.�.��,�,�"�?�?�
���>�>�*�*�8�X�k�*�R�����[�"�-�	��L�L��x�(�� � � ���	����$�$��8�1�<�b�"�E�
�
�� � � ��	�s�,E
�
	F
�"F�F
N)r%r&r'�__doc__�description�user_options�boolean_optionsr5r8r:rCr=r?rPr7rrr*r*'s>��;�6�K��L�A�O��
�'�
F�&M�$	�!rr*)ro�
contextlib�corer�errorsr�suppress�ImportError�docutils.utilsr�docutils.parsers.rst�docutils.frontend�docutils.nodes�utils�Reporterrr*r7rr�<module>r~sj�����(��Z����%����������0�0��
�:p!�G�p!�;��s�0A)�)A2