Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib/python3.7/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/setuptools/__pycache__/sandbox.cpython-37.pyc

B

��Re8�@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZej�d�r�ddlmmmmZnejejZyeZWnek
r�dZYnXeZddddgZd0d	d
�Zejd1dd��Z ejd
d��Z!ejdd��Z"ejdd��Z#Gdd�de$�Z%Gdd�d�Z&ejdd��Z'dd�Z(ejdd��Z)ejdd��Z*dd d!d"d#hZ+d$d%�Z,d&d'�Z-d(d�Z.Gd)d�d�Z/e0ed*��r�ej1gZ2ngZ2Gd+d�de/�Z3e�4ej5d,d-�d.�6�D��Z7Gd/d�de
�Z8dS)2�N)�DistutilsError)�working_set�java�AbstractSandbox�DirectorySandbox�SandboxViolation�	run_setupc	CsJd}t||��}|��}WdQRX|dkr.|}t||d�}t|||�dS)z.
    Python 3 implementation of execfile.
    �rbN�exec)�open�read�compiler
)�filename�globals�locals�mode�stream�script�code�r��/builddir/build/BUILDROOT/alt-python37-setuptools-58.3.0-4.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/setuptools/sandbox.py�	_execfile$src
csDtjdd�}|dk	r$|tjdd�<z
|VWd|tjdd�<XdS)N)�sys�argv)�repl�savedrrr�	save_argv1s
rc
cs.tjdd�}z
|VWd|tjdd�<XdS)N)r�path)rrrr�	save_path<s
rccs2tj|dd�tj}|t_z
dVWd|t_XdS)zL
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    T)�exist_okN)�os�makedirs�tempfile�tempdir)�replacementrrrr�
override_tempEs
r%c	cs.t��}t�|�z
|VWdt�|�XdS)N)r �getcwd�chdir)�targetrrrr�pushdVs


r)c@seZdZdZedd��ZdS)�UnpickleableExceptionzP
    An exception representing another Exception that could not be pickled.
    c	CsJyt�|�t�|�fStk
rDddlm}|�||t|���SXdS)z�
        Always return a dumped (pickled) type and exc. If exc can't be pickled,
        wrap it in UnpickleableException first.
        r)r*N)�pickle�dumps�	Exception�setuptools.sandboxr*�dump�repr)�type�exc�clsrrrr/es
