3 ig@sddlZddlmZddlmZmZmZmZmZddl m Z m Z ddl m Z ddlmZddlmZmZddlmZdd lmZmZmZdd lmZdd lmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$ej%e&Z'GdddeZ(dS)N)Values)AnyIterableListOptionalUnion) LegacyVersionVersion) cmdoptions)IndexGroupCommand)ERRORSUCCESS)print_dist_installation_info) CommandErrorDistributionNotFoundPipError) LinkCollector) PackageFinder)SelectionPreferences) TargetPython) PipSession) write_outputc@sneZdZdZdZddddZeeee ddd Z dee e e e eed d d Zeeeddd dZdS) IndexCommandz= Inspect information available from package indexes. z& %prog versions N)returncCs~tj|j|jjtj|jjtj|jjtj|jjtjtjtj |j }|j j d||j j d|jdS)Nr) r Zadd_target_python_optionscmd_opts add_optionignore_requires_pythonpre no_binary only_binarymake_option_group index_groupparserinsert_option_group)self index_optsr&;/tmp/pip-build-88gy_88q/pip/pip/_internal/commands/index.py add_optionss zIndexCommand.add_options)optionsargsrcCsd|ji}tjd| s&|d|kr@tjddjt|tS|d}y||||ddWn0tk r}ztj|jdtSd}~XnXt S)Nversionsztpip index is currently an experimental command. It may be removed/changed in a future release without prior warning.rzNeed an action (%s) to perform.z, ) get_available_package_versionsloggerwarningerrorjoinsortedr rr*r )r$r)r*handlersactioner&r&r'run/s zIndexCommand.run)r)session target_pythonrrcCs.tj||d}td|j|d}tj|||dS)zK Create a package finder appropriate to the index command. )r)F)Z allow_yankedallow_all_prereleasesr)link_collectorselection_prefsr8)rcreaterrr)r$r)r7r8rr:r;r&r&r'_build_package_finderMs z"IndexCommand._build_package_finderc Cst|dkrtdtj|}|d}|j|z}|j||||jd}dd|j|D}|jsndd|D}t |}|st dj |d d t |d d D}|d} WdQRXt d j || t dj dj|t|| dS)Nr,z(You need to specify exactly one argumentr)r)r7r8rcss|] }|jVqdS)N)version).0 candidater&r&r' vsz>IndexCommand.get_available_package_versions..css|]}|js|VqdS)N) is_prerelease)r?r>r&r&r'rA|sz%No matching distribution found for {}cSsg|] }t|qSr&)str)r?verr&r&r' sz?IndexCommand.get_available_package_versions..T)reversez{} ({})zAvailable versions: {}z, )lenrr Zmake_target_python_build_sessionr=rfind_all_candidatesrsetrformatr2rr1r) r$r)r*r8queryr7finderr+Zformatted_versionslatestr&r&r'r-fs,     z+IndexCommand.get_available_package_versions)NN)__name__ __module__ __qualname____doc__usager(rrrCintr6rrrboolrr=rr-r&r&r&r'rs"r))loggingoptparserZtypingrrrrrZpip._vendor.packaging.versionrr Zpip._internal.clir Zpip._internal.cli.req_commandr Zpip._internal.cli.status_codesr r Zpip._internal.commands.searchrZpip._internal.exceptionsrrrZpip._internal.index.collectorrZ"pip._internal.index.package_finderrZ$pip._internal.models.selection_prefsrZ"pip._internal.models.target_pythonrZpip._internal.network.sessionrZpip._internal.utils.miscr getLoggerrOr.rr&r&r&r's