a „oeã@s–dZddlZddlmZddlmZe e¡�DddlZ ddl Z ddl Z ddl Z Gdd„de j jƒZWdƒn1sx0YGdd „d eƒZdS) zCdistutils.command.check Implements the Distutils 'check' command. éNé)ÚCommand)ÚDistutilsSetupErrorcs&eZdZd ‡fdd„ Zdd„Z‡ZS) ÚSilentReporterNrÚasciiÚreplacec s"g|_tƒ |||||||¡dS©N)ÚmessagesÚsuperÚ__init__)ÚselfÚsourceÚ report_levelÚ halt_levelÚstreamÚdebugÚencodingÚ error_handler©Ú __class__©úDC:\Program Files\Certbot\pkgs\setuptools\_distutils\command\check.pyr s ÿzSilentReporter.__init__cOs:|j ||||f¡tjj|g|¢R||j|dœ|¤ŽS)N)ÚlevelÚtype)r ÚappendÚdocutilsÚnodesÚsystem_messageZlevels)r rÚmessageZchildrenÚkwargsrrrr sÿÿ ÿÿzSilentReporter.system_message)Nrrr)Ú__name__Ú __module__Ú __qualname__r rÚ __classcell__rrrrrs ørc@s\eZdZdZdZgd¢Zgd¢Zdd„Zdd„Zd d „Z d d „Z d d„Z dd„Z dd„Z dS)Ú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)cCsd|_d|_d|_d|_dS)z Sets default values for options.réN)r'r%r)Ú _warnings©r rrrÚinitialize_options:szcheck.initialize_optionscCsdSrrr-rrrÚfinalize_optionsAszcheck.finalize_optionscCs|jd7_t ||¡S)z*Counts the number of warnings that occurs.r+)r,rÚwarn)r Úmsgrrrr0Dsz check.warnc Csˆ|jr| ¡|jrldtƒvr^z | ¡WqltyZ}ztt|ƒƒ‚WYd}~qld}~00n|jrltdƒ‚|jr„|j dkr„tdƒ‚dS)zRuns the command.rNzThe docutils package is needed.rzPlease correct your package.) r%Úcheck_metadatar'ÚglobalsÚcheck_restructuredtextÚ TypeErrorrÚstrr)r,)r ÚexcrrrÚrunIs  $z check.runcCsH|jj}g}dD]}t||dƒs| |¡q|rD| dd |¡¡dS)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%Úgetattrrr0Újoin)r r%ÚmissingÚattrrrrr2\s  zcheck.check_metadatacCsX|j ¡}| |¡D]>}|d d¡}|dur8|d}nd |d|¡}| |¡qdS)z4Checks if the long string fields are reST-compliant.éÿÿÿÿÚlineNr+z {} (line {}))r;Zget_long_descriptionÚ_check_rst_dataÚgetÚformatr0)r ÚdataZwarningrArrrr4ns  zcheck.check_restructuredtextc CsØ|jjp d}tjj ¡}tjjtjjjfd� ¡}d|_ d|_ d|_ t ||j |j|j|j|j|jd�}tjj|||d�}| |d¡z| ||¡Wn<tyÐ}z$|j dd|d if¡WYd}~n d}~00|jS) z8Returns warnings when the provided data doesn't compile.zsetup.py)Ú componentséN)rrrr)r r@z!Could not finish the parsing: %s.Ú)r;Ú script_namerÚparsersZrstZParserZfrontendZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesrrrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrÚdocumentZ note_sourceÚparseÚAttributeErrorr r)r rEÚ source_pathÚparserZsettingsZreporterrKÚerrrrBys4   ÿ ù  ÿzcheck._check_rst_dataN)r r!r"Ú__doc__Ú descriptionZ user_optionsZboolean_optionsr.r/r0r8r2r4rBrrrrr$'s  r$)rQÚ contextlibZcorerÚerrorsrÚsuppressÚ ImportErrorZdocutils.utilsrZdocutils.parsers.rstZdocutils.frontendZdocutils.nodesZutilsZReporterrr$rrrrÚs   2