� ��abc@@s,ddlmZddlZddlZddlZyddlmZWn!ek rkddlmZnXddl m Z ddl m Z ddl mZddlmZdd lmZmZdd lmZdd lmZmZeje�Zd e fd ��YZd�Zd�Zd�ZdS(i(tabsolute_importN(t zip_longest(t izip_longest(tsix(tCommand(t CommandError(t PackageFinder(tget_installed_distributionstdist_is_editable(tRemovedInPip10Warning(tmake_option_groupt index_groupt ListCommandcB@s�eZdZdZdZdZd�Zd�Zd�Zd�Z d�Z d �Z d �Z d �Z d �Zd �Zd�ZRS(st List installed packages, including editables. Packages are listed in a case-insensitive sorted order. tlists %prog [options]sList installed packages.c O@sqtt|�j||�|j}|jdddddtdd�|jdd dddtdd �|jd d dddtdd �|jdddddtdd�|jjddddddtdd�|jddddtdd�|jddddddd$dd�|jd dddd!dd"�tt|j�}|jj d#|�|jj d#|�dS(%Ns-os --outdatedtactiont store_truetdefaultthelpsList outdated packagess-us --uptodatesList uptodate packagess-es --editablesList editable projects.s-ls--localsSIf in a virtualenv that has global access, do not list globally-installed packages.s--usertdesttusers,Only output packages installed in user-site.s--presYInclude pre-release and development versions. By default, pip only finds stable versions.s--formattstoret list_formattchoicestlegacytcolumnstfreezetjsonsJSelect the output format among: legacy (default), columns, freeze or json.s--not-requiredt not_requireds>List packages that are not dependencies of installed packages.i(RRRR( tsuperR t__init__tcmd_optst add_optiontFalseR R tparsertinsert_option_group(tselftargstkwRt index_opts((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyR#s^      c C@s7td|jd|d|jd|jd|jd|�S(sK Create a package finder appropriate to this list command. t find_linkst index_urlstallow_all_prereleasest trusted_hoststprocess_dependency_linkstsession(RR'tpreR*R+(R#toptionsR(R,((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyt_build_package_findercs    cC@s)|jrtjdt�n|jr8tjdt�n|jrTtjdt�n|jdkrvtjdt�n|jr�|j r�t d��nt d|j d|j d|j�}|jr�|j||�}n|j r�|j||�}n|jr|j||�}n|j||�dS( 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.s�The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.s5Options --outdated and --uptodate cannot be combined.t local_onlyt user_onlyteditables_only(tallow_externaltwarningstwarnR tallow_all_externaltallow_unverifiedRtNonetoutdatedtuptodateRRtlocalRteditablet get_outdatedt get_uptodateRtget_not_requiredtoutput_package_listing(R#R.R$tpackages((s5/usr/lib/python2.7/site-packages/pip/commands/list.pytrunps<              cC@s5g|j||�D]}|j|jkr|^qS(N(titer_packages_latest_infostlatest_versiontparsed_version(R#RAR.tdist((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyR=�scC@s5g|j||�D]}|j|jkr|^qS(N(RCRDRE(R#RAR.RF((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyR>�sc@sQt��x+|D]#}�jd�|j�D��qWt�fd�|D��S(Ncs@s|]}|jVqdS(N(tkey(t.0t requirement((s5/usr/lib/python2.7/site-packages/pip/commands/list.pys �sc3@s$|]}|j�kr|VqdS(N(RG(RHtpkg(tdep_keys(s5/usr/lib/python2.7/site-packages/pip/commands/list.pys �s(tsettupdatetrequires(R#RAR.RF((RKs5/usr/lib/python2.7/site-packages/pip/commands/list.pyR?�s  !c c@sq|jg|j}|jr>tjddj|��g}ng}x6|D].}|jd�rK|j|jd��qKqKW|j |���}|j |||�}|j |�x�|D]�}d}|j |j �} |jsg| D]} | jjs�| ^q�} n| sq�nt| d|j�} | j} | jjrFd}nd}| |_||_|Vq�WWdQXdS(NsIgnoring indexes: %st,sdependency_links.txttunknownRGtwheeltsdist(t index_urltextra_index_urlstno_indextloggertdebugtjoint has_metadatatextendtget_metadata_linest_build_sessionR/tadd_dependency_linkstfind_all_candidatesRGR-tversiont is_prereleasetmaxt_candidate_sort_keytlocationtis_wheelRDtlatest_filetype( R#RAR.R(tdependency_linksRFR,tfinderttyptall_candidatest candidatetbest_candidatetremote_version((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyRC�s:              cC@s>t|�r&d|j|j|jfSd|j|jfSdS(Ns %s (%s, %s)s%s (%s)(Rt project_nameR_Rc(R#RF((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyt output_legacy�s   cC@s d|j|�|j|jfS(Ns%s - Latest: %s [%s](RnRDRe(R#RF((s5/usr/lib/python2.7/site-packages/pip/commands/list.pytoutput_legacy_latest�s cC@st|dd��}|jdkrR|rRt||�\}}|j||�n�|jdkr�x�|D]}tjd|j|j�qhWnq|jdkr�tjt||��nIxF|D]>}|j r�tj|j |��q�tj|j |��q�WdS(NRGcS@s |jj�S(N(Rmtlower(RF((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyt�tRRs%s==%sR( tsortedRtformat_for_columnstoutput_package_listing_columnsRVtinfoRmR_tformat_for_jsonR9RoRn(R#RAR.tdatatheaderRF((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyR@�s     cC@s�t|�dkr%|jd|�nt|�\}}t|�dkrq|jddjtd�|���nx|D]}tj|�qxWdS(Niit cS@sd|S(Nt-((tx((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyRq Rr(tlentinsertttabulateRXtmapRVRv(R#RxRyt pkg_stringstsizestval((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyRus( (t__name__t __module__t__doc__tnametusagetsummaryRR/RBR=R>R?RCRnRoR@Ru(((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyR s @ 6    '  cC@s�dgtd�|D��}xK|D]C}gt||�D]'\}}t|tt|���^q:}q$Wg}xm|D]e}djgt||�D]3\}}|dk r�t|�j|�nd^q��}|j|�qxW||fS(Nics@s|]}t|�VqdS(N(R}(RHR|((s5/usr/lib/python2.7/site-packages/pip/commands/list.pys sRzRr(RaRR}tstrRXR8tljusttappend(tvalsR�trowtstctresulttdisplay((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyRs A  IcC@s�|j}|r$ddddg}n ddg}g}td�|D��r\|jd�nxu|D]m}|j|jg}|r�|j|j�|j|j�nt|�r�|j|j�n|j|�qcW||fS(s_ Convert the package data into something usable by output_package_listing_columns. tPackagetVersiontLatesttTypecs@s|]}t|�VqdS(N(R(RHR|((s5/usr/lib/python2.7/site-packages/pip/commands/list.pys 2stLocation( R9tanyR�RmR_RDReRRc(tpkgsR.trunning_outdatedRyRxtprojR�((s5/usr/lib/python2.7/site-packages/pip/commands/list.pyRt%s     cC@s�g}xm|D]e}i|jd6tj|j�d6}|jretj|j�|d<|j|ds&    �  !