0{Y@sddlmZddlmZmZddlmZddlmZddl m Z ddl m Z m Z ddlmZmZGdd d eZd S) )Command)DistributionNotFoundBestVersionAlreadyInstalled) PackageFinder)logger)InstallRequirement)get_installed_distributionsdist_is_editable)make_option_group index_groupcseZdZdZdZdZdZdgZfddZdd Z d d Z d d Z ddZ ddZ ddZddZddZS) ListCommandz-List installed packages, including editables.listz %prog [options]zList installed packages.pythonc stt|j|||j}|jdddddddd|jd d dddddd |jd d dddddd|jdddddddd|jdddddddtt|j}|jjd||jjd|dS)Nz-oz --outdatedaction store_truedefaultFhelpz,List outdated packages (excluding editables)z-uz --uptodatez,List uptodate packages (excluding editables)z-ez --editablezList editable projects.z-lz--localzSIf in a virtualenv that has global access, do not list globally-installed packages.z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.r) superr __init__cmd_opts add_optionr r parserinsert_option_group)selfargskwr index_opts) __class__,/tmp/pip-ok8sy_ze-build/pip/commands/list.pyrs<     zListCommand.__init__cCsItd|jd|d|jd|jd|jd|jd|jd|S) zK Create a package finder appropriate to this list command. find_links index_urlsallow_externalallow_unverifiedallow_all_externalallow_all_prereleasesprocess_dependency_linkssession)rr r"r#r$prer&)roptionsr!r'rrr_build_package_finder9s     z!ListCommand._build_package_findercCs\|jr|j|n?|jr2|j|n&|jrK|j|n |j|dS)N)outdated run_outdateduptodate run_uptodateeditable run_editables run_listing)rr)rrrrrunHs   zListCommand.runcCsYxR|j|D]A\}}}||jkrtjd|j|j|fqqWdS)Nz%s (Current: %s Latest: %s))find_packages_latests_versionsparsed_versionrnotify project_nameversion)rr)distremote_version_rawremote_version_parsedrrrr,RszListCommand.run_outdatedc cs|jg|j}|jr?tjddj|g}n|jr[tjddn|jrtjdd||j7}ng}xKt d|j d|j D].}|j dr|j |jdqqW|j|}|j|||}|j|t d|j d d d|j }x|D]}tj|jd}y(|j|d } | dkrsw1nWn/tk rw1YnHtk r|j} Yn.X|j| |jd } | d } | d } || | fVq1WdS)NzIgnoring indexes: %s,z1.7z--use-mirrors has been deprecated and will be removed in the future. Explicit uses of --index-url and/or --extra-index-url is suggested.z--mirrors has been deprecated and will be removed in the future. Explicit uses of --index-url and/or --extra-index-url is suggested. local_onlyskipzdependency_links.txtinclude_editablesFTr) index_urlextra_index_urlsno_indexrr5join use_mirrors deprecatedmirrorsrlocalr= has_metadataextendget_metadata_lines_build_sessionr*add_dependency_linksr from_linekeyfind_requirementrrinstalled_version_link_package_versionsname) rr)r!dependency_linksr8r'finderinstalled_packagesreqlinkremote_versionr9r:rrrr3XsD       " !       z*ListCommand.find_packages_latests_versionscCs,td|jd|j}|j|dS)Nr<r=)rrGr=output_package_listing)rr)rUrrrr1szListCommand.run_listingcCs)td|jdd}|j|dS)Nr<editables_onlyT)rrGrY)rr)rUrrrr0szListCommand.run_editablescCs{t|ddd}x\|D]T}t|rPd|j|j|jf}nd|j|jf}tj|qWdS)NrNcSs |jjS)N)r6lower)r8rrrsz4ListCommand.output_package_listing..z %s (%s, %s)z%s (%s))sortedr r6r7locationrr5)rrUr8linerrrrYs   z"ListCommand.output_package_listingcCsYg}x?|j|D].\}}}|j|kr|j|qqW|j|dS)N)r3r4appendrY)rr)r-r8r9r:rrrr.s zListCommand.run_uptodate)__name__ __module__ __qualname____doc__rRusagesummaryr=rr*r2r,r3r1r0rYr.rr)rrr s  %   4   r N)pip.basecommandrpip.exceptionsrr pip.indexrpip.logrpip.reqrpip.utilrr Zpip.cmdoptionsr r r rrrrs