Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/clselect/clselectnodejsuser/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clselect/clselectnodejsuser/__pycache__/environments.cpython-311.pyc

�

!�g����ddlmZddlmZddlmZddlZddlZddlZddlmZm	Z	m
Z
ddlmZdZ
ej�ej�e��d	��Zd
ZdZGd�d
e��Zdd�Zdd�Zdd�Zdd�ZdS)�)�print_function)�division)�absolute_importN)�
check_call�	list_dirs�run_command_full�)�Interpreter�nodevenvznodevenv.pyz /opt/cloudlinux/venv/bin/python3zpackage.jsonc�r�eZdZdd�Zd�Zd�Zdd�Zdd�Zdd�Zd	�Z	d
�Z
d�Zd�Zdd�Z
d�Zd�Zd�Zd�ZdS)�EnvironmentNc�\�||_|r||_n/tjt	j����j|_|�
t|_n||_tj	�
t|j|j��|��|_	d|_d|_
d|z|_dS)N�node)�name�user�pwd�getpwuid�os�getuid�pw_name�DEFAULT_PREFIX�prefix�path�join�_abs_prefix�_interpreter�_npm�interpreter_name)�selfrrrs    �_/opt/cloudlinux/venv/lib64/python3.11/site-packages/clselect/clselectnodejsuser/environments.py�__init__zEnvironment.__init__s�����	��	:��D�I�I���R�Y�[�[�1�1�9�D�I��>�(�D�K�K� �D�K��G�L�L��T�Y���!D�!D�d�K�K��	� �����	� &��
�����c
�j�|jj�d|jj�d|j�d|j�d|j�d�
S)N�.z(name='z	', user='z', prefix='z'))�	__class__�
__module__�__name__rrr�rs r �__repr__zEnvironment.__repr__*s@���N�%�%�%�t�~�'>�'>�'>��I�I�I�t�y�y�y�$�+�+�+�/�	0r"c�H���tj�j�����fd�}|S)Nc���tj�j��tj�j���jtjd<�jtjd<dS)N�USER�HOME)r�setgid�pw_gid�setuid�pw_uidr�environ�pw_dir)r�user_pwds��r �funcz!Environment._demote.<locals>.func2sI����I�h�o�&�&�&��I�h�o�&�&�&�!%��B�J�v��!)��B�J�v���r")r�getpwnamr)rr5r4s` @r �_demotezEnvironment._demote/s:�����<��	�*�*��	1�	1�	1�	1�	1�	1��r"c�l�|j|���d�}|r||=t||��|iS|S�N)r�interpreter)rr:�getattr�r�key�es   r �as_dictzEnvironment.as_dict:sM���I��+�+�-�-�
�
���	+��#���D�#�&�&��*�*��r"c��|j|������d�}|r||=t||��|iS|Sr9)rr:r?r;r<s   r �as_deepdictzEnvironment.as_deepdictDsY���I��+�+�-�-�5�5�7�7�
�
���	+��#���D�#�&�&��*�*��r"Fc��ttd|jg}|r|�d��|�|j��d|���i}t
j��dkrdg|z}t|i|��dS)Nz--nodez--recreate-bin�
preexec_fnrz/bin/cagefs_enter)	�PYTHON_PATH�NODEVENV_BIN�binary�appendrr7rrr)rr:�
destroy_first�args�kwargss     r �createzEnvironment.createNs������k�(�
���	*��K�K�(�)�)�)����D�I����������/��
�9�;�;�!���'�(�4�/�D��D�#�F�#�#�#�#�#r"c�\�tddd|j|������dS)Nz/bin/rmz-rz--interactive=never�rC)rrr7r(s r �destroyzEnvironment.destroy[s9���9�d�$9�4�9�"�l�l�n�n�	.�	.�	.�	.�	.�	.r"c�J�tj�|j��S�N)rr�existsr(s r rQzEnvironment.exists_s���w�~�~�d�i�(�(�(r"c�R�|jst|j���|_|jS)N)r)rr
rr(s r r:zEnvironment.interpreterbs+��� �	>� +�4�9� =� =� =�D��� � r"c�t�|js+tj�|jdd��|_|jS)N�bin�npm)rrrrr(s r rUzEnvironment.npmgs/���y�	>�����T�Y��u�=�=�D�I��y�r"�-c� �|���df}|dkr||fz
}nFtj�|t��}tj�|��sdSt
||���|���dS)z�
        Install nodejs extension
        :param cwd: current working directory for npm (it's full path to app root by default)
        :param extension: name and version of extension
        :return: None
        �installrVr)rIrC�cwdN)rUrrr�
