관리-도구
편집 파일: remove.cpython-36.pyc
3 �ft`� � @ s� d dl mZ d dl mZ d dlmZ d dlmZ d dlmZ d dl Z d dlZd dlZd dl Z d dlZejd�ZG dd � d ej�ZdS ) � )�absolute_import)�unicode_literals)�commands)�_)�OptionParserN�dnfc @ sb e Zd ZdZejejejejejejd�Zde ej � � Zed�Z edd� �Zd d � Zdd� Zd S )� RemoveCommandzRemove command.)zremove-nz remove-nazremove-nevrazerase-nzerase-nazerase-nevra�remove�erase�rmz-remove a package or packages from your systemc C sf | j � }|jdddtd�d� |jddtjd� |jddtd �d� | jd dtd�tjtd �d� d S )Nz--duplicates� store_true� duplicatedzremove duplicated packages)�action�dest�helpz--duplicated)r r z--oldinstallonlyz*remove installonly packages over the limitZpackages�*zPackage to removeZPACKAGE)�nargsr r �metavar)Zadd_mutually_exclusive_group�add_argumentr �argparseZSUPPRESSr ZParseSpecGroupFileCallback)�parserZmgroup� r �/usr/lib/python3.6/remove.py� set_argparser0 s zRemoveCommand.set_argparserc C s^ | j j}d|_d|_d|_| jjr*d|_n0tj j rN| jjrNd|_d|_d|_ nd|_ d|_d S )NTF)Zcli�demandsZ resolvingZ root_userZsack_activation�optsr Zavailable_reposr �base�WITH_MODULES� grp_specsZfresh_metadataZ allow_erasing)�selfr r r r � configure? s zRemoveCommand.configurec C s\ g }| j j| jkr"| j| j j g}| j j| j j7 _d}| j j�rD| jjj� }| jj |j � �}|j� j|�}|s�tj jtd���x�|j� j� D ]�\\}}}t|�dk r�q�|jdd� y| jjt|d �� W nH tj jk �r d} td�} tj| | jjjjt|d ��| � Y nX x"|d d � D ]}| jj|� �q&W q�W d S | j j�r�| jjj� }| jj |j � �jd�}| jjj� }|d k �r�|j |j!|j"|j#d �} | �r�|j| �}|�r�x,|D ]}| jj|� �q�W ntj jtd���d S | j j$�r*|�r*x�| j j$D ]&}td�} tj| | jjjj|�� �q�W n�| j j$�r�tjj%�rxtj&j'j(| j�}|j)| j j$�}t| j j$�t|�k�r�d}n| j j$}|�r�xB|D ]:}y| jj*|g��r�d}W n tj jk �r� Y nX �q�W xx| j jD ]l}y| jj)||d � W nL tj j+k �r8 } z*dj,|j-| jjjj|��} tj.| � W Y d d }~X nX d}�q�W |�sXtjtd�� d S )NFz)No duplicated packages found for removal.� T)�reverser � z%Installed package %s%s not available.� )�epoch�version�releasez.No old installonly packages found for removal.zNot a valid form: %s)�formsz{}: {}zNo packages marked for removal.���)/r Zcommand�nevra_formsZ pkg_specs� filenamesr r ZsackZqueryZ_get_installonly_queryZ installed� differencer � exceptions�Errorr Z_na_dict�items�len�sortZ reinstall�strZPackagesNotAvailableError�loggerZwarning�outputZtermZboldZpackage_removeZoldinstallonlyZlatestZget_running_kernel�filterr% r&