ó â\e[c@@søddlmZddlZddlZddlmZddlmZddlm Z ddl m Z m Z ddl mZddlmZdd lmZmZdd lmZejeƒZd e fd „ƒYZd „Zd„Zd„ZdS(i(tabsolute_importN(tsix(t zip_longest(tCommand(t index_grouptmake_option_group(t CommandError(t PackageFinder(tdist_is_editabletget_installed_distributions(t get_installert ListCommandcB@sqeZdZdZdZdZd„Zd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „ZRS( st List installed packages, including editables. Packages are listed in a case-insensitive sorted order. tlists %prog [options]sList installed packages.c O@s»tt|ƒj||Ž|j}|jdddddtddƒ|jdd dddtdd ƒ|jd d dddtdd ƒ|jdddddtddƒ|jjddddddtddƒ|jddddtddƒ|jddddddddd)ddƒ|jddddd dd!ƒ|jd"dd#dd$dd%ƒ|jd&dddd$dd'dtƒtt|j ƒ}|j j d(|ƒ|j j 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_formattcolumnstchoicestfreezetjsonsBSelect the output format among: columns (default), freeze, or jsons--not-requiredt not_requireds>List packages that are not dependencies of installed packages.s--exclude-editablet store_falsetinclude_editables%Exclude editable package from output.s--include-editables%Include editable package from output.i(scolumnssfreezesjson( tsuperR t__init__tcmd_optst add_optiontFalsetTrueRRtparsertinsert_option_group(tselftargstkwRt index_opts((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyR sv      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-((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyt_build_package_finderns    c C@s¼|jr!|jr!tdƒ‚ntd|jd|jd|jd|jƒ}|jrl|j||ƒ}n|jrŠ|j ||ƒ}n|j r¨|j ||ƒ}n|j ||ƒdS(Ns5Options --outdated and --uptodate cannot be combined.t local_onlyt user_onlyteditables_onlytinclude_editables( toutdatedtuptodateRR tlocalRteditableRt get_outdatedt get_uptodateRtget_not_requiredtoutput_package_listing(R$R/R%tpackages((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pytrun{s        cC@s5g|j||ƒD]}|j|jkr|^qS(N(titer_packages_latest_infostlatest_versiontparsed_version(R$R=R/tdist((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyR9‘scC@s5g|j||ƒD]}|j|jkr|^qS(N(R?R@RA(R$R=R/RB((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyR:—sc@sKtƒ‰x+|D]#}ˆjd„|jƒDƒƒqW‡fd†|DƒS(Ncs@s|]}|jVqdS(N(tkey(t.0t requirement((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pys  sc@s%h|]}|jˆkr|’qS((RC(RDtpkg(tdep_keys(s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pys ¡s (tsettupdatetrequires(R$R=R/RB((RGs:/tmp/pip-install-0xiv62/pip/pip/_internal/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.txttunknownRCtwheeltsdist(t index_urltextra_index_urlstno_indextloggertdebugtjoint has_metadatatextendtget_metadata_linest_build_sessionR0tadd_dependency_linkstfind_all_candidatesRCR.tversiont is_prereleasetmaxt_candidate_sort_keytlocationtis_wheelR@tlatest_filetype( R$R=R/R)tdependency_linksRBR-tfinderttyptall_candidatest candidatetbest_candidatetremote_version((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyR?£s:              cC@sët|dd„ƒ}|jdkrR|rRt||ƒ\}}|j||ƒn•|jdkr¿xƒ|D]P}|jdkrŸtjd|j|j|j ƒqhtjd|j|jƒqhWn(|jdkrçtjt ||ƒƒndS( NRCcS@s |jjƒS(N(t project_nametlower(RB((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pytÍsRRis %s==%s (%s)s%s==%sR( tsortedRtformat_for_columnstoutput_package_listing_columnstverboseRRtinfoRiR[R_tformat_for_json(R$R=R/tdatatheaderRB((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyR<Ês   cC@s“t|ƒdkr%|jd|ƒnt|ƒ\}}t|ƒdkrq|jddjtd„|ƒƒƒnx|D]}tj|ƒqxWdS(Niit cS@sd|S(Nt-((tx((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyRkås(tlentinsertttabulateRTtmapRRRp(R$RrRst pkg_stringstsizestval((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyRnÜs( (t__name__t __module__t__doc__tnametusagetsummaryRR0R>R9R:R;R?R<Rn(((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyR s N     ' cC@st|ƒdkst‚dgtd„|Dƒƒ}xK|D]C}gt||ƒD]'\}}t|tt|ƒƒƒ^qR}q<Wg}xm|D]e}djgt||ƒD]3\}}|dk rÙt|ƒj|ƒnd^q¬ƒ}|j|ƒqW||fS(Nics@s|]}t|ƒVqdS(N(Rw(RDRv((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pys ðsRtt( RwtAssertionErrorR]RtstrRTtNonetljusttappend(tvalsR|trowtstctresulttdisplay((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyRyës A  IcC@s@|j}|r$ddddg}n ddg}g}|jdks[td„|Dƒƒrk|jdƒn|jdkrŠ|jdƒnx©|D]¡}|j|jg}|rÒ|j|jƒ|j|jƒn|jdksít|ƒr|j|j ƒn|jdkr%|jt |ƒƒn|j|ƒq‘W||fS( s_ Convert the package data into something usable by output_package_listing_columns. tPackagetVersiontLatesttTypeics@s|]}t|ƒVqdS(N(R(RDRv((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pys stLocationt Installer( R5RotanyR‰RiR[R@RaRR_R (tpkgsR/trunning_outdatedRsRrtprojR‹((s:/tmp/pip-install-0xiv62/pip/pip/_internal/commands/list.pyRmýs(  % cC@s²g}xœ|D]”}i|jd6tj|jƒd6}|jdkre|j|ds  Ö  %