zUnpickleableException.dumpN)�__name__�
__module__�__qualname__�__doc__�staticmethodr/rrrrr*`sr*c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�ExceptionSaverz^
    A Context Manager that will save an exception, serialized, and restore it
    later.
    cCs|S)Nr)�selfrrr�	__enter__zszExceptionSaver.__enter__cCs |sdSt�||�|_||_dS)NT)r*r/�_saved�_tb)r:r1r2�tbrrr�__exit__}s
zExceptionSaver.__exit__cCs2dt|�krdSttj|j�\}}|�|j��dS)z"restore and re-raise any exceptionr<N)�vars�mapr+�loadsr<�with_tracebackr=)r:r1r2rrr�resume�szExceptionSaver.resumeN)r4r5r6r7r;r?rDrrrrr9tsr9c	#sVtj���t��}�VWdQRXtj����fdd�tjD�}t|�|��dS)z�
    Context in which imported modules are saved.

    Translates exceptions internal to the context into the equivalent exception
    outside the context.
    Nc3s$|]}|�kr|�d�s|VqdS)z
encodings.N)�
startswith)�.0�mod_name)rrr�	<genexpr>�szsave_modules.<locals>.<genexpr>)r�modules�copyr9�update�_clear_modulesrD)�	saved_excZdel_modulesr)rr�save_modules�s


rNcCsxt|�D]}tj|=q
WdS)N)�listrrI)Zmodule_namesrGrrrrL�srLc	cs$t��}z
|VWdt�|�XdS)N)�
pkg_resources�__getstate__�__setstate__)rrrr�save_pkg_resources_state�s
rSccs�tj�|d�}t��xt��ft��Tt�t��<t|��(t	|��t
d�dVWdQRXWdQRXWdQRXWdQRXWdQRXWdQRXdS)N�temp�
setuptools)r r�joinrSrNr�hide_setuptoolsrr%r)�
__import__)�	setup_dir�temp_dirrrr�
setup_context�s

r[rU�	distutilsrPZCython�_distutils_hackcCs|�dd�d}|tkS)aH
    >>> _needs_hiding('setuptools')
    True
    >>> _needs_hiding('pkg_resources')
    True
    >>> _needs_hiding('setuptools_plugin')
    False
    >>> _needs_hiding('setuptools.__init__')
    True
    >>> _needs_hiding('distutils')
    True
    >>> _needs_hiding('os')
    False
    >>> _needs_hiding('Cython')
    True
    �.�r)�split�_MODULES_TO_HIDE)rG�base_modulerrr�
_needs_hiding�srccCs6tj�dd�}|dk	r|��tttj�}t|�dS)a%
    Remove references to setuptools' modules from sys.modules to allow the
    invocation to import the most appropriate setuptools. This technique is
    necessary to avoid issues such as #315 where setuptools upgrading itself
    would fail to find a function declared in the metadata.
    r]N)rrI�getZremove_shim�filterrcrL)r]rIrrrrW�s
rWcCs�tj�tj�|��}t|���yl|gt|�tjdd�<tj�d|�t	�
�t	j�dd��t
|��t|dd�}t||�WdQRXWn4tk
r�}z|jr�|jdr��Wdd}~XYnXWdQRXdS)z8Run a distutils setup script, sandboxed in its directoryNrcSs|��S)N)�activate)�distrrr�<lambda>��zrun_setup.<locals>.<lambda>�__main__)�__file__r4)r r�abspath�dirnamer[rOrr�insertr�__init__�	callbacks�appendr�dictr�
SystemExit�args)Zsetup_scriptrtrY�ns�vrrrr�s

c@s.eZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
x$dD]Zee
e�rFe
e�e�e<qFWd$dd�Zer~ede�Zede�Zx$dD]Zee
e�r�ee�e�e<q�Wdd�Zx$dD]Zee
e�r�ee�e�e<q�Wdd�Zx$dD]Zee
e�r�ee�e�e<q�Wdd�Zdd�Zd d!�Zd"d#�ZdS)%rzDWrap 'os' module and 'open()' builtin for virtualizing setup scriptsFcs�fdd�tt�D��_dS)Ncs$g|]}|�d�st�|�r|�qS)�_)rE�hasattr)rF�name)r:rr�
<listcomp>sz,AbstractSandbox.__init__.<locals>.<listcomp>)�dir�_os�_attrs)r:r)r:rros
zAbstractSandbox.__init__cCs&x |jD]}tt|t||��qWdS)N)r}�setattrr �getattr)r:�sourceryrrr�_copyszAbstractSandbox._copycCs(|�|�tr|jt_|jt_d|_dS)NT)r��_file�builtins�file�_openr�_active)r:rrrr;s

zAbstractSandbox.__enter__cCs$d|_trtt_tt_|�t�dS)NF)r�r�r�r�r�rr�r|)r:�exc_type�	exc_value�	tracebackrrrr?!s
zAbstractSandbox.__exit__c	Cs|�|�SQRXdS)zRun 'func' under os sandboxingNr)r:�funcrrr�run(szAbstractSandbox.runcstt�����fdd�}|S)Ncs2|jr |j�||f|�|�\}}�||f|�|�S)N)r��_remap_pair)r:�src�dstrt�kw)ry�originalrr�wrap0sz3AbstractSandbox._mk_dual_path_wrapper.<locals>.wrap)rr|)ryr�r)ryr�r�_mk_dual_path_wrapper-s
z%AbstractSandbox._mk_dual_path_wrapper)�rename�link�symlinkNcs �ptt�����fdd�}|S)Ncs*|jr|j�|f|�|�}�|f|�|�S)N)r��_remap_input)r:rrtr�)ryr�rrr�>sz5AbstractSandbox._mk_single_path_wrapper.<locals>.wrap)rr|)ryr�r�r)ryr�r�_mk_single_path_wrapper;sz'AbstractSandbox._mk_single_path_wrapperr�r)�stat�listdirr'r�chmod�chown�mkdir�remove�unlink�rmdir�utime�lchown�chroot�lstatZ	startfile�mkfifo�mknod�pathconf�accesscstt�����fdd�}|S)NcsB|jr2|j�|f|�|�}|���|f|�|��S�|f|�|�S)N)r�r��
_remap_output)r:rrtr�)ryr�rrr�csz4AbstractSandbox._mk_single_with_return.<locals>.wrap)rr|)ryr�r)ryr�r�_mk_single_with_return`s
z&AbstractSandbox._mk_single_with_return)�readlink�tempnamcstt�����fdd�}|S)Ncs �||�}|jr|��|�S|S)N)r�r�)r:rtr��retval)ryr�rrr�rs
z'AbstractSandbox._mk_query.<locals>.wrap)rr|)ryr�r)ryr�r�	_mk_queryos
zAbstractSandbox._mk_query)r&�tmpnamcCs|S)z=Called to remap or validate any path, whether input or outputr)r:rrrr�_validate_path~szAbstractSandbox._validate_pathcOs
|�|�S)zCalled for path inputs)r�)r:�	operationrrtr�rrrr��szAbstractSandbox._remap_inputcCs
|�|�S)zCalled for path outputs)r�)r:r�rrrrr��szAbstractSandbox._remap_outputcOs0|j|d|f|�|�|j|d|f|�|�fS)z?Called for path pairs like rename, link, and symlink operationsz-fromz-to)r�)r:r�r�r�rtr�rrrr��szAbstractSandbox._remap_pair)N)r4r5r6r7r�ror�r;r?r�r�ryrxr|rr�r�r�r�r�r�r�r�r�rrrrr
s<












