B 11b@sddlmZddlmZyTddlmZddlmZddlm Z ddlm Z ddl m Z Gdd d eZ d ZWnek rd ZYnXGd d d eZdS))Command)DistutilsSetupError)Reporter)Parser)frontend)nodes)StringIOc@seZdZd ddZddZdS) SilentReporterNrasciireplacec Cs"g|_t||||||||dS)N)messagesr__init__)selfsource report_level halt_levelstreamdebugencoding error_handlerr:/opt/alt/python37/lib/python3.7/distutils/command/check.pyr szSilentReporter.__init__cOs6|j||||ftj|f|||j|d|S)N)leveltype)r appendrsystem_messageZlevels)rrmessageZchildrenkwargsrrrrszSilentReporter.system_message)Nrr r )__name__ __module__ __qualname__r rrrrrr s r TFc@s\eZdZdZdddgZdddgZdd Zd d Zd d ZddZ ddZ ddZ ddZ dS)checkz"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 failsr"r$r&cCsd|_d|_d|_d|_dS)Nr)r$r"r& _warnings)rrrrinitialize_options1szcheck.initialize_optionscCsdS)Nr)rrrrfinalize_options8szcheck.finalize_optionscCs|jd7_t||S)Nr()r)rwarn)rmsgrrrr,;sz check.warncCsL|jr||jr0tr"|n|jr0td|jrH|jdkrHtddS)NzThe docutils package is needed.rzPlease correct your package.)r"check_metadatar$ HAS_DOCUTILScheck_restructuredtextr&rr))rrrrrun@s z check.runcCs|jj}g}x*dD]"}t||r*t||s||qW|rP|dd||jrh|js|dn"|j r|j s|dn |ddS)N)nameversionZurlzmissing required meta-data: %sz, zLmissing meta-data: if 'author' supplied, 'author_email' must be supplied toozTmissing meta-data: if 'maintainer' supplied, 'maintainer_email' must be supplied toozimissing meta-data: either (author and author_email) or (maintainer and maintainer_email) must be supplied) distributionr"hasattrgetattrrr,joinZauthorZ author_emailZ maintainerZmaintainer_email)rr"missingattrrrrr.Ps   zcheck.check_metadatacCs\|j}xL||D]>}|dd}|dkr:|d}nd|d|f}||qWdS)Nliner(z %s (line %s))r4Zget_long_description_check_rst_datagetr,)rdataZwarningr;rrrr0ns  zcheck.check_restructuredtextc Cs|jjp d}t}tjtfd}d|_d|_d|_t ||j |j |j |j |j|jd}tj|||d}||dy|||Wn:tk r}z|jdd|difWdd}~XYnX|jS) Nzsetup.py)Z components)rrrr)rr:z!Could not finish the parsing: %s.)r4Z script_namerrZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesr rrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrdocumentZ note_sourceparseAttributeErrorr r)rr> source_pathparserZsettingsZreporterrAerrrr<ys*   $zcheck._check_rst_dataN) rrr descriptionZ user_optionsZboolean_optionsr*r+r,r1r.r0r<rrrrr!$s  r!N)Zdistutils.corerZdistutils.errorsrZdocutils.utilsrZdocutils.parsers.rstrZdocutilsrriorr r/ Exceptionr!rrrrs