U ,a@sdZddlmZddlmZzTddlmZddlmZddl m Z ddl m Z ddl m Z Gd d d eZd ZWnek rd ZYnXGd ddeZdS)zCdistutils.command.check Implements the Distutils 'check' command. )Command)DistutilsSetupError)Reporter)Parser)frontend)nodes)StringIOc@seZdZd ddZddZdS) SilentReporterNrasciireplacec Cs"g|_t||||||||dSN)messagesr__init__)selfsource report_level halt_levelstreamdebugencoding error_handlerr}|dd}|dkr8|d}nd|d|f}||qdS)z4Checks if the long string fields are reST-compliant.lineNr)z %s (line %s))r6Zget_long_description_check_rst_datagetr.)rdataZwarningr<rrrr2ns  zcheck.check_restructuredtextc Cs|jjp d}t}tjtfd}d|_d|_d|_t ||j |j |j |j |j|jd}tj|||d}||dz|||Wn:tk r}z|jdd|d ifW5d}~XYnX|jS) z8Returns warnings when the provided data doesn't compile.zsetup.py)Z componentsN)rrrr)rr;z!Could not finish the parsing: %s.)r6Z script_namerrZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesr rrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrdocumentZ note_sourceparseAttributeErrorr r)rr? source_pathparserZsettingsZreporterrBerrrr=ys.  zcheck._check_rst_dataN)rr r!__doc__Z descriptionZ user_optionsZboolean_optionsr,r-r.r3r0r2r=rrrrr"$s  r"N)rHZdistutils.corerZdistutils.errorsrZdocutils.utilsrZdocutils.parsers.rstrZdocutilsrriorr r1 Exceptionr"rrrrs