Your IP : 18.217.89.130


Current Path : /opt/alt/python34/lib/python3.4/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib/python3.4/site-packages/setuptools/__pycache__/sandbox.cpython-34.pyc

�
M�Re
'�@s�ddlZddlZddlZddlZddlZddlZddlZddlZejdkr�ddl	j
jjj
ZnejejZy
eZWnek
r�dZYnXeZddlmZddlmZddlmZmZdddd	gZd
d	�ZGdd�d�Zeed�rJejgZngZy'dd
l m!Z!ej"e!��[!Wne#k
r�YnXGdd�de�Z$ej%ej&dd�dj'�D��Z(Gdd�de�Z)dS)�N�java)�DistutilsError)�working_set)�builtins�execfile�AbstractSandbox�DirectorySandbox�SandboxViolation�	run_setupcstj�}tjdd�}tjdd�}tjjtjj���}tjj|d�}tjj|�s�tj	|�nt
j}tjj
��tj�}z�|t
_tj|�yv�gt|�tjdd�<tjjd|�tj�tjjdd��t|�j�fdd��Wn>tk
rztj�d}	|	jrv|	jdrv�nYnXWdtj|�tjj���fdd	�tjD�}
tttjj|
��tj|�|tjdd�<|tjdd�<|t
_XdS)
z8Run a distutils setup script, sandboxed in its directoryN�temprcSs
|j�S)N)�activate)�dist�r�-/tmp/pip-l4uy7dan-build/setuptools/sandbox.py�<lambda>0szrun_setup.<locals>.<lambda>cstdi�d6dd6�S)Nzsetup.py�__file__�__main__�__name__)rr)�setup_scriptrrr2s�cs2g|](}|�kr|jd�r|�qS)z
encodings.)�
startswith)�.0Zmod_name)�save_modulesrr�
<listcomp>As	zrun_setup.<locals>.<listcomp>) �os�getcwd�sys�argv�path�abspath�dirname�join�isdir�makedirs�tempfile�tempdir�modules�copy�
pkg_resources�__getstate__�chdir�list�insertr�__init__�	callbacks�appendr�run�
SystemExit�exc_info�args�__setstate__�update�map�__delitem__)rr3Zold_dir�	save_argvZ	save_pathZ	setup_dir�temp_dirZsave_tmpZpr_state�vZdel_modulesr)rrrr
s@		
 



