ó
ÇvSc           @   sh   d  d l  Z  d  d l m Z d  d l m Z d  d l m Z d e f d „  ƒ  YZ d „  Z d „  Z	 d S(	   iÿÿÿÿN(   t   Command(   t   logger(   t   pkg_resourcest   ShowCommandc           B   s2   e  Z d  Z d Z d Z d Z d „  Z d „  Z RS(   s6   Show information about one or more installed packages.t   shows$   
      %prog [options] <package> ...s*   Show information about installed packages.c         O   s^   t  t |  ƒ j | | Ž  |  j j d d d d d d d t d d	 ƒ|  j j d
 |  j ƒ d  S(   Ns   -fs   --filest   destt   filest   actiont
   store_truet   defaultt   helps7   Show the full list of installed files for each package.i    (   t   superR   t   __init__t   cmd_optst
   add_optiont   Falset   parsert   insert_option_group(   t   selft   argst   kw(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/pip/commands/show.pyR      s    		c         C   s=   | s t  j d ƒ d  S| } t | ƒ } t | | j ƒ d  S(   Ns.   ERROR: Please provide a package name or names.(   R   t   warnt   search_packages_infot   print_resultsR   (   R   t   optionsR   t   queryt   results(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/pip/commands/show.pyt   run   s    (   t   __name__t
   __module__t   __doc__t   namet   usaget   summaryR   R   (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/pip/commands/show.pyR      s   	c   	      c   sû   t  g  t j D] } | j j ƒ  | f ^ q ƒ } xÃ |  D]» } | j ƒ  } | | k r8 | | } i | j d 6| j d 6| j d 6g  | j ƒ  D] } | j ^ qŽ d 6} t j	 j
 | j | j ƒ  d d ƒ } t j	 j | ƒ rë | | d <n  | Vq8 q8 Wd S(	   sî   
    Gather details from installed distributions. Print distribution name,
    version, location, and installed files. Installed files requires a
    pip generated 'installed-files.txt' in the distributions '.egg-info'
    directory.
    R   t   versiont   locationt   requiress	   .egg-infos   installed-files.txtR   N(   t   dictR   t   working_sett   project_namet   lowerR"   R#   R$   t   ost   patht   joint   egg_namet   isfile(	   R   t   pt   installed_packagesR   t   normalized_namet   distt   dept   packaget   filelist(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/pip/commands/show.pyR   $   s$    .



&		c         C   sã   xÜ |  D]Ô } t  j d ƒ t  j d | d ƒ t  j d | d ƒ t  j d | d ƒ t  j d d	 j | d
 ƒ ƒ | r t  j d ƒ d | k rË x? t | d ƒ D] } t  j d | j ƒ  ƒ q§ WqÛ t  j d ƒ q q Wd S(   sD   
    Print the informations from installed distributions found.
    s   ---s   Name: %sR   s   Version: %sR"   s   Location: %sR#   s   Requires: %ss   , R$   s   Files:R   s     %ss!   Cannot locate installed-files.txtN(   R   t   notifyR+   t   opent   strip(   t   distributionst   list_all_filesR1   t   line(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/pip/commands/show.pyR   @   s    (
   R)   t   pip.basecommandR    t   pip.logR   t   pip._vendorR   R   R   R   (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/pip/commands/show.pyt   <module>   s   	