%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/setuptools/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/setuptools/__pycache__/sandbox.cpython-312.pyc

�


_�d
8���ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZejj!d�rddlmcmcmcmZnej&ej.Z	eZeZgd�Zdd�Zej>dd��Z ej>d��Z!ej>d	��Z"ej>d
��Z#Gd�de$�Z%Gd
�d�Z&ej>d��Z'd�Z(ej>d��Z)ej>d��Z*hd�Z+d�Z,d�Z-d�Z.Gd�d�Z/e0ed�rejbgZ2ngZ2Gd�de/�Z3ejhejjdjm�D�cgc]}e7e|d���c}�Z8Gd�de
�Z9y#e$rdZY��3wxYwcc}w) �N)�DistutilsError)�working_set�java)�AbstractSandbox�DirectorySandbox�SandboxViolation�	run_setupc��d}t||�5}|j�}ddd�|�|}t|d�}t|||�y#1swY�(xYw)z.
    Python 3 implementation of execfile.
    �rbN�exec)�open�read�compiler)�filename�globals�locals�mode�stream�script�codes       �4/usr/lib/python3/dist-packages/setuptools/sandbox.py�	_execfiler$sY���D�	
�h��	���������
�~����6�8�V�,�D���w�����s�A�Ac#�K�tjdd}|�|tjdd	|��|tjddy#|tjddwxYw�w�N)�sys�argv)�repl�saveds  r�	save_argvr1sJ�����H�H�Q�K�E�������������������e������s�)A�A�A�A�Ac#�K�tjdd}	|��|tjddy#|tjddwxYw�wr)r�path�rs r�	save_pathr#<s7�����H�H�Q�K�E�����������e������s�A�/�A�A�Ac#�K�tj|d��tj}|t_	d��|t_y#|t_wxYw�w)zL
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    T)�exist_okN)�os�makedirs�tempfile�tempdir)�replacementrs  r�
override_tempr+EsA����
�K�K��d�+����E�"�H��!�
� ����5���s�3A�A�A�
A�Ac#��K�tj�}tj|�	|��tj|�y#tj|�wxYw�wr)r&�getcwd�chdir)�targetrs  r�pushdr0Vs=�����I�I�K�E��H�H�V�����
�����������s�*A!�A�A!�A�A!c� �eZdZdZed��Zy)�UnpickleableExceptionzP
    An exception representing another Exception that could not be pickled.
    c	���	tj|�tj|�fS#t$r*ddlm}|j||t
|���cYSwxYw)z�
        Always return a dumped (pickled) type and exc. If exc can't be pickled,
        wrap it in UnpickleableException first.
        r)r2)�pickle�dumps�	Exception�setuptools.sandboxr2�dump�repr)�type�exc�clss   rr8zUnpickleableException.dumpesO��	1��<�<��%�v�|�|�C�'8�8�8���	1�G��8�8�C��T�#�Y��0�0�		1�s�),�0A�AN)�__name__�
