ó
È”Mc           @   s¡   d  d l  m Z m Z m Z d  d l m Z d  d l m Z d  d l Td  d l	 Z	 d  d l
 Z
 e d ƒ Z e d ƒ Z e d ƒ Z d	 „  Z d
 „  Z d „  Z d S(   iÿÿÿÿ(   t   Transactiont   PolicyRemovet   REMOVE(   t   OptionParser(   t   Package(   t   *Ns"   smart remove [options] package ...s\   
This command will remove one or more packages which
are currently installed in the system.
s€   
smart remove pkgname
smart remove '*kgnam*'
smart remove pkgname-1.0
smart remove pkgname-1.0-1
smart remove pkgname1 pkgname2
c          C   s  t  d t d t d t ƒ }  |  j d d d d t d ƒ ƒ|  j d	 d d d t d
 ƒ ƒ|  j d d d d t d ƒ ƒ|  j d d d d t d ƒ ƒ|  j d d d d t d ƒ ƒ|  j d d d d d t d ƒ ƒ|  j d d d d t d ƒ ƒ|  j d d d d t d ƒ ƒ|  S(   Nt   usaget   descriptiont   exampless	   --steppedt   actiont
   store_truet   helps   split operation in stepss   --urlss+   dump needed urls and don't commit operations
   --metalinks,   dump metalink xml and don't commit operations
   --downloads,   download packages and don't commit operations	   --explains:   include additional information about changes,when possibles   -ys   --yess   do not ask for confirmations   --autos1   use the auto-install information to remove stuff.s   --dumpsD   dump package names and versions to stderr but don't commit operation(   R   t   USAGEt   DESCRIPTIONt   EXAMPLESt
   add_optiont   _(   t   parser(    (    s9   /usr/lib/python2.7/dist-packages/smart/commands/remove.pyt   option_parser,   s(    	c         C   s+   t  ƒ  } | j |  ƒ \ } } | | _ | S(   N(   R   t
   parse_argst   args(   t   argvR   t   optsR   (    (    s9   /usr/lib/python2.7/dist-packages/smart/commands/remove.pyt   parse_optionsE   s    		c      
   C   s˜  | j  r" t j d t d t ƒn  t j d ƒ rc d d l m } | j g  ƒ } | j |  | ƒ n
 |  j	 ƒ  |  j
 ƒ  } t | t ƒ } | j ƒ  } | j rÉ |  j ƒ  } | j } |  j | d | ƒn  xì| j D]á}	 |  j |	 ƒ \ }
 } } | sÚ| r|i  } xf | D]^ \ } } t | t ƒ r>| j rht | | <qhq
x' | j D] } | j rHt | | <qHqHWq
W| s|| 2q|n  | rÄt t d ƒ |	 d j g  | D] } d	 t | ƒ ^ qžƒ f ‚ qÚt t d
 ƒ |	 ‚ n  g  } x- | D]% } t | t ƒ rç| j | ƒ qçqçW| sKx2 | D]' } x | j D] } | j | ƒ q-WqWn  t } x@ | D]8 } | j r€t } | j | t ƒ qX| j  | t ƒ qXW| sÓ t! j" t d ƒ |	 ƒ qÓ qÓ Wt! j# t d ƒ ƒ | j$ ƒ  t! j% ƒ  | r”| j } | j& r|  j' | ƒ q”| j( r!|  j) | ƒ q”| j* r@|  j+ | d t ƒq”| j, r_|  j- | d | ƒq”| j. r~|  j/ | d | ƒq”|  j0 | d | ƒn  d  S(   Ns   explain-changesetst   softs   auto-updateiÿÿÿÿ(   t   updatet   confirms)   '%s' matches no packages. Suggestions:
%ss   
s       s   '%s' matches no packagess"   '%s' matches no installed packagess   Computing transaction...t   remove(1   t   explaint   sysconft   sett   Truet   gett   smart.commandsR   R   t   maint   reloadChannelst   getCacheR    R   t	   getPolicyt   autot   markAndSweept   yest   commitChangeSetR   t   searcht
   isinstanceR   t	   installedt   packagest   ErrorR   t   joint   strt   appendt   Falset   enqueueR   t	   setLockedt   ifacet   warningt
   showStatust   runt
   hideStatust   urlst   dumpTransactionURLst   metalinkt   dumpTransactionMetalinkt   dumpt   dumpTransactionPackagest   downloadt   downloadTransactiont   steppedt   commitTransactionSteppedt   commitTransaction(   t   ctrlR   R   t
   updateoptst   cachet   transt   policyt   rmcsR   t   argt   ratiot   resultst   suggestionst   dctt   rt   objt   pkgt   xt   pkgst   found(    (    s9   /usr/lib/python2.7/dist-packages/smart/commands/remove.pyR"   K   s€    	
	
		
6	


					(   t   smart.transactionR    R   R   t   smart.optionR   t   smart.cacheR   t   smartt   stringt   reR   R   R   R   R   R   R"   (    (    (    s9   /usr/lib/python2.7/dist-packages/smart/commands/remove.pyt   <module>   s   
				