a [f@sddlZddlmZddlmZmZmZmZmZddl m Z m Z ddl m Z ddlmZddlmZmZddlmZdd lmZmZmZdd lmZdd lmZdd lmZdd lm Z ddl!m"Z"ddl#m$Z$e%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~t|j|jt|jt|jt|jtttj |j }|j d||j d|jdS)Nr) r Zadd_target_python_optionsZcmd_optsZ add_optionignore_requires_pythonpreZ no_binaryZ only_binaryZmake_option_groupZ index_groupparserZinsert_option_group)selfZ index_optsr@/usr/lib/python3.9/site-packages/pip/_internal/commands/index.py add_optionss zIndexCommand.add_options)optionsargsrc Csd|ji}td|r$|d|vr>tddt|tS|d}z||||ddWn8ty}z t|jdtWYd}~Sd}~00t 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., ) get_available_package_versionsloggerZwarningerrorjoinsortedr rr"r )rr!r"handlersactionerrrrun/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_yankedZallow_all_prereleasesr)link_collectorselection_prefsr0)rZcreaterrr)rr!r/r0rr1r2rrr_build_package_finderMs z"IndexCommand._build_package_finderc Cst|dkrtdt|}|d}||}|j||||jd}dd||D}|jsndd|D}t |}|st d |d d t |d d D}|d} Wdn1s0Yt d || t d d|t|| dS)Nr%z(You need to specify exactly one argumentr)r!r/r0rcss|] }|jVqdSN)version).0 candidaterrr usz>IndexCommand.get_available_package_versions..css|]}|js|VqdSr4)Z is_prerelease)r6r5rrrr8{sz%No matching distribution found for {}cSsg|] }t|qSr)str)r6Zverrrr z?IndexCommand.get_available_package_versions..T)reversez{} ({})zAvailable versions: {}r$)lenrr Zmake_target_pythonZ_build_sessionr3rZfind_all_candidatesrsetrformatr*rr)r) rr!r"r0queryr/finderr#Zformatted_versionsZlatestrrrr&fs8   &z+IndexCommand.get_available_package_versions)NN)__name__ __module__ __qualname____doc__usager rrr9intr.rrrboolrr3rr&rrrrrs" r))ZloggingZoptparsertypingrrrrrZpip._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.miscrZ getLoggerrBr'rrrrrs