
    ʨsg!                         d Z ddlZddlmZ ddlmZ  ej                  e      5  ddlZ	ddl
Z	ddlZ	ddlZ	 G d de	j                  j                        Zddd        G d d	e      Zy# 1 sw Y   xY w)
zCdistutils.command.check

Implements the Distutils 'check' command.
    N   )Command)DistutilsSetupErrorc                   .     e Zd Z	 	 	 	 d fd	Zd Z xZS )SilentReporterc           	      >    g | _         t        | 	  |||||||       y N)messagessuper__init__)	selfsourcereport_level
halt_levelstreamdebugencodingerror_handler	__class__s	           V/var/www/html/venv/lib/python3.12/site-packages/setuptools/_distutils/command/check.pyr   zSilentReporter.__init__   s(     DMGj&%=    c                     | j                   j                  ||||f       t        j                  j                  |g||| j
                  |   d|S )N)leveltype)r
   appenddocutilsnodessystem_messagelevels)r   r   messagechildrenkwargss        r   r   zSilentReporter.system_message!   sZ    MM  %(F!CD>>00"*/dkk%6HLR r   )NFasciireplace)__name__
__module____qualname__r   r   __classcell__)r   s   @r   r   r      s     #		r   r   c                   N    e Zd ZdZdZg dZg dZd Zd Zd Z	d Z
d	 Zd
 Zd Zy)checkz1This command checks the meta-data of the package.z"perform some checks on the package))metadatamzVerify meta-data)restructuredtextrzEChecks if long string meta-data syntax are reStructuredText-compliant)strictsz(Will exit with an error if a check fails)r+   r-   r/   c                 <    d| _         d| _        d| _        d| _        y)z Sets default values for options.F   r   N)r-   r+   r/   	_warningsr   s    r   initialize_optionszcheck.initialize_options;   s     %r   c                      y r	    r4   s    r   finalize_optionszcheck.finalize_optionsB   s    r   c                 X    | xj                   dz  c_         t        j                  | |      S )z*Counts the number of warnings that occurs.r2   )r3   r   warn)r   msgs     r   r:   z
check.warnE   s!    !||D#&&r   c                 V   | j                   r| j                          | j                  r5dt               v r	 | j	                          n| j                  rt        d      | j                  r| j                  dkD  rt        d      yy# t
        $ r}t        t        |            d}~ww xY w)zRuns the command.r   NzThe docutils package is needed.r   zPlease correct your package.)
r+   check_metadatar-   globalscheck_restructuredtext	TypeErrorr   strr/   r3   )r   excs     r   runz	check.runJ   s     ==!  WY&8//1 )*KLL ;;4>>A-%&DEE .; ! 8-c#h778s   B 	B(B##B(c                     | j                   j                  }dD cg c]  }t        ||d      r| }}|r0| j                  dj	                  dj                  |                   yyc c}w )zEnsures that all required elements of meta-data are supplied.

        Required fields:
            name, version

        Warns if any are missing.
        )nameversionNzmissing required meta-data: {}z, )distributionr+   getattrr:   formatjoin)r   r+   attrmissings       r   r=   zcheck.check_metadata]   sm     $$-- 1
$PT8UD
 
 II6==dii>PQR 	
s
   A'A'c                     | j                   j                         }| j                  |      D ]:  }|d   j                  d      }||d   }n|d    d| d}| j	                  |       < y)z4Checks if the long string fields are reST-compliant.lineNr2   z (line ))rG   get_long_description_check_rst_datagetr:   )r   datawarningrO   s       r   r?   zcheck.check_restructuredtextn   sr      557++D1 	G2;??6*D|!!*$QZLvQ7IIg	r   c           	         | j                   j                  xs d}t        j                  j                  j                         }t        j                  j                  t        j                  j                  j
                  f      j                         }d|_	        d|_
        d|_        t        ||j                  |j                  |j                  |j                   |j"                  |j$                        }t        j&                  j)                  |||      }|j+                  |d       	 |j-                  ||       |j0                  S # t.        $ r8}|j0                  j3                  dd| d	d
i f       Y d}~|j0                  S d}~ww xY w)z8Returns warnings when the provided data doesn't compile.zsetup.py)
components   N)r   r   r   r   )r   rN   zCould not finish the parsing: . )rG   script_namer   parsersrstParserfrontendOptionParserget_default_values	tab_widthpep_referencesrfc_referencesr   r   r   warning_streamr   error_encodingerror_encoding_error_handlerr   documentnote_sourceparseAttributeErrorr
   r   )r   rT   source_pathparsersettingsreporterrh   es           r   rR   zcheck._check_rst_datay   so    ''33Az!!%%,,.$$11 ((,,335 2 



 	 "&"&!!!**..,,"??
 >>**8Xk*R["-	LLx(      	$$015	&      	s   ,E
 
	F#FFN)r%   r&   r'   __doc__descriptionuser_optionsboolean_optionsr5   r8   r:   rC   r=   r?   rR   r7   r   r   r*   r*   (   s>    ;6KL AO'
F&S"	!!r   r*   )rq   
contextlibcorer   errorsr   suppressImportErrordocutils.frontendr   docutils.nodesdocutils.parsers.rstdocutils.utilsutilsReporterr   r*   r7   r   r   <module>r      sj   
   (Z% 00 :r!G r!; s   0A))A2