R`i0 ddlZddlZddlmZddlmZmZmZmZm Z m Z m Z ddl m Z ddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$m%Z%erddl&m'Z'GddeZ(e e(Z)ejTe+Z,GddeZ-dddede eee.ee.ffdZ/dddede.fdZ0y)N)Values) TYPE_CHECKING GeneratorListOptionalSequenceTuplecastcanonicalize_name) cmdoptions)IndexGroupCommand)SUCCESS) CommandError) LinkCollector) PackageFinder)BaseDistributionget_environment)SelectionPreferences) PipSession) stdlib_pkgs)tabulate write_output)DistributionVersionc&eZdZUdZeed<eed<y)_DistWithLatestInfozGive the distribution object a couple of extra fields. These will be populated during ``get_outdated()``. This is dirty but makes the rest of the code much cleaner. latest_versionlatest_filetypeN)__name__ __module__ __qualname____doc__r__annotations__str/builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_internal/commands/list.pyrrs ,+r&rceZdZdZdZdZddZdedede fd Z ded e e de fd Zd d dedd fdZd d dedd fdZd d dedd fdZd d dededfdZd d deddfdZde e e de e ddfdZy) ListCommandzt List installed packages, including editables. Packages are listed in a case-insensitive sorted order. Tz %prog [options]returnNc|jjddddd|jjddddd |jjd d ddd |jjd dddd|jjddddd|jjtj|jjdddd|jjdddddd|jjdddd |jjd!d"d#d$ |jjd%dd#d&d'(|jjtjtj tj |j}|jjd)||jjd)|jy)*Nz-oz --outdated store_trueFzList outdated packages)actiondefaulthelpz-uz --uptodatezList uptodate packagesz-ez --editablezList editable projects.z-lz--localzSIf in a virtualenv that has global access, do not list globally-installed packages.z--useruserz,Only output packages installed in user-site.)destr-r.r/z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--formatstore list_formatcolumns)r4freezejsonzSelect the output format among: columns (default), freeze, or json. The 'freeze' format cannot be used with the --outdated option.)r-r1r.choicesr/z--not-required not_requiredz>List packages that are not dependencies of installed packages.)r-r1r/z--exclude-editable store_falseinclude_editablez%Exclude editable package from output.z--include-editablez%Include editable package from output.T)r-r1r/r.r) cmd_opts add_optionr list_path list_excludemake_option_group index_groupparserinsert_option_group)self index_optss r' add_optionszListCommand.add_options2s    ) !     ) !     * !     / !    ? !    !5!5!78   2 !    1Q !    Q !     #8 !   #8 !    !8!8!:;11*2H2H$++V  '':6 ''4==9r&optionssessionctj||}td|j}t j||S)zK Create a package finder appropriate to this list command. )rFF) allow_yankedallow_all_prereleases)link_collectorselection_prefs)rcreaterprer)rCrFrGrKrLs r'_build_package_finderz!ListCommand._build_package_findersG '--gwG/")++  ##)+  r&argsc|jr|jr td|jr|jdk(r tdt j |t t}|jr"|jd|jDt|jj|j|j|j|j |Dcgc]}t#d|}}|j$r|j'||}|jr|j)||}n|jr|j+||}|j-||t.Scc}w)Nz5Options --outdated and --uptodate cannot be combined.r5z?List format 'freeze' cannot be used with the --outdated option.c32K|]}t|ywNr ).0ns r' z"ListCommand.run..sG6F)!,6Fs) local_only user_onlyeditables_onlyinclude_editablesskipr)outdateduptodaterr3r check_list_path_optionsetrexcludesupdaterpathiter_installed_distributionslocalr0editabler:r r8get_not_required get_outdated get_uptodateoutput_package_listingr)rCrFrPr[dpackagess r'runzListCommand.runsX    0 0VW W    3 3x ?Q  ))'2;    KKGg6F6FG G%W\\2OO"==!,,&//")":": P '  & *  '    ,,Xw?H   ((7;H   ((7;H ##Hg61 ' s/E7rk_ProcessedDistsc~|j||Dcgc]}|j|jkDr|c}Scc}wrSiter_packages_latest_infosrversionrCrkrFdists r'rgzListCommand.get_outdatedsH 77'J J""T\\1 J   ":c~|j||Dcgc]}|j|jk(r|c}Scc}wrSrorrs r'rhzListCommand.get_uptodatesH 77'J J""dll2 J   rtc|Dchc]0}|jxsdD]}t|j2}}}t|Dchc]}|j|vs|c}Scc}}wcc}w)Nr%)iter_dependenciesr namelistcanonical_name)rCrkrFrsdepdep_keyspkgs r'rfzListCommand.get_not_requireds !  ..06B6 chh '6 (   HSHS0B0B(0RSHSTT Ts5A&A,A,)rNNc#K|j5}|j|dddtdffd }t||D] }||  dddy#1swYyxYww)Nrsrr*ctj|j}js%|Dcgc]}|jjs|}}j |j}|j |}|y|j}|jjrd}nd}||_ ||_ |Scc}w)N) project_namewheelsdist) find_all_candidatesrzrNrq is_prereleasemake_candidate_evaluatorsort_best_candidatelinkis_wheelrr) rsall_candidates candidate evaluatorbest_candidateremote_versiontypfinderrFs r' latest_infoz;ListCommand.iter_packages_latest_infos..latest_infos"(!;!;D>")7#& #;;!%!4!4< "+!>!>~!N!)!/!7!7!&&//!C!C&4#'*$ )&sB5)_build_sessionrOrmap)rCrkrFrGrrsrs ` @r'rpz&ListCommand.iter_packages_latest_infosso  )W//AF + /0 8K2#J3?* ) )s"A)6A A A)A&"A)ct|d}|jdk(r$|r"t||\}}|j||y|jdk(re|D]_}|jdk\r-t d|j |j|j?t d|j |jay|jdk(rt t||yy) Nc|jSrS)rz)rss r'z4ListCommand.output_package_listing..s T00r&)keyr4r5z %s==%s (%s)z%s==%sr6) sortedr3format_for_columnsoutput_package_listing_columnsverboserraw_namerqlocationformat_for_json)rCrkrFdataheaderrss r'riz"ListCommand.output_package_listing s 0    ) +-h@LD&  / /f =  H , ??a' %t}}dllDMM!4==$,,G ! F * 7; <+r&rrct|dkDr|jd|t|\}}t|dkDr(|jddjd|D|D] }t |y)Nrr c3&K|] }d|z yw)-Nr%rTxs r'rVz=ListCommand.output_package_listing_columns..,s*BEq37Es)leninsertrjoinr)rCrr pkg_stringssizesvals r'rz*ListCommand.output_package_listing_columns!si t9q= KK6 "%d^ U t9q=   q#((*BE*B"B CC  r&)r*N)rr r!r"ignore_require_venvusagerErrrrOrr$intrlrgrhrfrrprirr%r&r'r)r)'s  EV:p  (2  &'6'c's'R ) 4:   ) 4:   U) U4: U  U$)$4:$ 4 5$L=)=4:= =*cO-1#Y r&r)pkgsrmrFr*cddg}|j}|r|jddgtd|D}|r|jd|jdk\r|jd|jdk\r|jd g}|D]}|j t |jg}|r?|jt |j|j|j|r|j|jxsd |jdk\r|j|jxsd |jdk\r|j|j|j|||fS) z_ Convert the package data into something usable by output_package_listing_columns. PackageVersionLatestTypec34K|]}|jywrS)rers r'rVz%format_for_columns..?s1Dq DszEditable project locationrLocation Installer) r\extendanyappendrrr$rqrreditable_project_locationr installer)rrFrrunning_outdated has_editablesrprojrows r'rr2sA #F'' x()1D11M 12! j!! k" D}}c$,,/0  JJs4../ 0 JJt++ ,  JJt55; < ??a  JJt}}* + ??a  JJt~~ & C#& <r&rkcg}|D]}|jt|jd}|jdk\r"|jxsd|d<|j |d<|j r't|j|d<|j|d<|j}|r||d<|j|tj|S) N)rxrqrrrrrrr) rr$rqrrrr\rrrrr6dumps)rkrFrrsinfors r'rr_s DMM4<<(  ??a #}}2D  $D    %()<)<%=D! "&*&:&:D" #$($B$B! $0ID, - D ::d r&)1r6loggingoptparsertypingrrrrrr r pip._vendor.packaging.utilsr pip._internal.clir pip._internal.cli.req_commandrpip._internal.cli.status_codesrpip._internal.exceptionsrpip._internal.index.collectorr"pip._internal.index.package_finderrpip._internal.metadatarr$pip._internal.models.selection_prefsrpip._internal.network.sessionrpip._internal.utils.compatrpip._internal.utils.miscrrpip._internal.metadata.baserrrm getLoggerrloggerr)r$rrr%r&r'rs RRR9(;217<DE42;?.23O   8 $H#HV* *&,* 4S ?DI %&*Z/&Sr&