AlkantarClanX12

Your IP : 18.218.73.233


Current Path : /lib64/python3.6/test/support/__pycache__/
Upload File :
Current File : //lib64/python3.6/test/support/__pycache__/script_helper.cpython-36.opt-2.pyc

3

��f�)�@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZdadd�ZGdd�dejdd#��Zdd�Zd
d�Zdd�Zdd�Zejejd�dd�Zdd�Zd$dd�Zd%dd�Zd&dd�Zd'd!d"�ZdS)(�N)�source_from_cache)�make_legacy_pyc�strip_python_stderrcCsVtdkrRdtjkrdadSytjtjdddg�Wntjk
rLdaYnXdatS)NZ
PYTHONHOMETz-Ez-czimport sys; sys.exit(0)F)�$__cached_interp_requires_environment�os�environ�
subprocessZ
check_call�sys�
executableZCalledProcessError�rr�2/usr/lib64/python3.6/test/support/script_helper.py� interpreter_requires_environments


r
c@seZdZdd�ZdS)�_PythonRunResultcCs�d}|j|j}}t|�|kr0d||d�}t|�|krNd||d�}|jdd�j�}|jdd�j�}td|j|||f��dS)	N�P�ds(... truncated stdout ...)s(... truncated stderr ...)�ascii�replacezRProcess return code is %d
command line: %r

stdout:
---
%s
---

stderr:
---
%s
---i@)�out�err�len�decode�rstrip�AssertionError�rc)�self�cmd_line�maxlenrrrrr�fail>sz_PythonRunResult.failN)�__name__�
__module__�__qualname__rrrrrr;srrrrc
Ost�}d|kr|jd�}n|o$|}tjddg}|rB|jd�n|rX|rX|jd�|jdd�r�i}tjdkr�tjd|d<n
tjj�}d	|kr�d
|d	<|j	|�|j
|�tj|tj
tj
tj
|d�}|�*z|j�\}}Wd|j�tj�XWdQRX|j}	t|�}t|	||�|fS)NZ
__isolatedz-XZfaulthandlerz-Iz-EZ
__cleanenvZwin32Z
SYSTEMROOT�TERM�)�stdin�stdout�stderr�env)r
�popr	r
�append�platformrr�copy�update�extendr�Popen�PIPEZcommunicate�kill�_cleanup�
returncoderr)
�args�env_varsZenv_required�isolatedrr&�procrrrrrr�run_python_until_end[s:





r6cOs4t||�\}}|jr|s&|jr0|r0|j|�|S)N)r6rr)Zexpected_successr2r3�resrrrr�_assert_python�s
r8cOstd|�|�S)NT)T)r8)r2r3rrr�assert_python_ok�sr9cOstd|�|�S)NF)F)r8)r2r3rrr�assert_python_failure�sr:)r$r%cOsXtjg}t�s|jd�|j|�|jdttj��}d|d<t	j
|ft	j||d�|��S)Nz-Er&Zvt100r!)r#r$r%)r	r
r
r(r,�
setdefault�dictrrrr-r.)r$r%r2�kwrr&rrr�spawn_python�s

r>cCs2|jj�|jj�}|jj�|j�tj�|S)N)r#�closer$�read�waitrr0)�p�datarrr�kill_python�s


rDFcCsP|}|s|tjd7}tjj||�}t|ddd�}|j|�|j�tj�|S)N�py�wzutf-8)�encoding)	r�extsep�path�join�open�writer?�	importlib�invalidate_caches)Z
script_dir�script_basename�sourceZomit_suffixZscript_filename�script_nameZscript_filerrr�make_script�s
rRc	Cs�|tjd}tjj||�}tj|d�}|dkr~|jtj�}t|�dkrr|ddkrrt	t
|��}tjj|�}|}ntjj|�}|j||�|j
�|tjj||�fS)N�ziprF��__pycache__���)rrHrIrJ�zipfile�ZipFile�split�seprrr�basenamerLr?)	�zip_dir�zip_basenamerQZname_in_zip�zip_filename�zip_name�zip_file�partsZ
legacy_pycrrr�make_zip_script�srbr"cCstj|�t|d|�dS)N�__init__)r�mkdirrR)Zpkg_dirZinit_sourcerrr�make_pkg�s
re�cs0g}t|dd�}|j|�tjj|�}	t|||�}
|j|
�|rjtj|dd�}tj|
dd�}
|j||
f��fdd�td|d�D�}tjj	|d
tjj|
��}|tj
d}
tjj	||
�}tj|d	�}x&|D]}tjj	||	�}|j
||�q�W|j
|
|�|j�x|D]}tj|��q
W|tjj	||�fS)Nrcr"T)�doraisecsg|]}tjj�g|��qSr)rrZrJ)�.0�i)�pkg_namerr�
<listcomp>�sz make_zip_pkg.<locals>.<listcomp>rfrSrF���)rRr(rrIr[�
py_compile�compiler,�rangerJrHrWrXrLr?�unlink)r\r]rjrOrPZdepthZcompiledrpZ	init_nameZ
init_basenamerQZ	pkg_namesZscript_name_in_zipr^r_r`�nameZinit_name_in_zipr)rjr�make_zip_pkg�s.



rr)rrr)F)N)r")rfF) �collectionsrMr	rZos.pathZtempfilerrm�
contextlibZshutilrW�importlib.utilrZtest.supportrrrr
�
namedtuplerr6r8r9r:r.ZSTDOUTr>rDrRrbrerrrrrr�<module>s4$3