Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/support/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/support/__pycache__/script_helper.cpython-35.opt-2.pyc



���]�'�@skddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZdadd�Zejdd#�Zd
d�Zdd
�Zdd�Zdd�Zdejdejdd�Zdd�Zddd�Zddd�Zddd�Zd dd!d"�ZdS)$�N)�source_from_cache)�make_legacy_pyc�strip_python_stderrcCsTtdkrPy tjtjdddg�Wntjk
rIdaYnXdatS)Nz-Ez-czimport sys; sys.exit(0)TF)�$__cached_interp_requires_environment�
subprocess�
check_call�sys�
executable�CalledProcessError�rr�2/opt/alt/python35/lib64/python3.5/script_helper.py� interpreter_requires_environmentsr
�_PythonRunResult�rc�out�errc
Os�t�}d|kr'|jd�}n|o2|}tjddg}|r]|jd�n|rx|rx|jd�|jdd�r�i}tjdkr�tjd|d<ntjj�}d	|kr�d
|d	<|j	|�|j
|�tj|dtj
dtj
d
tj
d|�}|�3z|j�\}}Wd|j�tj�XWdQRX|j}	t|�}t|	||�|fS)NZ
__isolatedz-XZfaulthandlerz-Iz-EZ
__cleanenv�win32Z
SYSTEMROOT�TERM��stdin�stdout�stderr�env)r
�poprr	�append�platform�os�environ�copy�update�extendr�Popen�PIPE�communicate�kill�_cleanup�
returncoderr)
�args�env_varsZenv_required�isolated�cmd_liner�procrrrrrr�run_python_until_end;s:	



	
	r,cOs�t||�\}}|jr$|s5|jr�|r�d}|j|j}}t|�|krud||d�}t|�|kr�d||d�}|jdd�j�}|jdd�j�}td|j|||f��|S)	N�P�ds(... truncated stdout ...)s(... truncated stderr ...)�ascii�replacezRProcess return code is %d
command line: %r

stdout:
---
%s
---

stderr:
---
%s
---i@)r,rrr�len�decode�rstrip�AssertionError)Zexpected_successr'r(�resr*�maxlenrrrrr�_assert_pythonns 	
r7cOstd||�S)NT)r7)r'r(rrr�assert_python_ok�sr8cOstd||�S)NF)r7)r'r(rrr�assert_python_failure�sr9rrc	Osftjdg}|j|�|jdttj��}d|d<tj|dtj	d|d||�S)Nz-ErZvt100rrrr)
rr	r �
setdefault�dictrrrr!r")rrr'�kwr*rrrr�spawn_python�s

	r=cCsA|jj�|jj�}|jj�|j�tj�|S)N)r�closer�read�waitrr%)�p�datarrr�kill_python�s



rCFcCsl|}|s|tjd7}tjj||�}t|ddd�}|j|�|j�tj�|S)N�py�w�encodingzutf-8)	r�extsep�path�join�open�writer>�	importlib�invalidate_caches)Z
script_dir�script_basename�sourceZomit_suffixZscript_filename�script_nameZscript_filerrr�make_script�s


rQc	Cs�|tjd}tjj||�}tj|d�}|dkr�|jtj�}t|�dkr�|ddkr�t	t
|��}tjj|�}|}ntjj|�}|j||�|j
�|tjj||�fS)N�ziprE��__pycache__���)rrGrHrI�zipfile�ZipFile�split�sepr1rr�basenamerKr>)	�zip_dir�zip_basenamerPZname_in_zip�zip_filename�zip_name�zip_file�partsZ
legacy_pycrrr�make_zip_script�s"	
rarcCs!tj|�t|d|�dS)N�__init__)r�mkdirrQ)Zpkg_dirZinit_sourcerrr�make_pkg�s
rd�cs�g}t|dd�}|j|�tjj|�}	t|||�}
|j|
�|r�tj|dd�}tj|
dd�}
|j||
f��fdd�td|d�D�}tjj	|d
tjj|
��}|tj
d}
tjj	||
�}tj|d	�}x3|D]+}tjj	||	�}|j
||�q#W|j
|
|�|j�x|D]}tj|�qsW|tjj	||�fS)Nrbr�doraiseTcs)g|]}tjj�g|��qSr)rrYrI)�.0�i)�pkg_namerr�
<listcomp>�s	z make_zip_pkg.<locals>.<listcomp>rerRrE���)rQrrrHrZ�
py_compile�compiler �rangerIrGrVrWrKr>�unlink)r[r\rirNrO�depthZcompiledroZ	init_nameZ
init_basenamerPZ	pkg_namesZscript_name_in_zipr]r^r_�nameZinit_name_in_zipr)rir�make_zip_pkg�s.

&%


rr)rrr) �collectionsrLrrZos.path�tempfilerrl�
contextlib�shutilrV�importlib.utilrZtest.supportrrrr
�
namedtuplerr,r7r8r9r"�STDOUTr=rCrQrardrrrrrr�<module>s4		3