
    -Ph?                        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d dl	Z	ddl
mZ ddZdddZddZedk    r( ej         eej        dd                              dS dS )    )annotationsN   )ExecutableSerialisationreturnargparse.ArgumentParserc                     t          j        d          } |                     d           |                     d           |                     d           | S )NzECustom executable wrapper for Meson. Do not run on your own, mmm'kay?)descriptionz
--unpicklez	--capturez--feed)argparseArgumentParseradd_argument)parsers    \/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/mesonbuild/scripts/meson_exe.pybuildparserr      sW    $1yzzzF
%%%
$$$
!!!M    exer   	extra_envT.Optional[T.Dict[str, str]]intc           	        | j         r| j                                         sEt          d                    | j        d         | j                                                             | j                                         | j        z   }n| j        }t          j        	                                }|r|
                    |           | j        r| j                            |          }| j        rt          j                            | j        dgz             |d         z   |d<   | j         rt!          d | j                                         D                       ruddlm} |                    | j                                         d | j        D             |                    d	d                              d
          z   | j                  |d	<   d }| j        rt1          | j        d          }t2          j        }| j        r| j        r
J d            d }t3          j        ||| j        d|||          }|                                \  }}	||                                 |j         dk    r!d|d         z   }
tC          |j         |
|          |j         dk    r| j"        rtG          d|           | j        r|j         S tI          j%                    }| j        s3tG          d           tG          |&                    |d                     tG          d           tG          |	&                    |d                     |j         S | j        rd}	 t1          | j        d          5 }|'                                |k    }d d d            n# 1 swxY w Y   n# tP          $ r Y nw xY w|sBt1          | j        d          5 }|)                    |           d d d            n# 1 swxY w Y   dS )NzBBUG: Can't run cross-compiled exe {!r} with not-found wrapper {!r}r    PATHc              3     K   | ]}d |v V  	dS )wineN ).0is     r   	<genexpr>zrun_exe.<locals>.<genexpr>'   s&      "V"V16Q;"V"V"V"V"V"Vr   r   )mesonlibc                    g | ]}d |z   S )zZ:r   )r   ps     r   
<listcomp>zrun_exe.<locals>.<listcomp>+   s    333a333r   WINEPATH;rbz4Cannot capture and print to console at the same timeF)envcwd	close_fdsstdinstdoutstderrl   5   z.Failed to run due to missing DLLs, with path: zwhile executing z--- stdout ---replace)encodingerrorsz--- stderr ---wb)*exe_wrapperfoundAssertionErrorformatcmd_argsget_pathget_commandosenvironcopyupdater%   get_envextra_pathspathsepjoinanyr   r   get_wine_shortpathgetsplitworkdirfeedopen
subprocessPIPEverbosecapturePopencommunicateclose
returncodeFileNotFoundErrorpickledprintlocalegetpreferredencodingdecodereadOSErrorwrite)r   r   r3   	child_envr   r(   piper    r)   r*   strerrorr,   
skip_writecuroutputs                  r   run_exer\      sm   
  $$&& 	e  "006s|AH`H`HbHb0c0ce e e?..003<?<
!!I $###
w /GOOI..	
 	Z__S_t-CDD&v./	&? 	s"V"V8S8S8U8U"V"V"VVV 	######$,$?$?++--333?333immJPR6S6S6Y6YZ]6^6^^% %Ij! E
x %SXt$$?D
{ ;VV VVVVyck#(d4	Q 	Q 	QA]]__NFF|z!!CiPVFWWhAAA|q; 	31X11222; 	 <.00{ 	F"###&--)-DDEEEfmmXim@@AAA|
{ 	%
	ck4(( 2C XXZZ61
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 	 	 	D	 	%ck4(( %FV$$$% % % % % % % % % % % % % % % 1sH   N !N:N N

N N
N 
NN9OO"OargsT.List[str]c                   t                      }|                    |           \  }}|r|d         dk    r
|dd          }|j        s|s|                    d           |j        rn|s|j        s|j        r|                    d           t          |j        d          5 }t          j        |          }d|_	        d d d            n# 1 swxY w Y   nt          ||j        |j                  }t          |          S )	Nr   z--   z:either --unpickle or executable and arguments are requiredz.no other arguments can be used with --unpickler$   T)rH   rC   )r   parse_known_argsunpickleerrorrH   rC   rD   pickleloadrN   r   r\   )r]   r   optionsr3   fr   s         r   runrh   ^   sK   ]]F//55GX   HQK4''ABB< SH SQRRR \ 	Kw 	K', 	KLLIJJJ'"D)) 	Q+a..CCK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 &hgl[[[3<<s   CC
C
__main__r`   )r   r   )N)r   r   r   r   r   r   )r]   r^   r   r   )
__future__r   r6   sysr
   rd   rE   typingTrP   
utils.corer   r   r\   rh   __name__exitargvr   r   r   <module>rr      s    # " " " " " 				 



            0 0 0 0 0 0   E E E E EN   ( zCHSS!"" r   