c@s�eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zx<ddd
gD]+Z	e
ee	�rXee	�e�e	<qXqXWddd�Z
er�e
de�Zne
de�Zxlddddddddddddddd d!d"d#d$gD]+Z	e
ee	�r�e
e	�e�e	<q�q�Wd%d&�Zx9d'd(gD]+Z	e
ee	�rEee	�e�e	<qEqEWd)d*�Zx9d+d,gD]+Z	e
ee	�r�ee	�e�e	<q�q�Wd-d.�Zd/d0�Zd1d2�Zd3d4�ZdS)5rzDWrap 'os' module and 'open()' builtin for virtualizing setup scriptsFcs&�fdd�tt�D��_dS)Ncs5g|]+}|jd�rt�|�r|�qS)�_)r�hasattr)r�name)�selfrrrTs	z,AbstractSandbox.__init__.<locals>.<listcomp>)�dir�_os�_attrs)r>r)r>rr-RszAbstractSandbox.__init__cCs1x*|jD]}tt|t||��q
WdS)N)rA�setattrr�getattr)r>�sourcer=rrr�_copyXszAbstractSandbox._copycCs{zB|j|�tr%|jt_n|jt_d|_|�SWdd|_tr`tt_ntt_|jt�XdS)zRun 'func' under os sandboxingTNF)rE�_filer�file�_open�open�_activer@)r>�funcrrrr0\s
			zAbstractSandbox.runcs(tt�����fdd�}|S)Ncs@|jr-|j�||||�\}}n�||||�S)N)rJ�_remap_pair)r>�src�dstr3�kw)r=�originalrr�wrapns	$z3AbstractSandbox._mk_dual_path_wrapper.<locals>.wrap)rCr@)r=rQr)r=rPr�_mk_dual_path_wrapperlsz%AbstractSandbox._mk_dual_path_wrapper�rename�link�symlinkNcs.�ptt�����fdd�}|S)Ncs4|jr$|j�|||�}n�|||�S)N)rJ�_remap_input)r>rr3rO)r=rPrrrQys	z5AbstractSandbox._mk_single_path_wrapper.<locals>.wrap)rCr@)r=rPrQr)r=rPr�_mk_single_path_wrapperwsz'AbstractSandbox._mk_single_path_wrapperrGrI�stat�listdirr*�chmod�chown�mkdir�remove�unlink�rmdir�utime�lchown�chroot�lstatZ	startfile�mkfifo�mknod�pathconf�accesscs(tt�����fdd�}|S)NcsM|jr=|j�|||�}|j��|||��S�|||�S)N)rJrV�
_remap_output)r>rr3rO)r=rPrrrQ�s	z4AbstractSandbox._mk_single_with_return.<locals>.wrap)rCr@)r=rQr)r=rPr�_mk_single_with_return�sz&AbstractSandbox._mk_single_with_return�readlink�tempnamcs(tt�����fdd�}|S)Ncs,�||�}|jr(|j�|�S|S)N)rJrh)r>r3rO�retval)r=rPrrrQ�s	z'AbstractSandbox._mk_query.<locals>.wrap)rCr@)r=rQr)r=rPr�	_mk_query�szAbstractSandbox._mk_queryr�tmpnamcCs|S)z=Called to remap or validate any path, whether input or outputr)r>rrrr�_validate_path�szAbstractSandbox._validate_pathcOs
|j|�S)zCalled for path inputs)ro)r>�	operationrr3rOrrrrV�szAbstractSandbox._remap_inputcCs
|j|�S)zCalled for path outputs)ro)r>rprrrrrh�szAbstractSandbox._remap_outputcOs6|j|d|||�|j|d|||�fS)z?Called for path pairs like rename, link, and symlink operationsz-fromz-to)rV)r>rprMrNr3rOrrrrL�szAbstractSandbox._remap_pair)r�
__module__�__qualname__�__doc__rJr-rEr0rRr=r<r@�localsrWrFrHrirmrorVrhrLrrrrrMs>		�devnull)�GetGeneratePathc@s�eZdZdZejdddddddd	d
ddd
dg
�ZdgZedd�Z	dd�Z
er�ddd�Znddd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zd#d$d%�Zd&S)'rz<Restrict operations to a single subdirectory - pseudo-chrootrIrZr[r\r]r^r_r`rarbrdrerkz.*lib2to3.*\.pickle$cCsctjjtjj|��|_tjj|jd�|_dd�|D�|_tj	|�dS)N�cSs.g|]$}tjjtjj|���qSr)rr�normcase�realpath)rrrrrr�s	z-DirectorySandbox.__init__.<locals>.<listcomp>)
rrrxry�_sandboxr!�_prefix�_exceptionsrr-)r>Zsandbox�
exceptionsrrrr-�s
!	
zDirectorySandbox.__init__cOst|||��dS)N)r	)r>rpr3rOrrr�
_violation�szDirectorySandbox._violation�rcOsK|dkr8|j|�r8|jd||||�nt||||�S)Nr�rt�rb�rU�UrG)rzrtzrbzrUr�)�_okr~rF)r>r�moder3rOrrrrF�szDirectorySandbox._filecOsK|dkr8|j|�r8|jd||||�nt||||�S)Nrr�r�r�r�rI)rzrtzrbzrUr�)r�r~rH)r>rr�r3rOrrrrH�szDirectorySandbox._opencCs|jd�dS)Nrn)r~)r>rrrrn�szDirectorySandbox.tmpnamcCss|j}zYd|_tjjtjj|��}|j|�p`||jkp`|j|j�SWd||_XdS)NF)	rJrrrxry�	_exemptedrzrr{)r>rZactiveryrrrr��s		zDirectorySandbox._okcsT�fdd�|jD�}�fdd�|jD�}tj||�}t|�S)Nc3s|]}�j|�VqdS)N)r)r�	exception)�filepathrr�	<genexpr>�sz-DirectorySandbox._exempted.<locals>.<genexpr>c3s!|]}tj|��VqdS)N)�re�match)r�pattern)r�rrr��s)r|�_exception_patterns�	itertools�chain�any)r>r�Z
start_matchesZpattern_matchesZ
candidatesr)r�rr��s

zDirectorySandbox._exemptedcOsH||jkrD|j|�rD|j|tjj|�||�n|S)zCalled for path inputs)�	write_opsr�r~rrry)r>rprr3rOrrrrVs%zDirectorySandbox._remap_inputcOsF|j|�s |j|�r<|j|||||�n||fS)z?Called for path pairs like rename, link, and symlink operations)r�r~)r>rprMrNr3rOrrrrL	s zDirectorySandbox._remap_pairi�cOsR|t@r9|j|�r9|jd|||||�ntj|||||�S)zCalled for low-level os.open()zos.open)�WRITE_FLAGSr�r~r@rI)r>rG�flagsr�r3rOrrrrIszDirectorySandbox.openN)rrqrrrs�dict�fromkeysr�r��_EXCEPTIONSr-r~rFrHrnr�r�rVrLrIrrrrr�s 		
cCs"g|]}tt|d��qS)r)rCr@)r�arrrrs	rz4O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYc@s"eZdZdZdd�ZdS)r	zEA setup script attempted to modify the filesystem outside the sandboxcCsd|jS)Na�SandboxViolation: %s%r %s

The package setup script has attempted to modify files on your system
that are not within the EasyInstall build area, and has been aborted.

This package cannot be safely installed by EasyInstall, and may not
support alternate installation locations even if you run its setup
script by hand.  Please inform the package's author and the EasyInstall
maintainers to find out if a fix or workaround is available.)r3)r>rrr�__str__s	zSandboxViolation.__str__N)rrqrrrsr�rrrrr	s)*rrr$�operator�	functoolsr�r�r(r=Z$org.python.modules.posix.PosixModule�pythonr&�posixZPosixModuler@rGrF�	NameErrorrIrH�distutils.errorsrrZsetuptools.compatrr�__all__r
rr<rur�Zwin32com.client.gencachervr/�ImportErrorr�reduce�or_�splitr�r	rrrr�<module>sF

0h
S

?>