
    -Phx                        d dl mZ d dlZd dlZd dlZd dlZd dlZd dlZej	        rd dl
Z
ddlmZ dd	Zd
ZdZ G d d          ZddZdS )    )annotationsN   )get_meson_commandparser'argparse.ArgumentParser'returnNonec                h    |                      dddd           |                      ddd	           d S )
Nz--intermediariesF
store_truezCheck intermediate files.)defaultactionhelp	mesonargs*z#Arguments to pass to "meson setup".)nargsr   )add_argument)r   s    \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mesonbuild/scripts/reprotest.pyadd_argumentsr      s`    
* %+8  : : : 3B  D D D D D    )z
.ninja_logz.ninja_depszmeson-privatez
meson-logsz
meson-info)z.gchz.pchz.oz.objz.classc                  V    e Zd ZddZddZddZdd	Zdd
ZddZddZ	ddZ
ddZdS )ReproTesteroptionsT.Anyc                    |j         | _        t                      d d          | _        t	          j        d          | _        t	          j        d          | _        g | _        |j	        | _
        d S )N
buildreprobuildrepro.1st)r   argsr   mesonpathlibPathbuilddir
storagedirissuesintermediariescheck_intermediaries)selfr   s     r   __init__zReproTester.__init__(   s]    %	&((+
\22!,'788#%$+$:!!!r   r   intc                   t           j                            d          st          j        d           |                                  |                                  |                                  |                                  | 	                                 | j
        s|                                  t          | j
                  S )Nzmeson.buildz9This command needs to be run at your project source root.)ospathisfilesysexitdisable_ccachecleanupbuildcheck_outputprint_resultsr#   lenr&   s    r   runzReproTester.run0   s    w~~m,, 	RHPQQQ

{ 	LLNNN4;r   r	   c                $    dt           j        d<   d S )N1CCACHE_DISABLE)r*   environr5   s    r   r/   zReproTester.disable_ccache<   s    '*
#$$$r   c                    | j                                         rt          j        | j                    | j                                        rt          j        | j                   d S d S )N)r!   existsshutilrmtreer"   r5   s    r   r0   zReproTester.cleanup?   sb    =!! 	)M$-(((?!!## 	+M$/*****	+ 	+r   c                n   | j         dt          | j                  gz   | j        z   }| j         ddt          | j                  gz   }t	          j        |           t	          j        |           | j                            | j                   t	          j        |           t	          j        |           d S )Nsetupcompilez-C)r   strr!   r   
subprocess
check_callrenamer"   )r&   setup_commandbuild_commands      r   r1   zReproTester.buildE   s    )-wDM@R@R6S)SVZV_)_)-y$DMHZHZ6[)[m,,,m,,,T_---m,,,m,,,,,r   fstrrB   boolc                n    t           D ]	}||v r dS 
| j        s|                    t                    rdS dS )NTF)IGNORE_PATTERNSr%   endswithINTERMEDIATE_EXTENSIONS)r&   rH   ps      r   ignore_filezReproTester.ignore_fileN   sP      	 	ADyytt ( 	}}455 tur   fromdirtodircheck_contentsc                F   dd l }|dz   }|dz   }t          j        |                              d          D ]}|                                s|                                }|                     |          rA|                    |          sJ t          j        |                    ||d                    }	|		                                s| j
                            d|	            |r5|                    ||	d          s| j
                            d|            d S )	Nr   /z**/*   zMissing file: F)shallowzFile contents differ: )filecmpr   r    globis_fileas_posixrO   
startswithreplacer<   r#   appendcmp)
r&   rP   rQ   rR   rW   frompathtopathfromfilerH   tofiles
             r   rR   zReproTester.check_contentsW   sA   S=W--226:: 	L 	LH##%% $$&&D%% ??8,,,,,\$,,x"C"CDDF==?? L""#<F#<#<==== L{{8VU{CC LK&&'J'J'JKKK	L 	Lr   c                    | j         r*t          d           | j         D ]}t          |           d S t          d           d S )NzBuild differences detectedzNo differences detected.)r#   print)r&   is     r   r3   zReproTester.print_resultsi   sZ    ; 	..///[  a  ,-----r   c                b    |                      ddd           |                      ddd           d S )Nr   r   TF)rR   r5   s    r   r2   zReproTester.check_outputq   s:    L*:DAAA,lEBBBBBr   N)r   r   )r   r(   )r   r	   )rH   rB   r   rI   )rP   rB   rQ   rB   rR   rI   r   r	   )__name__
__module____qualname__r'   r6   r/   r0   r1   rO   rR   r3   r2    r   r   r   r   '   s        ; ; ; ;
  
  
  
 + + + ++ + + +- - - -   L L L L$. . . .C C C C C Cr   r   r   r   c                    t          |           }	 t          j        |                                           d S # t          $ r.}t          |           t          j        d           Y d }~d S d }~ww xY w)NrU   )r   r-   r.   r6   	Exceptionrd   )r   rtes      r   r6   r6   u   su    	W		B   as   &9 
A1#A,,A1)r   r   r   r	   )r   r   r   r	   )
__future__r   r-   r*   rC   r=   r   typingTTYPE_CHECKINGargparsemesonlibr   r   rK   rM   r   r6   rj   r   r   <module>ru      s   # " " " " " " " " " " " " " " " " " " " " "     ? OOO ( ( ( ( ( (D D D D LC LC LC LC LC LC LC LC\     r   