�devnullc@s�eZdZdZe�dddddddd	d
ddd
dg
�ZgZefdd�Z	dd�Z
erVd&dd�Zd'dd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd(d#d$�Zd%S))rz<Restrict operations to a single subdirectory - pseudo-chrootrr�r�r�r�r�r�r�r�r�r�r�r�cCsFtj�tj�|��|_tj�|jd�|_dd�|D�|_t�	|�dS)N�cSs g|]}tj�tj�|���qSr)r r�normcase�realpath)rFrrrrrz�sz-DirectorySandbox.__init__.<locals>.<listcomp>)
r rr�r��_sandboxrV�_prefix�_exceptionsrro)r:Zsandbox�
exceptionsrrrro�szDirectorySandbox.__init__cOsddlm}||||��dS)Nr)r)r.r)r:r�rtr�rrrr�
_violation�szDirectorySandbox._violation�rcOs:|dkr(|�|�s(|jd||f|�|�t||f|�|�S)N)r��rtr	�rU�Ur�)�_okr�r�)r:rrrtr�rrrr��szDirectorySandbox._filecOs:|dkr(|�|�s(|jd||f|�|�t||f|�|�S)N)r�r�r	r�r�r)r�r�r�)r:rrrtr�rrrr��szDirectorySandbox._opencCs|�d�dS)Nr�)r�)r:rrrr��szDirectorySandbox.tmpnamcCsN|j}z:d|_tj�tj�|��}|�|�p@||jkp@|�|j�S||_XdS)NF)	r�r rr�r��	_exemptedr�rEr�)r:r�activer�rrrr��s

zDirectorySandbox._okcs<�fdd�|jD�}�fdd�|jD�}t�||�}t|�S)Nc3s|]}��|�VqdS)N)rE)rF�	exception)�filepathrrrH�sz-DirectorySandbox._exempted.<locals>.<genexpr>c3s|]}t�|��VqdS)N)�re�match)rF�pattern)r�rrrH�s)r��_exception_patterns�	itertools�chain�any)r:r�Z
start_matchesZpattern_matches�
candidatesr)r�rr��szDirectorySandbox._exemptedcOs4||jkr0|�|�s0|j|tj�|�f|�|�|S)zCalled for path inputs)�	write_opsr�r�r rr�)r:r�rrtr�rrrr��szDirectorySandbox._remap_inputcOs2|�|�r|�|�s*|j|||f|�|�||fS)z?Called for path pairs like rename, link, and symlink operations)r�r�)r:r�r�r�rtr�rrrr��szDirectorySandbox._remap_pair�cOs@|t@r*|�|�s*|jd|||f|�|�tj|||f|�|�S)zCalled for low-level os.open()zos.open)�WRITE_FLAGSr�r�r|r)r:r��flagsrrtr�rrrr�szDirectorySandbox.openN)r�)r�)r�)r4r5r6r7rr�fromkeysr�r��_EXCEPTIONSror�r�r�r�r�r�r�r�rrrrrr�s6



cCsg|]}tt|d��qS)r)rr|)rF�arrrrz�srzz4O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYc@s&eZdZdZe�d���Zdd�ZdS)rzEA setup script attempted to modify the filesystem outside the sandboxa
        SandboxViolation: {cmd}{args!r} {kwargs}

        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.
        cCs|j\}}}|jjft��S)N)rt�tmpl�formatr)r:�cmdrt�kwargsrrr�__str__szSandboxViolation.__str__N)	r4r5r6r7�textwrap�dedent�lstripr�r�rrrrr�s
)N)N)9r rr"�operator�	functoolsr�r��
contextlibr+r�r�rP�distutils.errorsrr�platformrEZ$org.python.modules.posix.PosixModule�pythonrI�posixZPosixModuler|ryr�r��	NameErrorrr��__all__r�contextmanagerrrr%r)r-r*r9rNrLrSr[rarcrWrrrxr�r�r�reduce�or_r`r�rrrrr�<module>sp 



	
		
^

Hacked By AnonymousFox1.0, Coded By AnonymousFox