Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clconfigure/__pycache__/packages.cpython-311.pyc
�

��oe��z�ddlmZddlZddlZddlZddlmZmZdZdZ	dZ
ed��d���Zd	�Zd
�Z
dS)�)�absolute_importN)�task�run�uninstalled�	installedzis not installedz<Changing package '{package_name}' state to '{desired_state}'c��t|��}tjd||��||krtjd|��dStjd��|tkrd}n|t
krd}nt
���td|d|g��t|��}tjd	||��||krtd
���dS)z�
    Brings package to given state (installed | uninstalled). May be executed more that once,
    does't crash on future calls
    z7Checking package '%s' state... package is in state '%s'z"No actions needed for package '%s'Nz(State does not match target, changing...�remove�install�yumz-yzAChecking package '%s' state again... package is now in state '%s'zFailed to do required actions)	�_get_package_state�logging�debug�info�
STATE_REMOVED�STATE_INSTALLED�NotImplementedErrorr�RuntimeError)�
desired_state�package_name�
current_state�actions    �py/clconfigure/packages.py�set_package_staters���'�|�4�4�M��M�K�\�[h�i�i�i��
�%�%��
�:�L�I�I�I����L�;�<�<�<��
�%�%����	�/�	)�	)����!�#�#�#�����l�+�,�,�,�&�|�4�4�M��L�T�Vb�dq�r�r�r��
�%�%��:�;�;�;�&�%�c��tdd|g��}t|jvrtS|jdkrt
St
d|z���)zJ
    Gets current package state.
    Either installed or uninstalled.
    �rpmz-qrzUnknown package %s status)r�_PACKAGE_NOT_INSTALLED�stdoutr�exitcoderr)�package�resps  rrr.sR��
��t�W�%�&�&�D����,�,���	
��!�	�	���
�2�W�<�
=�
=�=rc�>�d�tjd��D��S)zN
    Gets installed alt-phps
    return: list ['php44', 'php54', 'php80']
    c�<�g|]}tjd|���|��S)z^php\d+$)�re�match)�.0�phps  r�
<listcomp>z/get_list_installed_alt_phps.<locals>.<listcomp>@s)��P�P�P�C�R�X�k�3�5O�5O�P�C�P�P�Prz/opt/alt)�os�listdir�rr�get_list_installed_alt_phpsr,;s#��
Q�P�2�:�j�1�1�P�P�P�Pr)�
__future__rr
r)r$�clconfigurerrrrrrrr,r+rr�<module>r/s���'�&�&�&�&�&�����	�	�	�	�	�	�	�	�!�!�!�!�!�!�!�!��
���+����D�E�E�<�<�F�E�<�6
>�
>�
>�Q�Q�Q�Q�Qr