Your IP : 3.149.241.93


Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools/__pycache__/sandbox.cpython-311.pyc

�

\�bg::��p�ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZmZmZddlZddlmZddlmZerddlZn<e
j�d��rddlmcmcmcmZne
jejZe Z!erddl"m#Z#gd	�Z$d$d
�Z%ej&d$d���Z'ej&d���Z(ej&d
���Z)ej&d���Z*Gd�de+��Z,Gd�d��Z-ej&d���Z.d�Z/ej&d���Z0ej&d���Z1hd�Z2d�Z3d�Z4d�Z5Gd�d��Z6e7ed��r	ej8gZ9ngZ9Gd�de6��Z:ej;ej<d �d!�=��D����Z>Gd"�d#e��Z?dS)%�)�annotationsN)�
TracebackType)�
TYPE_CHECKING�Any�ClassVar)�working_set)�DistutilsError�java)�Self)�AbstractSandbox�DirectorySandbox�SandboxViolation�	run_setupc���d}t||��5}|���}ddd��n#1swxYwY|�|}t||d��}t|||��dS)z.
    Python 3 implementation of execfile.
    �rbN�exec)�open�read�compiler)�filename�globals�locals�mode�stream�script�codes       �c/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/sandbox.py�	_execfiler*s����D�	
�h��	�	���������������������������
�~����6�8�V�,�,�D���w������s�4�8�8c#�K�tjdd�}|�|tjdd�<	|V�|tjdd�<dS#|tjdd�<wxYw�N)�sys�argv)�repl�saveds  r�	save_argvr%7sf�����H�Q�Q�Q�K�E�������������������������e����������s�A�Ac#�K�tjdd�}	|V�|tjdd�<dS#|tjdd�<wxYwr )r!�path�r$s r�	save_pathr)BsQ�����H�Q�Q�Q�K�E����������������e����������s	�/�Ac#�K�tj|d���tj}|t_	dV�|t_dS#|t_wxYw)zL
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    T)�exist_okN)�os�makedirs�tempfile�tempdir)�replacementr$s  r�
override_tempr1Ks]����
�K��d�+�+�+�+���E�"�H��!�
���� ������5��� � � � s�A�Ac#�K�tj��}tj|��	|V�tj|��dS#tj|��wxYwr )r,�getcwd�chdir)�targetr$s  r�pushdr6\sR�����I�K�K�E��H�V���������
������������������s�A�Ac�(�eZdZdZed���ZdS)�UnpickleableExceptionzP
    An exception representing another Exception that could not be pickled.
    c	���	tj|��tj|��fS#t$r5ddlm}|�||t
|������cYSwxYw)z�
        Always return a dumped (pickled) type and exc. If exc can't be pickled,
        wrap it in UnpickleableException first.
        r)r8)�pickle�dumps�	Exception�setuptools.sandboxr8�dump�repr)�type�exc�clss   rr>zUnpickleableException.dumpks{��	1��<��%�%�v�|�C�'8�'8�8�8���	1�	1�	1�G�G�G�G�G�G��8�8�C���T�#�Y�Y���0�0�0�0�0�		1���s�'*�<A)�(A)N)�__name__�
__module__�__qualname__�__doc__�staticmethodr>��rr8r8fs9���������1�1��\�1�1�1rIr8c�(�eZdZdZdd�Zdd�Zd
�ZdS)�ExceptionSaverz]
    A Context Manager that will save an exception, serialize, and restore it
    later.
    �returnrc��|Sr rH��selfs r�	__enter__zExceptionSaver.__enter__�s���rIr@�type[BaseException] | NonerA�BaseException | None�tb�TracebackType | None�boolc�\�|sdSt�||��|_||_dS)NFT)r8r>�_saved�_tb)rOr@rArSs    r�__exit__zExceptionSaver.__exit__�s8���	��5�,�0�0��s�;�;�������trIc��dt|��vrdSttj|j��\}}|�|j���)z"restore and re-raise any exceptionrWN)�vars�mapr:�loadsrW�with_tracebackrX)rO�_typerAs   r�resumezExceptionSaver.resume�sG���4��:�:�%�%��F����t�{�3�3�
��s�� � ���*�*�*rIN)rLr)r@rQrArRrSrTrLrU)rCrDrErFrPrYr`rHrIrrKrKzsU��������
�������� +�+�+�+�+rIrKc#�P�K�tj����t��5}�V�ddd��n#1swxYwYtj�����fd�tjD��}t|��|���dS)z�
    Context in which imported modules are saved.

    Translates exceptions internal to the context into the equivalent exception
    outside the context.
    Nc3�N�K�|]}|�v�|�d���|V�� dS)z
encodings.N��
startswith)�.0�mod_namer$s  �r�	<genexpr>zsave_modules.<locals>.<genexpr>�sP���������5� � ��#�#�L�1�1�!�	� � � � ��rI)r!�modules�copyrK�update�_clear_modulesr`)�	saved_exc�del_modulesr$s  @r�save_modulesrn�s������
�K�����E�	�	�	��Y������������������������K���u�������������K��;����
�������s�A�A�Ac�D�t|��D]}tj|=�dSr )�listr!rh)�module_namesrfs  rrkrk�s0����&�&�"�"���K��!�!�"�"rIc#�K�tj��}	|V�tj|��dS#tj|��wxYwr )�
pkg_resources�__getstate__�__setstate__r(s r�save_pkg_resources_staterv�sP�����&�(�(�E�*������"�5�)�)�)�)�)��
�"�5�)�)�)�)���s	�1�Ac#�ZK�tj�|d��}t��5t	��5t��5t
��t��5t|��5t|��5td��dV�ddd��n#1swxYwYddd��n#1swxYwYddd��n#1swxYwYddd��n#1swxYwYddd��n#1swxYwYddd��dS#1swxYwYdS)N�temp�
setuptools)r,r'�joinrvrnr)�hide_setuptoolsr%r1r6�
__import__)�	setup_dir�temp_dirs  r�
setup_contextr�s������w�|�|�I�v�.�.�H�	!�	#�	#�	"�	"�
�^�^�	"�	"����
"�
"��!�!�!��[�[�"�"�&�x�0�0�"�"�"�9�-�-�"�"�&�|�4�4�4�!�E�E�E�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"�"�"�"�"�"�"�"�"�"�"�"����"�"�"�"�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"�
"����
"�
"�
"�
"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"�	"����	"�	"�	"�	"�	"�	"s��D �D�C1�,C	�<C�B,
� C�,B0�0C�3B0�4C�7C	�C�C	�
C�C	�C1�C
�C1�!C
�"C1�%D�1C5�5D�8C5�9D�<D �D	�D �D	�D � D$�'D$>�Cython�	distutilsryrs�_distutils_hackc�L�|�dd��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)rf�base_modules  r�
_needs_hidingr��s(��"�.�.��a�(�(��+�K��*�*�*rIc���tj�dd��}|�|���t	t
tj��}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)r!rh�get�_remove_shim�filterr�rk)r�rhs  rr{r{�sW���k�o�o�&7��>�>�O��"��$�$�&�&�&��]�C�K�0�0�G��7�����rIc��tj�tj�|����}t	|��5	|gt|��ztjdd�<tj�d|��tj
��tj�d���t|��5t|d���}t||��ddd��n#1swxYwYn,#t $r}|jr|jdr�Yd}~nd}~wwxYwddd��dS#1swxYwYdS)z8Run a distutils setup script, sandboxed in its directoryNrc�*�|���Sr )�activate)�dists r�<lambda>zrun_setup.<locals>.<lambda>
s��d�m�m�o�o�rI�__main__)�__file__rC)r,r'�abspath�dirnamerrpr!r"�insertr�__init__�	callbacks�appendr
�dictr�
SystemExit�args)�setup_scriptr�r}�ns�vs     rrrs������������ =� =�>�>�I�	�y�	!�	!�
�
�	�'�.�4��:�:�5�C�H�Q�Q�Q�K��H�O�O�A�y�)�)�)�� �"�"�"��!�(�(�)E�)E�F�F�F�!�)�,�,�
,�
,��<�*�E�E�E���,��+�+�+�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,����
,�
,�
,�
,����	�	�	��v�
�!�&��)�
�����������	����
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
sa�E�BD�"D�4D�D	�D�D	�D�E�
D5�D0�+E�0D5�5E�E	�E	c���eZdZdZdZd"d�Zd�Zd"d�Zd#d�Zd�Z	d$d�Z
dD]$Zee
e��re
e��e��e<�%d%d$d�Zede��ZdD]$Zee
e��ree��e��e<�%d$d�ZdD]$Zee
e��ree��e��e<�%d$d�ZdD]$Zee
e��ree��e��e<�%d�Zd�Zd�Zd�Zerd&d!�ZdSdS)'rzDWrap 'os' module and 'open()' builtin for virtualizing setup scriptsFrL�Nonec�R���fd�tt��D���_dS)Nc�^��g|])}|�d���t�|���'|��*S)�_)rd�hasattr)re�namerOs  �r�
<listcomp>z,AbstractSandbox.__init__.<locals>.<listcomp>sO���
�
�
���?�?�3�'�'�
�-4�D�$�,?�,?�
��
�
�
rI)�dir�_os�_attrsrNs`rr�zAbstractSandbox.__init__s7���
�
�
�
��C���
�
�
����rIc	�b�|jD]&}tt|t||�����'dSr )r��setattrr,�getattr)rO�sourcer�s   r�_copyzAbstractSandbox._copy!s<���K�	5�	5�D��B��g�f�d�3�3�4�4�4�4�	5�	5rIc�`�|�|��|jt_d|_dS)NT)r��_open�builtinsr�_activerNs rrPzAbstractSandbox.__enter__%s(���
�
�4�����
��
�����rI�exc_typerQ�	exc_valuerR�	tracebackrTc�j�d|_tt_|�t
��dS�NF)r�r�r�rr�r�)rOr�r�r�s    rrYzAbstractSandbox.__exit__*s%�������
��
�
�3�����rIc�N�|5|��cddd��S#1swxYwYdS)zRun 'func' under os sandboxingNrH)rO�funcs  r�runzAbstractSandbox.run4su��
�	�	��4�6�6�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�
��r��strc�@���tt������fd�}|S)Nc�X��|jr|j�||g|�Ri|��\}}�||g|�Ri|��Sr )r��_remap_pair)rO�src�dstr��kwr��originals     ��r�wrapz3AbstractSandbox._mk_dual_path_wrapper.<locals>.wrap<sZ����|�
I�+�4�+�D�#�s�H�T�H�H�H�R�H�H���S��8�C��2�t�2�2�2�r�2�2�2rI�r�r��r�r�r�s` @r�_mk_dual_path_wrapperz%AbstractSandbox._mk_dual_path_wrapper9s8�����3��%�%��	3�	3�	3�	3�	3�	3�
�rI)�rename�link�symlinkNc�D����ptt������fd�}|S)Nc�N��|jr|j�|g|�Ri|��}�|g|�Ri|��Sr )r��_remap_input�rOr'r�r�r�r�s    ��rr�z5AbstractSandbox._mk_single_path_wrapper.<locals>.wrapJsR����|�
B�(�t�(��t�A�d�A�A�A�b�A�A���8�D�.�4�.�.�.�2�.�.�.rIr�)r�r�r�s`` r�_mk_single_path_wrapperz'AbstractSandbox._mk_single_path_wrapperGs=�����1�w�s�D�1�1��	/�	/�	/�	/�	/�	/�
�rIr)�stat�listdirr4r�chmod�chown�mkdir�remove�unlink�rmdir�utime�lchown�chroot�lstat�	startfile�mkfifo�mknod�pathconf�accessc�@���tt������fd�}|S)Nc���|jr2|j�|g|�Ri|��}|���|g|�Ri|����S�|g|�Ri|��Sr )r�r��
_remap_outputr�s    ��rr�z4AbstractSandbox._mk_single_with_return.<locals>.wrapms�����|�
M�(�t�(��t�A�d�A�A�A�b�A�A���)�)�$����0K��0K�0K�0K��0K�0K�L�L�L��8�D�.�4�.�.�.�2�.�.�.rIr�r�s` @r�_mk_single_with_returnz&AbstractSandbox._mk_single_with_returnjs8�����3��%�%��	/�	/�	/�	/�	/�	/��rI)�readlink�tempnamc�@���tt������fd�}|S)Nc�R���|i|��}|jr|��|��S|Sr )r�r�)rOr�r��retvalr�r�s    ��rr�z'AbstractSandbox._mk_query.<locals>.wrap|s<����X�t�*�r�*�*�F��|�
8��)�)�$��7�7�7��MrIr�r�s` @r�	_mk_queryzAbstractSandbox._mk_queryys8�����3��%�%��	�	�	�	�	�	��rI)r3�tmpnamc��|S)z=Called to remap or validate any path, whether input or outputrH)rOr's  r�_validate_pathzAbstractSandbox._validate_path�s���rIc�,�|�|��S�zCalled for path inputs�r��rO�	operationr'r�r�s     rr�zAbstractSandbox._remap_input�����"�"�4�(�(�(rIc�,�|�|��S)zCalled for path outputsr�)rOr�r's   rr�zAbstractSandbox._remap_output�r�rIc�V�|j|dz|g|�Ri|��|j|dz|g|�Ri|��fS)�?Called for path pairs like rename, link, and symlink operationsz-fromz-to)r��rOr�r�r�r�r�s      rr�zAbstractSandbox._remap_pair�s\��
�D��i�'�1�3�D��D�D�D��D�D��D��i�%�/��B�t�B�B�B�r�B�B�
�	
rIrc��dSr rH)rOr�s  r�__getattribute__z AbstractSandbox.__getattribute__�s���rI�rLr�)r�rQr�rRr�rT)r�r�r )r�r�rLr)rCrDrErFr�r�r�rPrYr�r��_AbstractSandbox__namer�r�rr�r�r�r�r�r�r�r�rr�rHrIrrrsA������N�N��G�
�
�
�
�5�5�5�����
�������
����0�=�=���7�3����	=�4�4�V�<�<�F�F�H�H�V��������
$�#�F�E�2�2�E��?�?��*�7�3����	?�6�6�v�>�>�F�F�H�H�V���	�	�	�	�*�>�>���7�3����	>�5�5�f�=�=�F�F�H�H�V���	�	�	�	�'�1�1���7�3����	1�(�y��0�0�F�F�H�H�V������)�)�)�)�)�)�
�
�
��:�	:�9�9�9�9�9�:�:rIr�devnullc��eZdZUdZe�gd���Zded<gZded<	e	fdd	�Z
d
�Zdd�Zdd
�Z
d�Zd�Zd�Zd�Zddd�ZdS)r
z<Restrict operations to a single subdirectory - pseudo-chroot)
rr�r�r�r�r�r�r�r�r�r�r�r�zClassVar[dict[str, None]]�	write_opszlist[str | re.Pattern]�_exception_patternsrLr�c�2�tj�tj�|����|_tj�|jd��|_d�|D��|_t�	|��dS)N�c��g|]>}tj�tj�|������?SrH)r,r'�normcase�realpath)rer's  rr�z-DirectorySandbox.__init__.<locals>.<listcomp>�sE��
�
�
�9=�B�G���R�W�-�-�d�3�3�4�4�
�
�
rI)
r,r'rr�_sandboxrz�_prefix�_exceptionsrr�)rO�sandbox�
exceptionss   rr�zDirectorySandbox.__init__�s����(�(���)9�)9�'�)B�)B�C�C��
��w�|�|�D�M�2�6�6���
�
�AK�
�
�
���	� � ��&�&�&�&�&rIc�(�ddlm}||||���)Nr)r)r=r)rOr�r�r�rs     r�
_violationzDirectorySandbox._violation�s)��7�7�7�7�7�7���y�$��3�3�3rI�rc�|�|dvr(|�|��s|jd||g|�Ri|��t||g|�Ri|��S)N)r
�rtr�rU�Ur)�_okrr�)rOr'rr�r�s     rr�zDirectorySandbox._open�sc���3�3�3�D�H�H�T�N�N�3��D�O�F�D�$�<��<�<�<��<�<�<��T�4�-�$�-�-�-�"�-�-�-rIc�0�|�d��dS)Nr�)rrNs rr�zDirectorySandbox.tmpnam�s������!�!�!�!�!rIc�4�|j}	d|_tj�tj�|����}|�|��p$||jkp|�|j��	||_S#||_wxYwr�)	r�r,r'rr�	_exemptedrrdr)rOr'�activers    rrzDirectorySandbox._ok�s������		"� �D�L��w�'�'���(8�(8��(>�(>�?�?�H����x�(�(�5��t�}�,�5��&�&�t�|�4�4�
�"�D�L�L��6�D�L�!�!�!�!s�A<B�	Bc����fd�|jD��}�fd�|jD��}tj||��}t	|��S)Nc3�B�K�|]}��|��V��dSr rc)re�	exception�filepaths  �rrgz-DirectorySandbox._exempted.<locals>.<genexpr>�sB�����
�
�/8�H���	�*�*�
�
�
�
�
�
rIc3�B�K�|]}tj|���V��dSr )�re�match)re�patternrs  �rrgz-DirectorySandbox._exempted.<locals>.<genexpr>�s@�����
�
�,3�B�H�W�h�'�'�
�
�
�
�
�
rI)rr�	itertools�chain�any)rOr�
start_matches�pattern_matches�
candidatess `   rrzDirectorySandbox._exempted�sx���
�
�
�
�<@�<L�
�
�
�
�
�
�
�
�7;�7O�
�
�
���_�]�O�D�D�
��:���rIc��||jvrD|�|��s/|j|tj�|��g|�Ri|��|Sr�)r�rrr,r'rr�s     rr�zDirectorySandbox._remap_input�sW�����&�&�t�x�x��~�~�&��D�O�I�r�w�'7�'7��'=�'=�K��K�K�K��K�K�K��rIc��|�|��r|�|��s|j|||g|�Ri|��||fS)r�)rrr�s      rr�zDirectorySandbox._remap_pair�sU���x�x��}�}�	>�D�H�H�S�M�M�	>��D�O�I�s�C�=�$�=�=�=�"�=�=�=��S�z�rI�r�intc��|tzr)|�|��s|jd|||g|�Ri|��tj|||g|�Ri|��S)zCalled for low-level os.open()zos.open)�WRITE_FLAGSrrr�r)rO�file�flagsrr�r�s      rrzDirectorySandbox.open�sn���;��	G�t�x�x��~�~�	G��D�O�I�t�U�D�F�4�F�F�F�2�F�F�F��x��e�T�7�D�7�7�7�B�7�7�7rINr�)r
)r')rr(rLr()rCrDrErFr��fromkeysr��__annotations__r�_EXCEPTIONSr�rr�r�rrr�r�rrHrIrr
r
�s�������F�F�+/�=�=�:�:�:�,�,�I����� 35��4�4�4�4�4�+6�'�'�'�'�'�4�4�4�
.�.�.�.�
"�"�"�"�"�"�"����������8�8�8�8�8�8�8rIr
c�:�g|]}tt|d����S)rr�)re�as  rr�r��s4�����
�	��Q������rIz4O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYc�^�eZdZdZejd�����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.
        rLr�c�T�|j\}}}|jjdit����S)NrH)r��tmpl�formatr)rO�cmdr��kwargss    r�__str__zSandboxViolation.__str__s/�� �I���T�6��t�y��+�+�&�(�(�+�+�+rIN)rLr�)	rCrDrErF�textwrap�dedent�lstripr4r8rHrIrrrsT������O�O��8�?�
	���
�f�h�h�	�,�,�,�,�,�,rIrr )@�
__future__rr��
contextlib�	functoolsr�operatorr,r:rr!r.r9�typesr�typingrrrrsr�distutils.errorsr	r��platformrd�$org.python.modules.posix.PosixModule�pythonrh�posix�PosixModuler�rr��typing_extensionsr�__all__r�contextmanagerr%r)r1r6r<r8rKrnrkrvrr�r�r{rrr�r�r/r
�reduce�or_r�r*rrHrIr�<module>rMs��"�"�"�"�"�"���������������������	�	�	�	�
�
�
�
�	�	�	�	�
�
�
�
���������������/�/�/�/�/�/�/�/�/�/�����%�%�%�%�%�%�+�+�+�+�+�+���������\���V�$�$��6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�

�+�b�g�
�C����'�&�&�&�&�&�&�����
 �
 �
 �
 ������������������
!�
!���
!� �������1�1�1�1�1�I�1�1�1�( +� +� +� +� +� +� +� +�F�������2"�"�"�
��*�*���*���"�"���"�����+�+�+�*������(I:�I:�I:�I:�I:�I:�I:�I:�X�7�2�y�����:�,�K�K��K�R8�R8�R8�R8�R8��R8�R8�R8�j�i���L���G�M�M�O�O�������,�,�,�,�,�~�,�,�,�,�,rI

?>