__module__�__qualname__�__doc__�staticmethodr8��rr2r2`s����1��1rCr2c�"�eZdZdZd�Zd�Zd�Zy)�ExceptionSaverz^
    A Context Manager that will save an exception, serialized, and restore it
    later.
    c��|SrrB��selfs r�	__enter__zExceptionSaver.__enter__zs���rCc�N�|sytj||�|_||_y�NT)r2r8�_saved�_tb)rHr:r;�tbs    r�__exit__zExceptionSaver.__exit__}s*����,�0�0��s�;������rCc��dt|�vryttj|j�\}}|j|j��)z"restore and re-raise any exceptionrLN)�vars�mapr4�loadsrL�with_tracebackrM)rHr:r;s   r�resumezExceptionSaver.resume�s@���4��:�%������d�k�k�2�	��c�� � ����*�*rCN)r=r>r?r@rIrOrUrBrCrrErEts���
�	�+rCrEc#�6�K�tjj��t�5}���ddd�tjj	���fd�tjD�}t|�j
�y#1swY�]xYw�w)z�
    Context in which imported modules are saved.

    Translates exceptions internal to the context into the equivalent exception
    outside the context.
    Nc3�L�K�|]}|�vr|jd�s|���y�w)z
encodings.N��
startswith)�.0�mod_namers  �r�	<genexpr>zsave_modules.<locals>.<genexpr>�s/��������5� ��#�#�L�1�		��s�!$)r�modules�copyrE�update�_clear_modulesrU)�	saved_exc�del_modulesrs  @r�save_modulesrc�sy�����
�K�K����E�	�	��Y�����K�K���u�������K��;��
������s�)B�B
�AB�
B�Bc�F�t|�D]}tj|=�yr)�listrr])�module_namesr[s  rr`r`�s"����&�"���K�K��!�"rCc#�K�tj�}	|��tj|�y#tj|�wxYw�wr)�
pkg_resources�__getstate__�__setstate__r"s r�save_pkg_resources_staterk�s:�����&�&�(�E�*����"�"�5�)��
�"�"�5�)�s�A�2�A�A	�	Ac#�K�tjj|d�}t�5t	�5t�5t
�t�5t|�5t|�5td�d��ddd�ddd�ddd�ddd�ddd�ddd�y#1swY�2xYw#1swY�6xYw#1swY�:xYw#1swY�>xYw#1swY�BxYw#1swYyxYw�w)N�temp�
setuptools)r&r!�joinrkrcr#�hide_setuptoolsrr+r0�
__import__)�	setup_dir�temp_dirs  r�
setup_contextrt�s������w�w�|�|�I�v�.�H�	!�	#�	"�
�^�	"���
"��!��[�"�&�x�0�"�"�9�-�"�&�|�4�!�"�"�"�
"�	"�	"�	"�"�"��"�"��"�"��
"�
"��	"�	"��	"�	"�s��+C9�C-�C!�C�C		�$B=�0B1
�B=�C		�C�C!� C-�(	C9�1B:�6B=�=C�C		�	C
�C�C�C!�!C*	�&C-�-C6�2C9>�Cython�	distutilsrnrh�_distutils_hackc�<�|jdd�d}|tvS)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)r[�base_modules  r�
_needs_hidingr~�s%��"�.�.��a�(��+�K��*�*�*rCc��tjjdd�}|�|j�t	t
tj�}t
|�y)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.
    rwN)rr]�get�_remove_shim�filterr~r`)rwr]s  rrprp�sC���k�k�o�o�&7��>�O��"��$�$�&��]�C�K�K�0�G��7�rCc�|�tjjtjj|��}t	|�5	|gt|�ztjddtjjd|�tj�tjjd��t|�5t|d��}t||�ddd�ddd�y#1swY�xYw#t $r&}|j"r|j"dr�Yd}~�?d}~wwxYw#1swYyxYw)z8Run a distutils setup script, sandboxed in its directoryNrc�"�|j�Sr)�activate)�dists r�<lambda>zrun_setup.<locals>.<lambda>�s��d�m�m�o�rC�__main__)�__file__r=)r&r!�abspath�dirnamertrerr�insertr�__init__�	callbacks�appendr�dictr�
