3 \x� @s�ddlmZddlmZyTddlmZddlmZddlm Z ddlm Z ddl m Z Gdd �d e�Z d ZWnek r�d ZYnXGd d �d e�ZdS)�)�Command)�DistutilsSetupError)�Reporter)�Parser)�frontend)�nodes)�StringIOc@seZdZd dd�Zdd�ZdS) �SilentReporterNr�ascii�replacec Cs"g|_tj||||||||�dS)N)�messagesr�__init__)�self�source� report_level� halt_level�stream�debug�encoding� error_handler�r�//usr/lib64/python3.6/distutils/command/check.pyr szSilentReporter.__init__cOs6|jj||||f�tj|f|�||j|d�|��S)N)�level�type)r �appendr�system_messageZlevels)rr�messageZchildren�kwargsrrrrszSilentReporter.system_message)Nrr r )�__name__� __module__� __qualname__r rrrrrr s r TFc@s\eZdZdZdddgZdddgZd d �Zd d�Zdd�Zdd�Z dd�Z dd�Z dd�Z dS)�checkz"perform some checks on the package�metadata�m�Verify meta-data�restructuredtext�r�EChecks if long string meta-data syntax are reStructuredText-compliant�strict�s�(Will exit with an error if a check failscCsd|_d|_d|_d|_dS)Nr�)r%r"r(� _warnings)rrrr�initialize_options1szcheck.initialize_optionscCsdS)Nr)rrrr�finalize_options8szcheck.finalize_optionscCs|jd7_tj||�S)Nr+)r,r�warn)r�msgrrrr/;sz check.warncCsL|jr|j�|jr0tr"|j�n|jr0td��|jrH|jdkrHtd��dS)NzThe docutils package is needed.rzPlease correct your package.)r"�check_metadatar%� HAS_DOCUTILS�check_restructuredtextr(rr,)rrrr�run@s z check.runcCs�|jj}g}x*d D]"}t||�o(t||�s|j|�qW|rP|jddj|��|jrh|js�|jd�n"|j r�|j s�|jd�n |jd�dS)N�name�version�urlzmissing required meta-data: %sz, z)missing meta-data: if 'author' supplied, z#'author_email' must be supplied tooz-missing meta-data: if 'maintainer' supplied, z''maintainer_email' must be supplied tooz4missing meta-data: either (author and author_email) z%or (maintainer and maintainer_email) zmust be supplied)r5r6r7zLmissing meta-data: if 'author' supplied, 'author_email' must be supplied toozTmissing meta-data: if 'maintainer' supplied, 'maintainer_email' must be supplied toozYmissing meta-data: either (author and author_email) or (maintainer and maintainer_email) zimissing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied) � distributionr"�hasattr�getattrrr/�joinZauthorZ author_emailZ maintainerZmaintainer_email)rr"Zmissing�attrrrrr1Ps$ zcheck.check_metadatacCs\|jj�}xL|j|�D]>}|djd�}|dkr:|d}nd|d|f}|j|�qWdS)Nr+�linez %s (line %s)�����)r8Zget_long_description�_check_rst_data�getr/)r�dataZwarningr=rrrr3ns  zcheck.check_restructuredtextcCs�t�}t�}tjtfd�j�}d|_d|_d|_t||j |j |j |j |j |jd�}tj|||d�}|j|d�y|j||�Wn:tk r�}z|jjd d|dif�WYdd}~XnX|jS) N)Z components�)rrrr)rr+z!Could not finish the parsing: %s.�r>r>)rrrZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesr rrZwarning_streamrZerror_encodingZerror_encoding_error_handlerr�documentZ note_source�parse�AttributeErrorr r)rrA� source_path�parserZsettingsZreporterrD�errrr?ys*  $zcheck._check_rst_dataN)r"r#r$)r%r&r')r(r)r*) rrr Z descriptionZ user_optionsZboolean_optionsr-r.r/r4r1r3r?rrrrr!$s  r!N)Zdistutils.corerZdistutils.errorsrZdocutils.utilsrZdocutils.parsers.rstrZdocutilsrr�iorr r2� Exceptionr!rrrr�s