Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/clwizard/modules/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clwizard/modules/__pycache__/python.cpython-311.pyc

�

���f?���ddlZddlmZddlmZmZmZddlmZddl	m
Z
mZddlm
Z
mZddlmZdd	lmZGd
�de��ZdS)�N)�Feature)�ExternalProgramFailed�get_passenger_package_name�is_litespeed_running)�
get_ui_config)�CL_SELECTOR_BIN�MODULES_LOGS_DIR)�InstallationFailedException�PackageMissingError)�installed_interpreters_list�)�WizardInstallerc��eZdZej�ed��Zej	Z
d�Zd�Ze
d���Zd�Zd�Zd�Zd�Zed	���Zd
S)�PythonInstallerz
python.logc�$�g}|D]0}d|�dd��z}|�|���1|j�dd�|����	|j|�dS#t$r}t��|�d}~wwxYw)zd
        Install given python versions
        :param versions: versions of python packages
        z
alt-python�.�z/Try to install Python package with versions: %s�,N)�replace�append�
app_logger�info�join�_install_groupsrr
)�self�versions�groups�v�package_name�es      �N/opt/cloudlinux/venv/lib64/python3.11/site-packages/clwizard/modules/python.py�_install_python_versionsz(PythonInstaller._install_python_versionss���
���	(�	(�A�'�!�)�)�C��*<�*<�<�L��M�M�,�'�'�'�'�����N�PS�PX�PX�Ya�Pb�Pb�c�c�c�	7� �D� �&�)�)�)�)��$�	7�	7�	7�-�/�/�Q�6�����	7���s�%
A1�1
B�;B
�
Bc��d}tj�|��sdS	|�d|g��dS#t$r}t��|�d}~wwxYw)a
        In order to make python apps work on Litespeed server
        we need to do run extra script
        see docs for details:
        https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cloudlinux:enable_passenger
        :return:
        z9/usr/local/lsws/admin/misc/enable_ruby_python_selector.shN�sh)�os�path�isfile�_run_commandrr
)r�litespeed_scriptr s   r!�_configure_for_litespeed_serverz/PythonInstaller._configure_for_litespeed_server's{��W���w�~�~�.�/�/�	��F�	7����t�%5�6�7�7�7�7�7��$�	7�	7�	7�-�/�/�Q�6�����	7���s�>�
A�A�Ac�l�	ddlm}n"#t$r}td��|�d}~wwxYw|d��S)Nr)�get_default_version�
lvemanager�python)�clselect.clselectctlr,�ImportErrorr)r,r s  r!�_get_python_default_versionz+PythonInstaller._get_python_default_version9s\��	;�@�@�@�@�@�@�@���	;�	;�	;�%�l�3�3��:�����	;����"�"�8�,�,�,s�	�
(�#�(c	���|j�d|��	|�tdddd|dg��dS#t$r}t��|�d}~wwxYw)Nz,trying to set default python version as '%s'�setz
--interpreterr.z--default-version�--json)rrr(rrr
)r�versionr s   r!�_set_python_default_versionz+PythonInstaller._set_python_default_versionBs�������K�W�U�U�U�
	7����#��#��'����

�

�

�

�

��%�	7�	7�	7�-�/�/�Q�6�����	7���s�!A�
A�
A�Ac���|�t����oDt��p5t���di���d��S)a�
        Check that python selector is ready to work
        All configurations were done:
        - passenger package is installed
        We always have python27 installed,
        so we do not need to check if at least one interpreter is installed
        If the config file does not exist, we ignore the uiSettings
        :return: already_configured status
        :rtype: bool
        �
uiSettings�
hidePythonApp)�_is_package_installedrr�get)rs r!�_is_already_configuredz&PythonInstaller._is_already_configuredTs[���)�)�*D�*F�*F�G�G�
�����a�}���':�':�<��'L�'L�'P�'P�Q`�'a�'a�#a�	
�c���g}td��}|D]#}|jr|�|j���$|���||�d��|���d�d�S)Nr.)�installed_versions�available_versions�default_version)�already_configured�options)r�	installedrr5r<�_get_available_versionsr1)r�installed_python_versions�interpreters_list�interpreters    r!�initial_statuszPythonInstaller.initial_statuscs���$&�!�7��A�A��,�	F�	F�K��$�
F�)�0�0��1D�E�E�E��"&�"=�"=�"?�"?�&?�&*�&B�&B�8�&L�&L�#'�#C�#C�#E�#E���
�
�	
r=c��|�dg��}|�d��}|r-||vr)|j�d|��t���|���|�|��t
��r|���	|�gd���n!#t$r}t��|�d}~wwxYw|r|�
|��dSdS)NrrAzSVersion %s that specified to be set as default must be included in install_versions)zcloudlinux-configr3r4z<--data={"options": {"uiSettings": {"hidePythonApp": false}}})r;r�errorr
�_install_passengerr"rr*r(rr6)rrC�install_versionsrAr s     r!�run_installationz PythonInstaller.run_installationrs@��"�;�;�z�2�6�6��!�+�+�&7�8�8���	0��6F�F�F��O�!�!�7��
�
�
�
.�/�/�/����!�!�!��%�%�&6�7�7�7��!�!�	3��0�0�2�2�2�
	7�������
�
�
�
��%�	7�	7�	7�-�/�/�Q�6�����	7�����	>��,�,�_�=�=�=�=�=�	>�	>s�'B?�?
C�	C�Cc�
�ddhS)NrrA�)�clss r!�supported_optionsz!PythonInstaller.supported_options�s���-�.�.r=N)�__name__�
__module__�__qualname__r%r&rr	�LOG_FILEr�PYTHON_SELECTOR�_REQUIRED_CL_COMPONENT_SUPPORTr"r*�staticmethodr1r6r<rIrN�classmethodrRrPr=r!rrs��������w�|�|�,�l�;�;�H�%,�%<�"�
7�
7�
7�7�7�7�$�-�-��\�-�7�7�7�$

�

�

�

�

�

�>�>�>�B�/�/��[�/�/�/r=r)r%�clcommon.constr�clcommon.utilsrrr�clconfig.ui_config_libr�clwizard.constantsrr	�clwizard.exceptionsr
r�clwizard.utilsr�baserrrPr=r!�<module>rbs���
�	�	�	�"�"�"�"�"�"�b�b�b�b�b�b�b�b�b�b�0�0�0�0�0�0�@�@�@�@�@�@�@�@�P�P�P�P�P�P�P�P�6�6�6�6�6�6�!�!�!�!�!�!�A/�A/�A/�A/�A/�o�A/�A/�A/�A/�A/r=

Hacked By AnonymousFox1.0, Coded By AnonymousFox