%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/python.cpython-37.pyc

B

�2LbQ�@s�ddlmZddlZddlmZmZddlmZddlm	Z	m
Z
ddlmZm
Z
mZddlmZdd	lmZdd
lmZGdd�de�ZdS)
�)�absolute_importN)�InstallationFailedException�PackageMissingError�)�WizardInstaller)�MODULES_LOGS_DIR�CL_SELECTOR_BIN)�ExternalProgramFailed�is_litespeed_running�get_passenger_package_name)�installed_interpreters_list)�
get_ui_config)�FeaturecsxeZdZej�ed�Zej	Z
�fdd�Zdd�Zdd�Z
edd	��Zd
d�Zdd
�Zdd�Zdd�Zedd��Z�ZS)�PythonInstallerz
python.logcstt|���dS)N)�superr�__init__)�self)�	__class__��H/opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/python.pyr szPythonInstaller.__init__cCsng}x&|D]}d|�dd�}|�|�q
W|j�dd�|��y|j|�Wntk
rht��YnXdS)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�joinZ_install_yum_groupsr	r)r�versions�groups�vZpackage_namerrr�_install_python_versions#s
z(PythonInstaller._install_python_versionscCsFd}tj�|�sdSy|�d|g�Wntk
r@t��YnXdS)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.shNZsh)�os�path�isfile�_run_commandr	r)rZlitespeed_scriptrrr�_configure_for_litespeed_server2sz/PythonInstaller._configure_for_litespeed_servercCs6yddlm}Wntk
r,td��YnX|d�S)Nr)�get_default_versionZ
lvemanager�python)Zclselect.clselectctlr'�ImportErrorr)r'rrr�_get_python_default_versionDs
z+PythonInstaller._get_python_default_versionc	CsJ|j�d|�y|�tdddd|dg�Wntk
rDt��YnXdS)Nz,trying to set default python version as '%s'�setz
--interpreterr(z--default-versionz--json)rrr%rr	r)r�versionrrr�_set_python_default_versionMsz+PythonInstaller._set_python_default_versioncCs*|�t��o(t�p(t��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
        Z
uiSettingsZ
hidePythonApp)Z_is_package_installedrr
�get)rrrr�_is_already_configuredWsz&PythonInstaller._is_already_configuredcCsLg}td�}x|D]}|jr|�|j�qW|��||�d�|��d�d�S)Nr()Zinstalled_versionsZavailable_versions�default_version)Zalready_configured�options)rZ	installedrr,r/Z_get_available_versionsr*)rZinstalled_python_versionsZinterpreters_listZinterpreterrrr�initial_statusfs
zPythonInstaller.initial_statuscCs�|�dg�}|�d�}|r6||kr6|j�d|�t��|��|�|�t�rV|��y|�ddddg�Wnt	k
r�t��YnX|r�|�
|�dS)Nrr0zSVersion %s that specified to be set as default must be included in install_versionszcloudlinux-configr+z--jsonz<--data={"options": {"uiSettings": {"hidePythonApp": false}}})r.r�errorrZ_install_passengerr!r
r&r%r	r-)rr1Zinstall_versionsr0rrr�run_installationus$


z PythonInstaller.run_installationcCsddhS)Nrr0r)�clsrrr�supported_options�sz!PythonInstaller.supported_options)�__name__�
__module__�__qualname__r"r#rrZLOG_FILErZPYTHON_SELECTORZ_REQUIRED_CL_COMPONENT_SUPPORTrr!r&�staticmethodr*r-r/r2r4�classmethodr6�
__classcell__rr)rrrs	
r)Z
__future__rr"Zclwizard.exceptionsrr�baserZclwizard.constantsrrZclcommon.utilsr	r
rZclwizard.utilsrZclconfig.ui_config_libr
Zclcommon.constrrrrrr�<module>	s

Zerion Mini Shell 1.0