APP_CONFIG�isfilerr7)r�	extensionrY�command�config_paths     r �extension_installzEnvironment.extension_installls����8�8�:�:�y�)�������	�|�#�G�G��'�,�,�s�J�7�7�K��7�>�>�+�.�.�
��q�	��D�L�L�N�N��D�D�D�D�D�Dr"c��|���dg}|�|��t||������\}}}|S)z~
        Install nodejs extension
        :param extensions_list: name and version of extension
        :return: None
        rXrM)rU�extendrr7)r�extensions_listr]�ret_code�_s     r �extension_install_single_callz)Environment.extension_install_single_call�sM���8�8�:�:�y�)������'�'�'�)�'�d�l�l�n�n�M�M�M���!�Q��r"c� �td����Nz!It's not used for nodejs selector��NotImplementedError�rr\s  r �extension_updatezEnvironment.extension_update����!�"E�F�F�Fr"c� �td���rgrhrjs  r �extension_uninstallzEnvironment.extension_uninstall�rlr"c���tj�tj�|�����d��d}t	|���ddg|���|���\}}}|���rtj|��}ni}|�	di��}g}|�
��D]{\}}|�	dd��sd|vsd	|vr�$|d�d
��r|�|d���[|�|�d|d	�����||S)z�
        Retrieves extensions dictionary for this virtual environment
        :return: Extensions list.
            Example:
                [u'xpath@0.0.27', u'https://github.com/visionmedia/express']
        r�listz--json)rCrY�dependencies�missingF�from�versionzgit+�@)
rr�splitrUrr7�strip�json�loads�get�items�
startswithrG)	rrYrd�output�data�
extensions�resultr�infos	         r rzEnvironment.extensions�s\���g�m�m�B�G�M�M�$�(�(�*�*�5�5�a�8�9�9�!�<��'������V�X�(F�SW�S_�S_�Sa�Sa�gj�k�k�k���6�1��<�<�>�>�	��:�f�%�%�D�D��D��X�X�n�b�1�1�
���$�*�*�,�,�		A�		A�J�D�$��x�x�	�5�)�)�
�V�4�-?�-?�9�TX�CX�CX���F�|�&�&�v�.�.�
A��
�
�d�6�l�+�+�+�+��
�
����t�I���?�@�@�@�@��
r"�NNrP)F)rVN)r'r&�__qualname__r!r)r7r?rArKrNrQr:rUr_rerkrnr�r"r r
r
s������
.�
.�
.�
.�0�0�0�
	�	�	���������$�$�$�$�.�.�.�)�)�)�!�!�!�
���
E�E�E�E�.
�
�
�G�G�G�G�G�G�!�!�!�!�!r"r
c��|st}|r7tj�t	j|��j|��Stj�t	jtj����j|��SrP)	rrrrrr6r3rr)rrs  r rr�sd��� ����F��w�|�|�C�L��.�.�5�v�>�>�>��w�|�|�C�L�����5�5�<�f�E�E�Er"c���t||��}	t|��}n#t$rgcYSwxYwg}|D]&}|�t	|||�����'|SrP)rr�OSErrorrGr
)rr�	venv_path�env_list�envs�env_names      r �environmentsr��s����D�&�)�)�I���Y�'�'���������	�	�	�����
�D��9�9�����K��$��7�7�8�8�8�8��Ks�"�1�1c�V��t�fd�t||��D����S)Nc3��K�|]9}t|����������V��:dS�)r=N)rpr?r{��.0r>r=s  �r �	<genexpr>z$environments_dict.<locals>.<genexpr>�sE�����U�U�Q��Q�Y�Y�3�Y�'�'�-�-�/�/�0�0�U�U�U�U�U�Ur"��dictr��r=rrs`  r �environments_dictr��s0����U�U�U�U�,�t�V�:T�:T�U�U�U�U�U�Ur"c�V��t�fd�t||��D����S)Nc3��K�|]9}t|����������V��:dSr�)rprAr{r�s  �r r�z(environments_deepdict.<locals>.<genexpr>�sY�����5�5���Q�]�]�s�]�+�+�1�1�3�3�4�4�5�5�5�5�5�5r"r�r�s`  r �environments_deepdictr��sE����5�5�5�5�%�d�F�3�3�5�5�5�5�5�5r"r�)�
__future__rrrrxrr�clselect.utilsrrr�interpretersr
rrr�dirname�__file__rErDrZ�objectr
rr�r�r�r�r"r �<module>r�sQ��&�%�%�%�%�%�������&�&�&�&�&�&�����	�	�	�	�
�
�
�
�B�B�B�B�B�B�B�B�B�B�%�%�%�%�%�%����w�|�|�B�G�O�O�H�5�5�}�E�E��0��
�
�]�]�]�]�]�&�]�]�]�@F�F�F�F�	�	�	�	�V�V�V�V�5�5�5�5�5�5r"

Hacked By AnonymousFox1.0, Coded By AnonymousFox