a oe@sdZddlZddlmZddlmZeeDddlZ ddl Z ddl Z ddl Z Gddde j jZWdn1sx0YGdd d eZdS) zCdistutils.command.check Implements the Distutils 'check' command. N)Command)DistutilsSetupErrorcs&eZdZd fdd ZddZZS) SilentReporterNrasciireplacec s"g|_t|||||||dSN)messagessuper__init__)selfsource report_level halt_levelstreamdebugencoding error_handler __class__DC:\Program Files\Certbot\pkgs\setuptools\_distutils\command\check.pyr s zSilentReporter.__init__cOs:|j||||ftjj|g|R||j|d|S)N)leveltype)r appenddocutilsnodessystem_messageZlevels)r rmessageZchildrenkwargsrrrr s zSilentReporter.system_message)Nrrr)__name__ __module__ __qualname__r r __classcell__rrrrrs rc@s\eZdZdZdZgdZgdZddZddZd d Z d d Z d dZ ddZ ddZ dS)checkz1This command checks the meta-data of the package.z"perform some checks on the package))metadatamzVerify meta-data)restructuredtextrzEChecks if long string meta-data syntax are reStructuredText-compliant)strictsz(Will exit with an error if a check fails)r%r'r)cCsd|_d|_d|_d|_dS)z Sets default values for options.rN)r'r%r) _warningsr rrrinitialize_options:szcheck.initialize_optionscCsdSrrr-rrrfinalize_optionsAszcheck.finalize_optionscCs|jd7_t||S)z*Counts the number of warnings that occurs.r+)r,rwarn)r msgrrrr0Dsz check.warnc Cs|jr||jrldtvr^z |WqltyZ}ztt|WYd}~qld}~00n|jrltd|jr|j dkrtddS)zRuns the command.rNzThe docutils package is needed.rzPlease correct your package.) r%check_metadatar'globalscheck_restructuredtext TypeErrorrstrr)r,)r excrrrrunIs  $z check.runcCsH|jj}g}dD]}t||ds||q|rD|dd|dS)zEnsures that all required elements of meta-data are supplied. Required fields: name, version Warns if any are missing. )nameversionNzmissing required meta-data: %sz, ) distributionr%getattrrr0join)r r%missingattrrrrr2\s  zcheck.check_metadatacCsX|j}||D]>}|dd}|dur8|d}nd|d|}||qdS)z4Checks if the long string fields are reST-compliant.lineNr+z {} (line {}))r;Zget_long_description_check_rst_datagetformatr0)r dataZwarningrArrrr4ns  zcheck.check_restructuredtextc Cs|jjp d}tjj}tjjtjjjfd}d|_ d|_ d|_ t ||j |j|j|j|j|jd}tjj|||d}||dz|||Wn<ty}z$|jdd|d ifWYd}~n d}~00|jS) z8Returns warnings when the provided data doesn't compile.zsetup.py) componentsN)rrrr)r r@z!Could not finish the parsing: %s.)r; script_namerparsersZrstZParserZfrontendZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesrrrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrdocumentZ note_sourceparseAttributeErrorr r)r rE source_pathparserZsettingsZreporterrKerrrrBys4     zcheck._check_rst_dataN)r r!r"__doc__ descriptionZ user_optionsZboolean_optionsr.r/r0r8r2r4rBrrrrr$'s  r$)rQ contextlibZcorererrorsrsuppress ImportErrorZdocutils.utilsrZdocutils.parsers.rstZdocutils.frontendZdocutils.nodesZutilsZReporterrr$rrrrs   2