U ʗRet/@sXddlZddlZddlmZddlmZmZmZmZm 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'GdddeZ(e e(Z)e*e+Z,GdddeZ-dee eee.ee.fdddZ/dee.dddZ0dS)N)Values) TYPE_CHECKING GeneratorListOptionalSequenceTuplecastcanonicalize_name) cmdoptions)IndexGroupCommand)SUCCESS) CommandError) LinkCollector) PackageFinder)BaseDistributionget_environment)SelectionPreferences) PipSession) stdlib_pkgs)tabulate write_output)DistributionVersionc@s"eZdZUdZeed<eed<dS)_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__strr#r#/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/commands/list.pyrs rc@seZdZdZdZdZddddZeee dd d Z ee e e d d d ZdeddddZdeddddZdeddddZdeeddddZdeddddZe e e e e ddddZdS) ListCommandzt List installed packages, including editables. Packages are listed in a case-insensitive sorted order. Tz %prog [options]N)returncCs*|jjdddddd|jjddddd d|jjd d ddd d|jjd ddddd|jjdddddd|jt|jjddddd|jjddddddd|jjddddd |jjd!d"d#d$d |jjd%dd#d&d'd(|jtttj|j}|jd)||jd)|jdS)*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)r/freezejsonzBSelect the output format among: columns (default), freeze, or json)r(r,r)choicesr*z--not-required not_requiredz>List packages that are not dependencies of installed packages.)r(r,r*z--exclude-editable store_falseinclude_editablez%Exclude editable package from output.z--include-editablez%Include editable package from output.T)r(r,r*r)r) cmd_opts add_optionr list_path list_excludemake_option_group index_groupparserinsert_option_group)self index_optsr#r#r$ add_options2s   zListCommand.add_options)optionssessionr&cCs*tj||d}td|jd}tj||dS)zK Create a package finder appropriate to this list command. )rAF) allow_yankedallow_all_prereleases)link_collectorselection_prefs)rcreaterprer)r>rArBrErFr#r#r$_build_package_findersz!ListCommand._build_package_finder)rAargsr&cCs|jr|jrtdt|tt}|jrB|dd|jDddt |j j |j |j |j|j|dD}|jr|||}|jr|||}n|jr|||}|||tS)Nz5Options --outdated and --uptodate cannot be combined.css|]}t|VqdSNr ).0nr#r#r$ sz"ListCommand.run..cSsg|]}td|qS)r)r )rLdr#r#r$ sz#ListCommand.run..) local_only user_onlyeditables_onlyinclude_editablesskip)outdatedZuptodaterr check_list_path_optionsetrexcludesupdaterpathiter_installed_distributionslocalr+editabler5r3get_not_required get_outdated get_uptodateoutput_package_listingr)r>rArJrUpackagesr#r#r$runs.      zListCommand.run_ProcessedDistsrcrAr&cCsdd|||DS)NcSsg|]}|j|jkr|qSr#rversionrLdistr#r#r$rPs z,ListCommand.get_outdated..iter_packages_latest_infosr>rcrAr#r#r$r`s zListCommand.get_outdatedcCsdd|||DS)NcSsg|]}|j|jkr|qSr#rgrir#r#r$rPs z,ListCommand.get_uptodate..rkrmr#r#r$ras zListCommand.get_uptodatecs$dd|Dtfdd|DS)NcSs(h|] }|pdD]}t|jqqS)r#)iter_dependenciesr name)rLrjdepr#r#r$ sz/ListCommand.get_not_required..csh|]}|jkr|qSr#canonical_name)rLpkgZdep_keysr#r$rqs )listrmr#rur$r_s zListCommand.get_not_required)rNNc #s^|J}||dtddfdd }t||D]}|dk r<|Vq.latest_info..) project_namewheelsdist) find_all_candidatesrsrHmake_candidate_evaluatorsort_best_candidaterhlinkis_wheelrr)rjZall_candidatesZ evaluatorbest_candidateremote_versiontypfinderrAr#r$ latest_infos$  z;ListCommand.iter_packages_latest_infos..latest_info)_build_sessionrIrmap)r>rcrArBrrjr#rr$rls  z&ListCommand.iter_packages_latest_infoscCst|ddd}|jdkr:|r:t||\}}|||n^|jdkr|D]4}|jdkrltd|j|j|jqHtd|j|jqHn|jd krtt ||dS) NcSs|jSrKrr)rjr#r#r$ z4ListCommand.output_package_listing..)keyr/r0z %s==%s (%s)z%s==%sr1) sortedr.format_for_columnsoutput_package_listing_columnsverboserraw_namerhlocationformat_for_json)r>rcrAdataheaderrjr#r#r$rbs&   z"ListCommand.output_package_listing)rrr&cCsbt|dkr|d|t|\}}t|dkrL|ddtdd||D] }t|qPdS)Nrr cSsd|S)N-r#)xr#r#r$r$rz.)leninsertrjoinrr)r>rrZ pkg_stringssizesvalr#r#r$rs    z*ListCommand.output_package_listing_columns)rrrr ignore_require_venvusager@rrrrIrr"intrdr`rar_rrlrbrr#r#r#r$r%'sBV %    '  r%re)pkgsrAr&cCsddg}|j}|r |ddgtdd|D}|r@|d|jdkrT|d |jdkrh|d g}|D]}|jt|jg}|r|t|j||j |r||j pd |jdkr||j pd |jdkr||j ||qp||fS) z_ Convert the package data into something usable by output_package_listing_columns. PackageVersionZLatestTypecss|] }|jVqdSrK)r^)rLrr#r#r$rN7sz%format_for_columns..zEditable project locationrZLocationZ Installer) rVextendanyappendrrr"rhrreditable_project_locationr installer)rrArZrunning_outdatedZ has_editablesrZprojrowr#r#r$r*s2          rrfcCsg}|D]r}|jt|jd}|jdkr@|jp0d|d<|j|d<|jr^t|j|d<|j|d<|j }|rp||d<| |qt |S) N)rorhrrrrrrr) rr"rhrrrrVrrrrr1dumps)rcrArrjinforr#r#r$rWs     r)1r1loggingoptparsertypingrrrrrrr pip._vendor.packaging.utilsr Zpip._internal.clir pip._internal.cli.req_commandr pip._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.miscrrZpip._internal.metadata.baserrre getLoggerrloggerr%r"rrr#r#r#r$s8 $              -