a Z^@sddlmZddlmZzHddlmZddlmZddlm Z ddlm Z GdddeZ d Z Wne yvd Z Yn0Gd d d eZd S))Command)DistutilsSetupError)Reporter)Parser)frontend)nodesc@seZdZd ddZddZdS) SilentReporterNrasciireplacec Cs"g|_t||||||||dSN)messagesr__init__)selfsource report_level halt_levelstreamdebugencoding error_handlerr//usr/lib64/python3.9/distutils/command/check.pyr szSilentReporter.__init__cOs8|j||||ftj|g|R||j|d|S)N)leveltype)r appendrsystem_messageZlevels)rrmessageZchildrenkwargsrrrrszSilentReporter.system_message)Nrr r )__name__ __module__ __qualname__r rrrrrrs rTFc@sXeZdZdZgdZgdZddZddZdd Zd d Z d d Z 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 fails)r"r$r&cCsd|_d|_d|_d|_dS)Nr)r$r"r& _warningsrrrrinitialize_options0szcheck.initialize_optionscCsdSr rr*rrrfinalize_options7szcheck.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)r*rrrrun?s z check.runcCs|jj}g}dD]"}t||r(t||s||q|rL|dd||jrd|js|dn"|j r||j s|dn |ddS)N)nameversionurlzmissing required meta-data: %sz, zNmissing meta-data: if 'author' supplied, 'author_email' should be supplied toozVmissing meta-data: if 'maintainer' supplied, 'maintainer_email' should be supplied toozkmissing meta-data: either (author and author_email) or (maintainer and maintainer_email) should be supplied) distributionr"hasattrgetattrrr-joinZauthorZ author_emailZ maintainerZmaintainer_email)rr"missingattrrrrr/Os    zcheck.check_metadatacCsX|j}||D]>}|dd}|dur8|d}nd|d|f}||qdS)Nliner(z %s (line %s))r6Zget_long_description_check_rst_datagetr-)rdatawarningr=rrrr1ps  zcheck.check_restructuredtextc Cs|jjp d}t}tjtfd}d|_d|_d|_t ||j |j |j |j |j|jd}tj|||d}||dz|||Wn<ty}z$|jdd|difWYd}~n d}~00|jS) Nzsetup.py) components)rrrr)rr<z!Could not finish the parsing: %s.)r6 script_namerrZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesrrrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrdocumentZ note_sourceparseAttributeErrorr r)rr@ source_pathparserZsettingsZreporterrFerrrr>{s.  zcheck._check_rst_dataN) rrr descriptionZ user_optionsZboolean_optionsr+r,r-r2r/r1r>rrrrr!#s! r!N)Zdistutils.corerZdistutils.errorsrZdocutils.utilsrZdocutils.parsers.rstrZdocutilsrrrr0 Exceptionr!rrrrs