ó
^†êWc           @@  s½   d  d l  m Z d  d l Z d  d l Z d  d l m Z d  d l m Z d  d l m	 Z	 d  d l
 m Z m Z d  d l m Z d  d l m Z m Z e j e ƒ Z d	 e f d
 „  ƒ  YZ d S(   i    (   t   absolute_importN(   t   Command(   t   CommandError(   t   PackageFinder(   t   get_installed_distributionst   dist_is_editable(   t   RemovedInPip10Warning(   t   make_option_groupt   index_groupt   ListCommandc           B@  sq   e  Z d  Z d Z d Z d Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z RS(   st   
    List installed packages, including editables.

    Packages are listed in a case-insensitive sorted order.
    t   lists   
      %prog [options]s   List installed packages.c      
   O@  s-  t  t |  ƒ j | | Ž  |  j } | j d d d d d t d d ƒ| j d d	 d d d t d d
 ƒ| j d d d d d t d d ƒ| j d d d d d t d d ƒ|  j j d d d d d d t d d ƒ| j d d d d t d d ƒt t |  j ƒ } |  j j	 d | ƒ |  j j	 d | ƒ d  S(   Ns   -os
   --outdatedt   actiont
   store_truet   defaultt   helps   List outdated packagess   -us
   --uptodates   List uptodate packagess   -es
   --editables   List editable projects.s   -ls   --localsS   If in a virtualenv that has global access, do not list globally-installed packages.s   --usert   destt   users,   Only output packages installed in user-site.s   --presY   Include pre-release and development versions. By default, pip only finds stable versions.i    (
   t   superR	   t   __init__t   cmd_optst
   add_optiont   FalseR   R   t   parsert   insert_option_group(   t   selft   argst   kwR   t
   index_opts(    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyR      sH    						c         C@  s7   t  d | j d | d | j d | j d | j d | ƒ S(   sK   
        Create a package finder appropriate to this list command.
        t
   find_linkst
   index_urlst   allow_all_prereleasest   trusted_hostst   process_dependency_linkst   session(   R   R   t   preR   R    (   R   t   optionsR   R!   (    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyt   _build_package_finderL   s    				c         C@  s¸   | j  r t j d t ƒ n  | j r8 t j d t ƒ n  | j rT t j d t ƒ n  | j ru | j ru t d ƒ ‚ n  | j rŽ |  j	 | ƒ n& | j r§ |  j
 | ƒ n |  j | ƒ d  S(   Ns   --allow-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.s“   --allow-all-external has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.s‘   --allow-unverified has been deprecated and will be removed in the future. Due to changes in the repository protocol, it no longer has any effect.s5   Options --outdated and --uptodate cannot be combined.(   t   allow_externalt   warningst   warnR   t   allow_all_externalt   allow_unverifiedt   outdatedt   uptodateR   t   run_outdatedt   run_uptodatet   run_listing(   R   R#   R   (    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyt   runY   s(    	
	
	
		c         C@  sg   x` t  |  j | ƒ d d „  ƒD]@ \ } } } | | j k r t j d |  j | ƒ | | ƒ q q Wd  S(   Nt   keyc         S@  s   |  d j  j ƒ  S(   Ni    (   t   project_namet   lower(   t   p(    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyt   <lambda>   s    s   %s - Latest: %s [%s](   t   sortedt   find_packages_latest_versionst   parsed_versiont   loggert   infot   output_package(   R   R#   t   distt   latest_versiont   typ(    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyR,   |   s    c         c@  sª  | j  g | j } | j r> t j d d j | ƒ ƒ g  } n  g  } xT t d | j d | j d | j	 ƒ D]. } | j
 d ƒ ri | j | j d ƒ ƒ qi qi W|  j | ƒ ú } |  j | | | ƒ } | j | ƒ t d | j d | j d | j	 ƒ } xª | D]¢ } d } | j | j ƒ }	 | j sIg  |	 D] }
 |
 j j s(|
 ^ q(}	 n  |	 sUqú n  t |	 d | j ƒ} | j } | j j rˆd	 } n d
 } | | | f Vqú WWd  QXd  S(   Ns   Ignoring indexes: %st   ,t
   local_onlyt	   user_onlyt   editables_onlys   dependency_links.txtt   unknownR0   t   wheelt   sdist(   t	   index_urlt   extra_index_urlst   no_indexR8   R9   t   joinR   t   localR   t   editablet   has_metadatat   extendt   get_metadata_linest   _build_sessionR$   t   add_dependency_linkst   find_all_candidatesR0   R"   t   versiont   is_prereleaset   maxt   _candidate_sort_keyt   locationt   is_wheel(   R   R#   R   t   dependency_linksR;   R!   t   findert   installed_packagesR=   t   all_candidatest	   candidatet   best_candidatet   remote_version(    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyR6   †   sD    											c         C@  s5   t  d | j d | j d | j ƒ } |  j | ƒ d  S(   NR?   R@   RA   (   R   RI   R   RJ   t   output_package_listing(   R   R#   RY   (    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyR.   ²   s
    		c         C@  s>   t  | ƒ r& d | j | j | j f Sd | j | j f Sd  S(   Ns   %s (%s, %s)s   %s (%s)(   R   R1   RQ   RU   (   R   R;   (    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyR:   º   s    c         C@  s@   t  | d d „  ƒ} x$ | D] } t j |  j | ƒ ƒ q Wd  S(   NR0   c         S@  s   |  j  j ƒ  S(   N(   R1   R2   (   R;   (    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyR4   Ç   s    (   R5   R8   R9   R:   (   R   RY   R;   (    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyR^   Ä   s
    c         C@  sY   g  } x? |  j  | ƒ D]. \ } } } | j | k r | j | ƒ q q W|  j | ƒ d  S(   N(   R6   R7   t   appendR^   (   R   R#   R+   R;   RQ   R=   (    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyR-   Ì   s
    (   t   __name__t
   __module__t   __doc__t   namet   usaget   summaryR   R$   R/   R,   R6   R.   R:   R^   R-   (    (    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyR	      s   	/		#	
	,		
	(   t
   __future__R    t   loggingR&   t   pip.basecommandR   t   pip.exceptionsR   t	   pip.indexR   t	   pip.utilsR   R   t   pip.utils.deprecationR   t   pip.cmdoptionsR   R   t	   getLoggerR`   R8   R	   (    (    (    sb   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/commands/list.pyt   <module>   s   