ó
È”Mc           @   sŒ   d  d l  m Z d  d l m Z d  d l m Z d  d l Td  d l Z e d ƒ Z	 e d ƒ Z
 e d ƒ Z d	 „  Z d
 „  Z e d „ Z d S(   iÿÿÿÿ(   t	   sizeToStr(   t   OptionParser(   t   Package(   t   *Ns"   smart info [options] [package] ...s>   
This command will show information about the given packages.
sM   
smart info pkgname
smart info pkgname-1.0
smart info pkgname --urls --paths
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 ƒ ƒ|  S(   Nt   usaget   descriptiont   exampless   --urlst   actiont
   store_truet   helps	   show URLss   --pathss   show path lists   --changelogs   show change log(   R   t   USAGEt   DESCRIPTIONt   EXAMPLESt
   add_optiont   _(   t   parser(    (    s7   /usr/lib/python2.7/dist-packages/smart/commands/info.pyt   option_parser)   s    	c         C   s+   t  ƒ  } | j |  ƒ \ } } | | _ | S(   N(   R   t
   parse_argst   args(   t   argvR   t   optsR   (    (    s7   /usr/lib/python2.7/dist-packages/smart/commands/info.pyt   parse_options5   s    		c   #   
   C   s$  t  j d ƒ rA d d l m } | j g  ƒ } | j |  | ƒ n | rT |  j ƒ  n  |  j ƒ  } | j rÅi  } xD| j D]9} |  j	 | d t
 ƒ\ } }	 }
 |	 sV|
 r@i  } xL |
 D]D \ } } t | t ƒ rÞ t | | <q¶ | j t j | j t ƒ ƒ q¶ Wt t d ƒ | d j g  | D] } d t | ƒ ^ qƒ f ‚ qVt t d ƒ | ‚ n  i  } xF |	 D]> } t | t ƒ r…t | | <qc| j t j | j t ƒ ƒ qcW| j | ƒ qy W| j ƒ  } n | j ƒ  } xL| D]D} i  } g  } x | j D]t } | j ƒ  } | j | ƒ } | j | ƒ | j ƒ  } | j t | ƒ i  ƒ } | rô| j d	 g  ƒ j | ƒ qôqôW| j ƒ  | d
 } t d ƒ G| j GHt d ƒ G| j  GHt d ƒ G| j! ƒ  GHt d ƒ G| j" ƒ  GHt d ƒ G| j# ƒ  GHt d ƒ G| j$ ƒ  GHt d ƒ Gt% | j& ƒ  ƒ GHt d ƒ Gd j | j' ƒ  ƒ GHt( j) | ƒ } | rf| j ƒ  d d j | ƒ } n d } t d ƒ G| GHt d ƒ G| j ƒ  } | j ƒ  d j | ƒ GHt d ƒ G| j* ƒ  GHt d ƒ GHx> | j+ ƒ  j, ƒ  D]* } | j- ƒ  } | sýd } n  d G| GHqÜW| j. rÖt d ƒ GHi  } x¯ | j D]¡ } | | k r.t | | <| j | ƒ } t } xm | j ƒ  D]\ } | rd G| j ƒ  GHt
 } n  | j/ | ƒ } | r¿d G| Gd t% | ƒ GHqld G| GHqlWq.q.Wn  | j0 sè| j1 rx3 | j D]% } | j2 ƒ  rò| j | ƒ } PqòqòWn  | j0 ret d  ƒ GH| j3 ƒ  } | j ƒ  x | D] } d G| GHqOWn  | j1 rt d! ƒ GH| j4 ƒ  }  x“ t5 t6 |  ƒ d" ƒ D]x }! d# Gd |  d" |! GH|  d" |! d$ j7 d ƒ }" d# Gd |" d
 GHx. t5 d$ t6 |" ƒ ƒ D] }! d% Gd |" |! GHqùWqœWn  HqØWd  S(&   Ns   auto-updateiÿÿÿÿ(   t   updatet   addprovidess)   '%s' matches no packages. Suggestions:
%ss   
s       s   '%s' matches no packagest   urlsi    s   Name:s   Version:s	   Priority:s   Source:s   Group:s   License:s   Installed Size:s   Reference URLs:t    s   %ss   , t    s   Flags:s	   Channels:s   ; s   Summary:s   Description:t   .s   URLs:s      s   (%s)s   Paths:s
   Changelog:i   s          i   s	            (8   t   sysconft   gett   smart.commandsR   R   t   maint   reloadChannelst   getCacheR   t   searcht   Falset
   isinstanceR   t   Truet   dictt   fromkeyst   packagest   ErrorR   t   joint   strt   keyst   getPackagest   loaderst
   getChannelt   getInfot   appendt   getURLst
   setdefaultt   extendt   sortt   namet   versiont   getPriorityt	   getSourcet   getGroupt
   getLicenseR    t   getInstalledSizet   getReferenceURLst   pkgconft   testAllFlagst
   getSummaryt   getDescriptiont
   splitlinest   stripR   t   getSizet   pathst	   changelogt   getInstalledt   getPathListt   getChangeLogt   ranget   lent   split(#   t   ctrlR   t   reloadchannelsR   t
   updateoptst   cachet   pkgst   argt   ratiot   resultst   suggestionst   dctt   rt   objt   xt   pkgt   channelst   infost   loadert   channelt   infoR   t   mapt   flagst   channelnamest   linet   seent   firstt   urlt   sizeRE   t   entryRF   t   it   changesplit(    (    s7   /usr/lib/python2.7/dist-packages/smart/commands/info.pyR   ;   sÐ    	 6  




		
		
	(   t   smart.util.strtoolsR    t   smart.optionR   t   smart.cacheR   t   smartt   reR   R
   R   R   R   R   R%   R   (    (    (    s7   /usr/lib/python2.7/dist-packages/smart/commands/info.pyt   <module>   s   
				