%PDF- %PDF-
| Direktori : /opt/alt/python37/lib/python3.7/site-packages/clconfigure/__pycache__/ |
| Current File : //opt/alt/python37/lib/python3.7/site-packages/clconfigure/__pycache__/packages.cpython-37.pyc |
B
�2Lb � @ sd d dl mZ d dlZd dlZd dlZd dlmZmZ dZdZ dZ
ed�dd � �Zd
d� Zdd
� Z
dS )� )�absolute_importN)�task�runZuninstalledZ installedzis not installedz<Changing package '{package_name}' state to '{desired_state}'c C s� t |�}t�d||� | |kr.t�d|� dS t�d� | tkrFd}n| tkrTd}nt� �td|d|g� t |�}t�d ||� | |kr�td
��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...�removeZinstallZyumz-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)Z
desired_stateZpackage_nameZ
current_state�action� r �E/opt/alt/python37/lib/python3.7/site-packages/clconfigure/packages.py�set_package_state s
r c C s: t dd| g�}t|jkrtS |jdkr*tS td| ��dS )zJ
Gets current package state.
Either installed or uninstalled.
Zrpmz-qr zUnknown package %s statusN)r �_PACKAGE_NOT_INSTALLED�stdoutr
Zexitcoder r
)�packageZrespr r r r . s
r c C s dd� t �d�D �S )zN
Gets installed alt-phps
return: list ['php44', 'php54', 'php80']
c S s g | ]}t �d |�r|�qS )z^php\d+$)�re�match)�.0Zphpr r r �
<listcomp>@ s z/get_list_installed_alt_phps.<locals>.<listcomp>z/opt/alt)�os�listdirr r r r �get_list_installed_alt_phps; s r )Z
__future__r r r r Zclconfigurer r r
r r r r r r r r r �<module> s