SystemExit�args)�setup_scriptr�rr�ns�vs     rr	r	�s�������������� =�>�I�	�y�	!�
�	�'�.�4��:�5�C�H�H�Q�K��H�H�O�O�A�y�)�� � �"��!�!�(�(�)E�F�!�)�,�
,��<�*�E���,��+�
,�
�
�
,�
,���	��v�v�!�&�&��)����	��
�
�sI�D2�
A?D�	C4�#D�4C=	�9D�	D/�	D*�%D2�*D/�/D2�2D;c��eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	D]Zee
e�s�
e
e�e�e<�dd�Zer	ede�Zed
e�ZdD]Zee
e�s�
ee�e�e<�d�ZdD]Zee
e�s�
ee�e�e<�d�ZdD]Zee
e�s�
ee�e�e<�d�Zd�Zd�Zd�Zy
)rzDWrap 'os' module and 'open()' builtin for virtualizing setup scriptsFc��tt�D�cgc]!}|jd�st||�r|��#c}|_ycc}w)N�_)�dir�_osrY�hasattr�_attrs)rH�names  rr�zAbstractSandbox.__init__s<���C��
���?�?�3�'�G�D�$�,?�
�
����
s�&Ac	�\�|jD]}tt|t||���yr)r��setattrr&�getattr)rH�sourcer�s   r�_copyzAbstractSandbox._copys(���K�K�	5�D��B��g�f�d�3�4�	5rCc��|j|�tr|jt_|jt_d|_yrK)r��_file�builtins�file�_openr
�_activerGs rrIzAbstractSandbox.__enter__s.���
�
�4��� �J�J�H�M��
�
��
���rCc��d|_trtt_tt_|j
t�y�NF)r�r�r�r�r�r
r�r�)rH�exc_type�	exc_value�	tracebacks    rrOzAbstractSandbox.__exit__!s%������!�H�M���
��
�
�3�rCc�@�|5|�cddd�S#1swYyxYw)zRun 'func' under os sandboxingNrB)rH�funcs  r�runzAbstractSandbox.run(s��
�	��6�	�	�	�s��c�6���tt�����fd�}|S)Nc�l��|jr|j�||g|��i|��\}}�||g|��i|��Sr)r��_remap_pair)rH�src�dstr��kwr��originals     ��r�wrapz3AbstractSandbox._mk_dual_path_wrapper.<locals>.wrap0sE����|�|�+�4�+�+�D�#�s�H�T�H�R�H���S��C��2�t�2�r�2�2rC�r�r��r�r�r�s` @r�_mk_dual_path_wrapperz%AbstractSandbox._mk_dual_path_wrapper-s����3��%��	3�
�rC)�rename�link�symlinkNc�>����xstt�����fd�}|S)Nc�b��|jr|j�|g|��i|��}�|g|��i|��Sr)r��_remap_input�rHr!r�r�r�r�s    ��rr�z5AbstractSandbox._mk_single_path_wrapper.<locals>.wrap>s=����|�|�(�t�(�(��t�A�d�A�b�A���D�.�4�.�2�.�.rCr�)r�r�r�s`` r�_mk_single_path_wrapperz'AbstractSandbox._mk_single_path_wrapper;s ����1�w�s�D�1��	/�
�rCr�r
)�stat�listdirr.r
�chmod�chown�mkdir�remove�unlink�rmdir�utime�lchown�chroot�lstat�	startfile�mkfifo�mknod�pathconf�accessc�6���tt�����fd�}|S)Nc���|jr3|j�|g|��i|��}|j��|g|��i|���S�|g|��i|��Sr)r�r��
_remap_outputr�s    ��rr�z4AbstractSandbox._mk_single_with_return.<locals>.wrapcs_����|�|�(�t�(�(��t�A�d�A�b�A���)�)�$���0K��0K��0K�L�L��D�.�4�.�2�.�.rCr�r�s` @r�_mk_single_with_returnz&AbstractSandbox._mk_single_with_return`s����3��%��	/��rC)�readlink�tempnamc�6���tt�����fd�}|S)Nc�T���|i|��}|jr|j�|�S|Sr)r�r�)rHr�r��retvalr�r�s    ��rr�z'AbstractSandbox._mk_query.<locals>.wraprs1����t�*�r�*�F��|�|��)�)�$��7�7��MrCr�r�s` @r�	_mk_queryzAbstractSandbox._mk_queryos����3��%��	��rC)r-�tmpnamc��|S)z=Called to remap or validate any path, whether input or outputrB)rHr!s  r�_validate_pathzAbstractSandbox._validate_path~s���rCc�$�|j|�S�zCalled for path inputs�r��rH�	operationr!r�r�s     rr�zAbstractSandbox._remap_input�����"�"�4�(�(rCc�$�|j|�S)zCalled for path outputsr�)rHr�r!s   rr�zAbstractSandbox._remap_output�r�rCc�j�|j|dz|g|��i|��|j|dz|g|��i|��fS)�?Called for path pairs like rename, link, and symlink operationsz-fromz-to)r��rHr�r�r�r�r�s      rr�zAbstractSandbox._remap_pair�sP��
�D���i�'�1�3�D��D��D��D���i�%�/��B�t�B�r�B�
�	
rCr)r=r>r?r@r�r�r�rIrOr�r�r�r�r�rr�r�r�r�r�r�r�r�r�rBrCrrr
s��N��G�
�5����
�.�9���3���2�4�8�F�H�T�N�9��
�'���6��#�F�E�2�E��;��*�3���4�T�:�F�H�T�N�-;�0	�(�:���3���3�D�9�F�H�T�N�:�	�%�-���3���&�t�_�F�H�T�N�-��)�)�
rCr�devnullc��eZdZdZejgd��ZgZ	efd�Z	d�Z
erdd�Zdd�Zd�Z
d�Zd	�Zd
�Zd�Zdd�Zy
)rz<Restrict operations to a single subdirectory - pseudo-chroot)
r
r�r�r�r�r�r�r�r�r�r�r�r�c��tjjtjj|��|_tjj|jd�|_|D�cgc]>}tjjtjj|����@c}|_tj|�ycc}w)N�)
r&r!�normcase�realpath�_sandboxro�_prefix�_exceptionsrr�)rH�sandbox�
exceptionsr!s    rr�zDirectorySandbox.__init__�s������(�(����)9�)9�'�)B�C��
��w�w�|�|�D�M�M�2�6���AK�
�9=�B�G�G���R�W�W�-�-�d�3�4�
���	� � ��&��
s�5ACc�"�ddlm}||||��)Nr)r)r7r)rHr�r�r�rs     r�
_violationzDirectorySandbox._violation�s��7��y�$��3�3rCc�|�|dvr)|j|�s|jd||g|��i|��t||g|��i|��S)N��r�rtr�rU�Ur�)�_okr�r��rHr!rr�r�s     rr�zDirectorySandbox._file�sH���7�7������������d�@�T�@�R�@���t�1�d�1�b�1�1rCc�|�|dvr)|j|�s|jd||g|��i|��t||g|��i|��S)Nr�r
)r�r�r�rs     rr�zDirectorySandbox._open�sH���3�3�D�H�H�T�N��D�O�O�F�D�$�<��<��<��T�4�-�$�-�"�-�-rCc�&�|jd�y)Nr�)r�rGs rr�zDirectorySandbox.tmpnam�s������!rCc�H�|j}	d|_tjjtjj	|��}|j|�xs,||jk(xs|j|j�	||_S#||_wxYwr�)	r�r&r!r�r��	_exemptedr�rYr�)rHr!�activer�s    rr�zDirectorySandbox._ok�s�������		"� �D�L��w�w�'�'����(8�(8��(>�?�H����x�(�5��t�}�}�,�5��&�&�t�|�|�4�
�"�D�L��6�D�L�s�BB�	B!c����fd�|jD�}�fd�|jD�}tj||�}t	|�S)Nc3�@�K�|]}�j|����y�wrrX)rZ�	exception�filepaths  �rr\z-DirectorySandbox._exempted.<locals>.<genexpr>�s!�����
�/8�H���	�*�
�s�c3�J�K�|]}tj|�����y�wr)�re�match)rZ�patternr	s  �rr\z-DirectorySandbox._exempted.<locals>.<genexpr>�s!�����
�,3�B�H�H�W�h�'�
�s� #)r��_exception_patterns�	itertools�chain�any)rHr	�
start_matches�pattern_matches�
candidatess `   rrzDirectorySandbox._exempted�sI���
�<@�<L�<L�
�
�
�7;�7O�7O�
���_�_�]�O�D�
��:��rCc��||jvrE|j|�s4|j|tjj|�g|��i|��|Sr�)�	write_opsr�r�r&r!r�r�s     rr�zDirectorySandbox._remap_input�sF������&�t�x�x��~��D�O�O�I�r�w�w�'7�'7��'=�K��K��K��rCc�~�|j|�r|j|�s|j|||g|��i|��||fS)r�)r�r�r�s      rr�zDirectorySandbox._remap_pair�s=���x�x��}�D�H�H�S�M��D�O�O�I�s�C�=�$�=�"�=��S�z�rCc��|tzr*|j|�s|jd|||g|��i|��tj|||g|��i|��S)zCalled for low-level os.open()zos.open)�WRITE_FLAGSr�r�r�r
)rHr��flagsrr�r�s      rr
zDirectorySandbox.open�sO���;��t�x�x��~��D�O�O�I�t�U�D�F�4�F�2�F��x�x��e�T�7�D�7�B�7�7rCN)r�)i�)r=r>r?r@r��fromkeysrr�_EXCEPTIONSr�r�r�r�r�r�rr�r�r
rBrCrrr�s]��F��
�
�	
��I�$��4�+6�'�4�

�	2�
.�
"�"����8rCrz4O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYc�V�eZdZdZej
d�j
�Zd�Zy)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.
        c�j�|j\}}}|jjdit���S)NrB)r��tmpl�formatr)rH�cmdr��kwargss    r�__str__zSandboxViolation.__str__s.�� �I�I���T�6��t�y�y���+�&�(�+�+rCN)	r=r>r?r@�textwrap�dedent�lstriprr#rBrCrrr�s+��O��8�?�?�
	��
�f�h�	�,rCrr):r&rr(�operator�	functoolsrr�
contextlibr4r$r�rh�distutils.errorsrr�platformrY�$org.python.modules.posix.PosixModule�pythonr]�posix�PosixModuler�r�r�r��	NameErrorr
r��__all__r�contextmanagerrr#r+r0r6r2rErcr`rkrtr|r~rpr	rr�r�rr�reduce�or_r{r�rr)�as0r�<module>r6s��	�
�����	��
����+�%��<�<���6�"�6�6�

�+�+�b�g�g�
�C���E�	
����
 ����������������
!��
!� ������1�I�1�(+�+�<������2"�
���*��*����"��"���+�*��(E
�E
�P�2�y���:�:�,�K��K�[8��[8�|�i����L�L�H�M�M�O��
�	��Q������,�~�,��Q���E���Bs�F-�	F;
�-F8�7F8

Zerion Mini Shell 1.0