�
źh
8��H�ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl
Z
ddlZddlm
Z
ddlmZej�d��rddlmcmcmcmZnejejZ eZn
#e$rdZYnwxYweZgd�Zd d�Zejd d���Z ejd���Z!ejd ���Z"ejd
���Z#Gd�de$��Z%Gd
�d��Z&ejd���Z'd�Z(ejd���Z)ejd���Z*hd�Z+d�Z,d�Z-d�Z.Gd�d��Z/e0ed��r ej1gZ2ngZ2Gd�de/��Z3ej4ej5d�d�6��D����Z7Gd�de
��Z8dS)!�N)�DistutilsError)�working_set�java)�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 �r/builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/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_argvr1sf�����H�Q�Q�Q�K�E�������������������������e����������s�A�Ac#�K�tjdd�} |V�|tjdd�<dS#|tjdd�<wxYwr)r�path�rs r� save_pathr#<sQ�����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)�replacementrs r�
override_tempr+Es]����
�K��d�+�+�+�+���E�"�H��!�
���� ������5��� � � � s�A�Ac#�K�tj��}tj|�� |V�tj|��dS#tj|��wxYwr)r&�getcwd�chdir)�targetrs r�pushdr0VsR�����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)r2)�pickle�dumps� Exception�setuptools.sandboxr2�dump�repr)�type�exc�clss rr8zUnpickleableException.dumpes{�� 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__�staticmethodr8��rr2r2`s9���������1�1��\�1�1�1rCr2c�$�eZdZdZd�Zd�Zd�ZdS)�ExceptionSaverz^
A Context Manager that will save an exception, serialized, and restore it
later.
c��|SrrB��selfs r� __enter__zExceptionSaver.__enter__zs���rCc�\�|sdSt�||��|_||_dS�NT)r2r8�_saved�_tb)rHr:r;�tbs r�__exit__zExceptionSaver.__exit__}s6��� ��F�,�0�0��s�;�;�������trCc��dt|��vrdSttj|j��\}}|�|j���)z"restore and re-raise any exceptionrLN)�vars�mapr4�loadsrL�with_tracebackrM)rHr:r;s r�resumezExceptionSaver.resume�sG���4��:�:�%�%��F����d�k�2�2� ��c�� � ���*�*�*rCN)r=r>r?r@rIrOrUrBrCrrErEtsK��������
��� � � �+�+�+�+�+rCrEc#�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_namers �r� <genexpr>zsave_modules.<locals>.<genexpr>�sP���������5� � ��#�#�L�1�1�!� � � � � ��rC)r�modules�copyrE�update�_clear_modulesrU)� saved_exc�del_modulesrs @r�save_modulesrc�s������
�K�����E� � � ��Y������������������������K���u�������������K��;����
�������s�A�A�Ac�D�t|��D]}tj|=�dSr)�listrr])�module_namesr[s rr`r`�s0����&�&�"�"���K��!�!�"�"rCc#�K�tj��} |V�tj|��dS#tj|��wxYwr)�
pkg_resources�__getstate__�__setstate__r"s r�save_pkg_resources_staterk�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!�joinrkrcr#�hide_setuptoolsrr+r0�
__import__)� setup_dir�temp_dirs r�
setup_contextrt�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�7C �C�C �
C�C �C1�C
�C1�!C
�"C1�%D�1C5�5D�8C5�9D�<D �D �D �D �D � D$�'D$>�Cython� distutilsrnrh�_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)r[�base_modules r�
_needs_hidingr~�s(��"�.�.��a�(�(��+�K��*�*�*rCc���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.
rwN)rr]�get�_remove_shim�filterr~r`)rwr]s rrprp�sW���k�o�o�&7��>�>�O��"��$�$�&�&�&��]�C�K�0�0�G��7�����rCc��tj�tj�|����}t |��5 |gt|��ztjdd�<tj�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�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�Q�Q�Q�K��H�O�O�A�y�)�)�)�� �"�"�"��!�(�(�)E�)E�F�F�F�!�)�,�,�
,�
,��<�*�E�E�E���,��+�+�+�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,����
,�
,�
,�
,���� � � ��v�
�!�&��)�
����������� ����
�
�
�
�
�
�
�
�
�
�
�
����
�
�
�
�
�
sa�E�BD�"D�4D�D �D�D �D�E�
D5�D0�+E�0D5�5E�E �E c���eZdZdZdZd�Zd�Zd�Zd�Zd�Z d�Z
d D]$Zee
e��re
e��e��e<�%dd�Zerede��Zed
e��ZdD]$Zee
e��ree��e��e<�%d�ZdD]$Zee
e��ree��e��e<�%d�ZdD]$Zee
e��ree��e��e<�%d�Zd�Zd�Zd�Zd
S)rzDWrap 'os' module and 'open()' builtin for virtualizing setup scriptsFc�R���fd�tt��D���_dS)Nc�^��g|])}|�d���t�|���'|��*S)�_)rY�hasattr)rZ�namerHs �r�
<listcomp>z,AbstractSandbox.__init__.<locals>.<listcomp>sO���
�
�
���?�?�3�'�'�
�-4�D�$�,?�,?�
��
�
�
rC)�dir�_os�_attrsrGs`rr�zAbstractSandbox.__init__s7���
�
�
�
��C���
�
�
����rCc �b�|jD]&}tt|t||�����'dSr)r��setattrr&�getattr)rH�sourcer�s r�_copyzAbstractSandbox._copys<���K� 5� 5�D��B��g�f�d�3�3�4�4�4�4� 5� 5rCc��|�|��tr|jt_|jt_d|_dSrK)r��_file�builtins�file�_openr
�_activerGs rrIzAbstractSandbox.__enter__s9���
�
�4����� '� �J�H�M��
��
�����rCc��d|_trtt_tt_|�t��dS�NF)r�r�r�r�r�r
r�r�)rH�exc_type� exc_value� tracebacks rrOzAbstractSandbox.__exit__!s2������ "�!�H�M���
��
�
�3�����rCc�N�|5|��cddd��S#1swxYwYdS)zRun 'func' under os sandboxingNrB)rH�funcs r�runzAbstractSandbox.run(su��
� � ��4�6�6� � � � � � � � � � � � ���� � � � � � s�
��c�@���tt������fd�}|S)Nc�X��|jr|j�||g|�Ri|��\}}�||g|�Ri|��Sr)r��_remap_pair)rH�src�dstr��kwr��originals ��r�wrapz3AbstractSandbox._mk_dual_path_wrapper.<locals>.wrap0sZ����|�
I�+�4�+�D�#�s�H�T�H�H�H�R�H�H���S��8�C��2�t�2�2�2�r�2�2�2rC�r�r��r�r�r�s` @r�_mk_dual_path_wrapperz%AbstractSandbox._mk_dual_path_wrapper-s8�����3��%�%�� 3� 3� 3� 3� 3� 3�
�rC)�rename�link�symlinkNc�D����ptt������fd�}|S)Nc�N��|jr|j�|g|�Ri|��}�|g|�Ri|��Sr)r��_remap_input�rHr!r�r�r�r�s ��rr�z5AbstractSandbox._mk_single_path_wrapper.<locals>.wrap>sR����|�
B�(�t�(��t�A�d�A�A�A�b�A�A���8�D�.�4�.�.�.�2�.�.�.rCr�)r�r�r�s`` r�_mk_single_path_wrapperz'AbstractSandbox._mk_single_path_wrapper;s=�����1�w�s�D�1�1�� /� /� /� /� /� /�
�rCr�r
)�stat�listdirr.r
�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>.wrapcs�����|�
M�(�t�(��t�A�d�A�A�A�b�A�A���)�)�$����0K��0K�0K�0K��0K�0K�L�L�L��8�D�.�4�.�.�.�2�.�.�.rCr�r�s` @r�_mk_single_with_returnz&AbstractSandbox._mk_single_with_return`s8�����3��%�%�� /� /� /� /� /� /��rC)�readlink�tempnamc�@���tt������fd�}|S)Nc�R���|i|��}|jr|��|��S|Sr)r�r�)rHr�r��retvalr�r�s ��rr�z'AbstractSandbox._mk_query.<locals>.wraprs<����X�t�*�r�*�*�F��|�
8��)�)�$��7�7�7��MrCr�r�s` @r� _mk_queryzAbstractSandbox._mk_queryos8�����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�,�|�|��S�zCalled for path inputs�r��rH� operationr!r�r�s rr�zAbstractSandbox._remap_input�����"�"�4�(�(�(rCc�,�|�|��S)zCalled for path outputsr�)rHr�r!s rr�zAbstractSandbox._remap_output�r�rCc�V�|j|dz|g|�Ri|��|j|dz|g|�Ri|��fS)�?Called for path pairs like rename, link, and symlink operationsz-fromz-to)r��rHr�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�
�
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�N��G�
�
�
�5�5�5����������
���.�9�9���7�3���� 9�2�2�4�8�8�F�F�H�H�T�N������
�7�'�'���6�6��#�#�F�E�2�2�E��;�;��*�7�3���� ;�4�4�T�:�:�F�F�H�H�T�N�� � � �(�:�:���7�3���� :�3�3�D�9�9�F�F�H�H�T�N�� � � �%�-�-���7�3���� -�&�Y�t�_�_�F�F�H�H�T�N�����)�)�)�)�)�)�
�
�
�
�
rCr�devnullc��eZdZdZe�gd���ZgZ efd�Z d�Z
erdd�Zdd�Zd�Z
d �Zd
�Zd�Zd�Zdd�ZdS)rz<Restrict operations to a single subdirectory - pseudo-chroot)
r
r�r�r�r�r�r�r�r�r�r�r�r�c�2�tj�tj�|����|_tj�|jd��|_d�|D��|_t� |��dS)N�c��g|]>}tj�tj�|������?SrB)r&r!�normcase�realpath)rZr!s rr�z-DirectorySandbox.__init__.<locals>.<listcomp>�sE��
�
�
�9=�B�G���R�W�-�-�d�3�3�4�4�
�
�
rC)
r&r!r�r��_sandboxro�_prefix�_exceptionsrr�)rH�sandbox�
exceptionss rr�zDirectorySandbox.__init__�s����(�(���)9�)9�'�)B�)B�C�C��
��w�|�|�D�M�2�6�6���
�
�AK�
�
�
��� � � ��&�&�&�&�&rCc�(�ddlm}||||���)Nr)r)r7r)rHr�r�r�rs r�
_violationzDirectorySandbox._violation�s)��7�7�7�7�7�7���y�$��3�3�3rC�rc�|�|dvr(|�|��s|jd||g|�Ri|��t||g|�Ri|��S)N�r��rtr�rU�Ur�)�_okr�r��rHr!rr�r�s rr�zDirectorySandbox._file�sc���7�7�7�������7������d�@�T�@�@�@�R�@�@�@���t�1�d�1�1�1�b�1�1�1rCc�|�|dvr(|�|��s|jd||g|�Ri|��t||g|�Ri|��S)Nr�r
)rr�r�rs rr�zDirectorySandbox._open�sc���3�3�3�D�H�H�T�N�N�3��D�O�F�D�$�<��<�<�<��<�<�<��T�4�-�$�-�-�-�"�-�-�-rCc�0�|�d��dS)Nr�)r�rGs rr�zDirectorySandbox.tmpnam�s������!�!�!�!�!rCc�4�|j} d|_tj�tj�|����}|�|��p$||jkp|�|j�� ||_S#||_wxYwr�) r�r&r!r�r�� _exemptedr�rYr�)rHr!�activer�s 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��dSrrX)rZ� exception�filepaths �rr\z-DirectorySandbox._exempted.<locals>.<genexpr>�sB�����
�
�/8�H��� �*�*�
�
�
�
�
�
rCc3�B�K�|]}tj|���V��dSr)�re�match)rZ�patternrs �rr\z-DirectorySandbox._exempted.<locals>.<genexpr>�s@�����
�
�,3�B�H�W�h�'�'�
�
�
�
�
�
rC)r��_exception_patterns� itertools�chain�any)rHr�
start_matches�pattern_matches�
candidatess ` rrzDirectorySandbox._exempted�sx���
�
�
�
�<@�<L�
�
�
�
�
�
�
�
�7;�7O�
�
�
���_�]�O�D�D�
��:���rCc��||jvrD|�|��s/|j|tj�|��g|�Ri|��|Sr�)� write_opsrr�r&r!r�r�s rr�zDirectorySandbox._remap_input�sW�����&�&�t�x�x��~�~�&��D�O�I�r�w�'7�'7��'=�'=�K��K�K�K��K�K�K��rCc��|�|��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�rC�c��|tzr)|�|��s|jd|||g|�Ri|��tj|||g|�Ri|��S)zCalled for low-level os.open()zos.open)�WRITE_FLAGSrr�r�r
)rHr��flagsrr�r�s rr
zDirectorySandbox.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�7rCN)r�)r)r=r>r?r@r��fromkeysrr�_EXCEPTIONSr�r�r�r�r�rrr�r�r
rBrCrrr�s�������F�F��
�
�
�
�
���I�$��4�+6�'�'�'�'�4�4�4�
�2� 2� 2� 2� 2�
.�.�.�.�
"�"�"�"�"�"����������8�8�8�8�8�8rCrc�:�g|]}tt|d����S)rr�)rZ�as rr�r��s4�����
� ��Q������rCz4O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARYc�\�eZdZdZejd�����Zd�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.
c�T�|j\}}}|jjdit����S)NrB)r��tmpl�formatr)rH�cmdr��kwargss r�__str__zSandboxViolation.__str__s/�� �I���T�6��t�y��+�+�&�(�(�+�+�+rCN) r=r>r?r@�textwrap�dedent�lstripr%r)rBrCrrr�sO������O�O��8�?�
���
�f�h�h� �,�,�,�,�,rCrr)9r&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�r r�reduce�or_r{rrrBrCr�<module>r;s��� � � � �
�
�
�
����������������� � � � �����
�
�
�
�������������+�+�+�+�+�+�%�%�%�%�%�%��<���6�"�"��6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�6�
�+�b�g�
�C���E�E�������E�E�E�����������
�
�
�
������������������
!�
!���
!� �������1�1�1�1�1�I�1�1�1�(+�+�+�+�+�+�+�+�<�������2"�"�"�
��*�*���*���"�"���"�����+�+�+�*������(E
�E
�E
�E
�E
�E
�E
�E
�P�7�2�y�����:�,�K�K��K�[8�[8�[8�[8�[8��[8�[8�[8�|�i���L���G�M�M�O�O�������,�,�,�,�,�~�,�,�,�,�,s�:A=�=B�B |