3  fx @sdZddlmZddlmZyTddlmZddlmZddl 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|_tj||||||||dS)N)messagesr__init__)selfsource report_level halt_levelstreamdebugencoding error_handlerr}|djd}|dkr:|d}nd|d|f}|j|qWdS)z4Checks if the long string fields are reST-compliant.r+lineNz %s (line %s))r8Zget_long_description_check_rst_datagetr/)rdataZwarningr=rrrr3ns  zcheck.check_restructuredtextcCst}t}tjtfdj}d|_d|_d|_t||j |j |j |j |j |jd}tj|||d}|j|d y|j||Wn:tk r}z|jjd d|difWYdd}~XnX|jS) z8Returns warnings when the provided data doesn't compile.)Z componentsN)rrrr)rr+z!Could not finish the parsing: %s.r>r>)rrrZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesr rrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrdocumentZ note_sourceparseAttributeErrorr r)rrA source_pathparserZsettingsZreporterrDerrrr?ys*  $zcheck._check_rst_dataN)r"r#r$)r%r&r')r(r)r*)rrr __doc__Z descriptionZ user_optionsZboolean_optionsr-r.r/r4r1r3r?rrrrr!$s  r!N)rJZdistutils.corerZdistutils.errorsrZdocutils.utilsrZdocutils.parsers.rstrZdocutilsrriorr r2 Exceptionr!rrrrs