3 ”Re0,ã@s&ddlmZddlZddlZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZdd lmZdd lmZmZmZmZdd lmZdd lmZddlmZerøddlm Z ddl!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ej*e+ƒZ,Gdd„de ƒZ-dd„Z.dd„Z/dS)é)Úabsolute_importN)Úsix)Ú cmdoptions)ÚIndexGroupCommand)ÚSUCCESS)Ú CommandError)Ú LinkCollector)Ú PackageFinder)ÚSelectionPreferences)Údist_is_editableÚget_installed_distributionsÚtabulateÚ write_output)Ú get_installer)Úmap_multithread)ÚMYPY_CHECK_RUNNING)ÚValues)ÚListÚSetÚTupleÚIterator)Ú PipSession)Ú Distributionc@s`eZdZdZdZdZdd„Zdd„Zdd „Zd d „Z d d „Z dd„Z dd„Z dd„Z dd„ZdS)Ú ListCommandzt List installed packages, including editables. Packages are listed in a case-insensitive sorted order. Tz %prog [options]cCs|jjdddddd�|jjddddd d�|jjd d ddd d�|jjd ddddd�|jjdddddd�|jjtjƒƒ|jjddddd�|jjddddd+dd�|jjdddd d!�|jjd"d#d$d%d!�|jjd&dd$d'd(d)�tjtj|jƒ}|jjd*|ƒ|jjd*|jƒdS),Nz-oz --outdatedÚ store_trueFzList outdated packages)ÚactionÚdefaultÚhelpz-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--userÚuserz,Only output packages installed in user-site.)Údestrrrz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--formatÚstoreÚ list_formatÚcolumnsÚfreezeÚjsonzBSelect the output format among: columns (default), freeze, or json)rrrÚchoicesrz--not-requiredÚ not_requiredz>List packages that are not dependencies of installed packages.)rrrz--exclude-editableÚ store_falseÚinclude_editablez%Exclude editable package from output.z--include-editablez%Include editable package from output.T)rrrrr)r"r#r$)Úcmd_optsÚ add_optionrÚ list_pathÚmake_option_groupÚ index_groupÚparserÚinsert_option_group)ÚselfÚ index_opts©r2úŠ/builddir/build/BUILDROOT/alt-python36-pip-20.2.4-5.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/pip/_internal/commands/list.pyÚ add_options.sv zListCommand.add_optionscCs*tj||d�}td|jd�}tj||d�S)zK Create a package finder appropriate to this list command. )ÚoptionsF)Ú allow_yankedÚallow_all_prereleases)Úlink_collectorÚselection_prefs)rÚcreater Úprer )r0r5Úsessionr8r9r2r2r3Ú_build_package_finder{s z!ListCommand._build_package_findercCs‚|jr|jrtdƒ‚tj|ƒt|j|j|j|j |j d�}|j rL|j ||ƒ}|jr`|j ||ƒ}n|jrr|j||ƒ}|j||ƒtS)Nz5Options --outdated and --uptodate cannot be combined.)Ú local_onlyÚ user_onlyÚeditables_onlyÚinclude_editablesÚpaths)ÚoutdatedZuptodaterrÚcheck_list_path_optionr ÚlocalrÚeditabler(Úpathr&Úget_not_requiredÚ get_outdatedÚ get_uptodateÚoutput_package_listingr)r0r5ÚargsÚpackagesr2r2r3Úrun�s$      zListCommand.runcCsdd„|j||ƒDƒS)NcSsg|]}|j|jkr|‘qSr2)Úlatest_versionÚparsed_version)Ú.0Údistr2r2r3ú ¯sz,ListCommand.get_outdated..)Úiter_packages_latest_infos)r0rMr5r2r2r3rI¬szListCommand.get_outdatedcCsdd„|j||ƒDƒS)NcSsg|]}|j|jkr|‘qSr2)rOrP)rQrRr2r2r3rS¶sz,ListCommand.get_uptodate..)rT)r0rMr5r2r2r3rJ³szListCommand.get_uptodatecsBtƒ‰x$|D]}ˆjdd„|jƒDƒƒq Wt‡fdd„|DƒƒS)Ncss|] }|jVqdS)N)Úkey)rQÚ requirementr2r2r3ú ¾sz/ListCommand.get_not_required..csh|]}|jˆkr|’qSr2)rU)rQÚpkg)Údep_keysr2r3ú Ãsz/ListCommand.get_not_required..)ÚsetÚupdateÚrequiresÚlist)r0rMr5rRr2)rYr3rHºs zListCommand.get_not_requiredc #sV|jˆƒ�B}|jˆ|ƒ‰‡‡fdd„}x t||ƒD]}|dk r2|Vq2WWdQRXdS)Ncspd}ˆj|jƒ}ˆjs$dd„|Dƒ}ˆj|jd�}|j|ƒ}|dkrHdS|j}|jjr\d}nd}||_ ||_ |S)NÚunknowncSsg|]}|jjs|‘qSr2)ÚversionÚ is_prerelease)rQÚ candidater2r2r3rSÐszOListCommand.iter_packages_latest_infos..latest_info..)Ú project_nameÚwheelÚsdist) Úfind_all_candidatesrUr;Úmake_candidate_evaluatorrcÚsort_best_candidater`ÚlinkÚis_wheelrOÚlatest_filetype)rRÚtypZall_candidatesZ evaluatorÚbest_candidateÚremote_version)Úfinderr5r2r3Ú latest_infoÊs    z;ListCommand.iter_packages_latest_infos..latest_info)Ú_build_sessionr=r)r0rMr5r<rprRr2)ror5r3rTÅs   z&ListCommand.iter_packages_latest_infoscCs t|dd„d�}|jdkr:|r:t||ƒ\}}|j||ƒnb|jdkr„xV|D]4}|jdkrntd|j|j|jƒqJtd|j|jƒqJWn|jd krœtt ||ƒƒdS) NcSs |jjƒS)N)rcÚlower)rRr2r2r3Úìsz4ListCommand.output_package_listing..)rUr"r#éz %s==%s (%s)z%s==%sr$) Úsortedr!Úformat_for_columnsÚoutput_package_listing_columnsÚverboserrcr`ÚlocationÚformat_for_json)r0rMr5ÚdataÚheaderrRr2r2r3rKès     z"ListCommand.output_package_listingcCsft|ƒdkr|jd|ƒt|ƒ\}}t|ƒdkrL|jddjtdd„|ƒƒƒx|D] }t|ƒqRWdS)Nrrtú cSsd|S)Nú-r2)Úxr2r2r3rssz.)ÚlenÚinsertr ÚjoinÚmapr)r0r{r|Z pkg_stringsÚsizesÚvalr2r2r3rwûs     z*ListCommand.output_package_listing_columnsN)Ú__name__Ú __module__Ú __qualname__Ú__doc__Úignore_require_venvÚusager4r=rNrIrJrHrTrKrwr2r2r2r3r#sM #rcCsÜ|j}|rddddg}nddg}g}|jdks@tdd„|DƒƒrJ|jdƒ|jdkr^|jd ƒxt|D]l}|j|jg}|r�|j|jƒ|j|jƒ|jdks¢t|ƒr®|j|j ƒ|jdkrÆ|jt |ƒƒ|j|ƒqdW||fS) z_ Convert the package data into something usable by output_package_listing_columns. ZPackageÚVersionZLatestZTypertcss|]}t|ƒVqdS)N)r )rQrr2r2r3rWsz%format_for_columns..ZLocationZ Installer) rCrxÚanyÚappendrcr`rOrkr ryr)Úpkgsr5Zrunning_outdatedr|r{ZprojÚrowr2r2r3rv s(         rvcCszg}xj|D]b}|jtj|jƒdœ}|jdkrB|j|d<t|ƒ|d<|jrbtj|jƒ|d<|j |d<|j |ƒq Wt j |ƒS)N)Únamer`rtryÚ installerrOrk) rcrÚ text_typer`rxryrrCrOrkrŽr$Údumps)rMr5r{rRÚinfor2r2r3rz1s     rz)0Ú __future__rr$ÚloggingÚ pip._vendorrZpip._internal.clirÚpip._internal.cli.req_commandrÚpip._internal.cli.status_codesrÚpip._internal.exceptionsrÚpip._internal.index.collectorrÚ"pip._internal.index.package_finderr Ú$pip._internal.models.selection_prefsr Úpip._internal.utils.miscr r r rÚpip._internal.utils.packagingrZpip._internal.utils.parallelrÚpip._internal.utils.typingrÚoptparserÚtypingrrrrÚpip._internal.network.sessionrZpip._vendor.pkg_resourcesrÚ getLoggerr†Úloggerrrvrzr2r2r2r3Ús0                i&