a Z^c@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)levelZtype)r appendrsystem_messageZlevels)r rZmessageZchildrenZkwargsrrrrszSilentReporter.system_message)Nrrr )__name__ __module__ __qualname__r rrrrrrs rTFc@sXeZdZdZgdZgdZddZddZdd Zd d Z d d Z ddZ ddZ dS)checkz"perform some checks on the package))metadataZmzVerify meta-data)restructuredtextZrzEChecks if long string meta-data syntax are reStructuredText-compliant)strictZsz(Will exit with an error if a check fails)rrr cCsd|_d|_d|_d|_dS)Nr)rrr _warningsr rrrinitialize_options0szcheck.initialize_optionscCsdSr rr#rrrfinalize_options7szcheck.finalize_optionscCs|jd7_t||S)Nr!)r"rwarn)r Zmsgrrrr&:sz check.warncCsL|jr||jr0tr"|n|jr0td|jrH|jdkrHtddS)NzThe docutils package is needed.rzPlease correct your package.)rcheck_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)ZnameZversionZurlzmissing 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) distributionrZhasattrZgetattrrr&ZjoinZauthorZ author_emailZ maintainerZmaintainer_email)r rZmissingZattrrrrr'Os    zcheck.check_metadatacCsX|j}||D]>}|dd}|dur8|d}nd|d|f}||qdS)Nliner!z %s (line %s))r+Zget_long_description_check_rst_dataZgetr&)r dataZwarningr-rrrr)ps  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)Z componentsi)rrrr)rr,z!Could not finish the parsing: %s.Z)r+Z script_namerrZ OptionParserZget_default_valuesZ tab_widthZpep_referencesZrfc_referencesrrrZwarning_streamrZerror_encodingZerror_encoding_error_handlerrdocumentZ note_sourceZparseZAttributeErrorr r)r r/Z source_pathZparserZsettingsZreporterr0Zerrrr.{s.  zcheck._check_rst_dataN) rrrZ descriptionZ user_optionsZboolean_optionsr$r%r&r*r'r)r.rrrrr#s! rN)Zdistutils.corerZdistutils.errorsrZdocutils.utilsrZdocutils.parsers.rstrZdocutilsrrrr(Z ExceptionrrrrrZs