ó
È”Mc           @   sÃ   d  d l  m Z m Z m Z d  d l  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 d  d l Z e d ƒ Z e d ƒ Z e d	 ƒ Z d
 „  Z d „  Z d „  Z d S(   iÿÿÿÿ(   t   Transactiont   PolicyInstallt   sortUpgrades(   t   INSTALLt	   REINSTALL(   t   OptionParser(   t   Package(   t   *Ns#   smart install [options] package ...s¤   
This command will install one or more packages in the
system. If a new version of an already installed package
is available, it will be selected for installation.
sÞ   
smart install pkgname
smart install '*kgna*'
smart install pkgname-1.0
smart install pkgname-1.0-1
smart install pkgname1 pkgname2
smart install ./somepackage.file
smart install http://some.url/some/path/somepackage.file
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 ƒ ƒ|  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   --dumpsD   dump package names and versions to stderr but don't commit operation(   R   t   USAGEt   DESCRIPTIONt   EXAMPLESt
   add_optiont   _(   t   parser(    (    s:   /usr/lib/python2.7/dist-packages/smart/commands/install.pyt   option_parser1   s$    	c         C   s+   t  ƒ  } | j |  ƒ \ } } | | _ | S(   N(   R   t
   parse_argst   args(   t   argvR   t   optsR   (    (    s:   /usr/lib/python2.7/dist-packages/smart/commands/install.pyt   parse_optionsG   s    		c         C   sS  | j  r" t j d t d t ƒn  g  } x{ | j D]o } t j j | ƒ rW d | k sf |  j | ƒ r† |  j	 | ƒ | j j
 | ƒ q3 d | k r3 | j | ƒ q3 q3 W| rY|  j | t d ƒ d t j ƒ  ƒ\ } } | rt t d ƒ d j g  | D] } d	 | | | f ^ qõ ƒ ‚ n  x: | j ƒ  D]) \ } } |  j	 | ƒ | j j
 | ƒ q)Wn  t j d
 ƒ ršd d l m } | j g  ƒ }	 | j |  |	 ƒ n
 |  j ƒ  |  j ƒ  }
 t |
 t ƒ } xq |  j ƒ  D]c } xZ | j ƒ  D]L } xC | j ƒ  D]5 } | j rt t d ƒ | ‚ n  | j | t  ƒ qòWqßWqÌWx=| j D]2} |  j! | ƒ \ } } } | s| rþi  } xL | D]D \ } } t" | t# ƒ rœt | | <qt| j t$ j% | j& t ƒ ƒ qtWt 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| sËt( } i  } xp | D]h } x^ | j& D]P } | j r©t) j* t d ƒ | | f ƒ t } Pqs| j | ƒ t | | j+ <qsWqcPqcW| rÛq=n  t, | ƒ d k rtt j d ƒ rtd d l- m. } | | d j/ ƒ d | | d j/ ƒ d k rtt0 | d | d ƒ } | j1 | j+ ƒ | j
 | ƒ qtn  t, | ƒ d k rËt t d ƒ | d j g  | D] } d t' | ƒ ^ q¢ƒ f ‚ qËn  t, | ƒ d k rêt2 | ƒ n  i  } x* | D]" } | j3 | j+ g  ƒ j | ƒ q÷WxO | D]G } | | d } | j r[t) j* t d ƒ | ƒ q$| j | t  ƒ q$Wq=Wt) j4 t d ƒ ƒ | j5 ƒ  t) j6 ƒ  | rO| j7 } | j8 rÃ|  j9 | ƒ qO| j: rÜ|  j; | ƒ qO| j< rû|  j= | d t ƒqO| j> r|  j? | d | ƒqO| j@ r9|  jA | d | ƒqO|  jB | d | ƒn  d  S(   Ns   explain-changesetst   softt   /s   :/t   packagest	   targetdirs   Failed to download packages:
s   
s
       %s: %ss   auto-updateiÿÿÿÿ(   t   updates   %s is already installeds)   '%s' matches no packages. Suggestions:
%ss       s   '%s' matches no packagess    %s (for %s) is already installedi   s   rpm-strict-multilib(   t	   splitarchi    i   s'   There are multiple matches for '%s':
%ss   Computing transaction...t   installt   confirm(C   t   explaint   sysconft   sett   TrueR   t   ost   patht   isfilet   checkPackageFilet   addFileChannelt   removet   appendt   downloadURLsR   t   getcwdt   Errort   joint   itemst   gett   smart.commandsR   R   t   maint   reloadChannelst   getCacheR    R   t   getFileChannelst
   getLoaderst   getPackagest	   installedt   enqueueR   t   searcht
   isinstanceR   t   dictt   fromkeysR   t   strt   Falset   ifacet   warningt   namet   lent   smart.backends.rpm.rpmverR   t   versiont   maxt   popR   t
   setdefaultt
   showStatust   runt
   hideStatust   yest   urlst   dumpTransactionURLst   metalinkt   dumpTransactionMetalinkt   dumpt   dumpTransactionPackagest   downloadt   downloadTransactiont   steppedt   commitTransactionSteppedt   commitTransaction(   t   ctrlR   RO   t   argt   succt   failt   urlt   fileR   t
   updateoptst   cachet   transt   channelt   loadert   pkgt   ratiot   resultst   suggestionst   dctt   rt   objt   xt   pkgsR:   t   namesR   RD   R!   (    (    s:   /usr/lib/python2.7/dist-packages/smart/commands/install.pyR4   M   sÈ    		+
	 6	!.9 	


					(   t   smart.transactionR    R   R   R   R   t   smart.optionR   t   smart.cacheR   t   smartt   stringt   reR&   R   R   R   R   R   R   R4   (    (    (    s:   /usr/lib/python2.7/dist-packages/smart/commands/install.pyt   <module>   s   
				