a
    ˆ�Áj¨
  ã                   @   sl   d dl mZ d dl mZ d dlmZ d dlmZ d dlmZ d dl	Z
d dlZe d¡ZG dd	„ d	ejƒZdS )
é    )Úabsolute_import)Úunicode_literals)Ú_)Úcommands)ÚCleanCommandLockNÚdnfc                   @   sL   e Zd ZdZdZedƒjejj	d�Z
edd„ ƒZdd„ Zd	d
„ Zdd„ ZdS )ÚSwapCommandzNA class containing methods needed by the cli to execute the swap command.
    )Zswapz=run an interactive {prog} mod for remove and install one spec)Úprogc                 C   s,   | j ddtdƒd� | j ddtdƒd� d S )NÚremove_specZstorezThe specs that will be removed)ÚactionÚhelpÚinstall_specz The specs that will be installed)Úadd_argumentr   )Úparser© r   ú9/usr/lib/python3.9/site-packages/dnf/cli/commands/swap.pyÚset_argparser'   s    
ÿzSwapCommand.set_argparserc                 C   sP   | j j}d|_d|_d|_d|_tj|_t	 
| j| j ¡ t	 | j| jjg¡ d S )NT)ÚcliÚdemandsZsack_activationZavailable_reposZ	resolvingZ	root_userr   ZREADZclean_command_lockr   Z_checkGPGKeyÚbaseZ_checkEnabledRepoÚoptsr   )Úselfr   r   r   r   Ú	configure-   s    zSwapCommand.configurec                 C   s@   | j j |¡}|d ur<|| j ƒ}| j j |||g¡ | ¡  d S )N)r   Zcli_commandsÚgetZ	optparserZparse_command_argsÚrun)r   Zcmd_strÚspecZcmd_clsÚcmdr   r   r   Ú_perform7   s
    
zSwapCommand._performc                 C   s$   |   d| jj¡ |   d| jj¡ d S )NZinstallÚremove)r   r   r   r
   )r   r   r   r   r   >   s    zSwapCommand.runN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úaliasesr   Úformatr   ÚutilZMAIN_PROG_UPPERZsummaryÚstaticmethodr   r   r   r   r   r   r   r   r      s   ÿ

r   )Z
__future__r   r   Zdnf.i18nr   Zdnf.clir   Zdnf.cli.demandr   Zdnf.utilr   ZloggingZ	getLoggerZloggerZCommandr   r   r   r   r   Ú<module>   s   
