
    h{                        d dl Z d dlmZ d dlmZmZmZmZ d dlm	Z	 d dl
mZ d dlmZ d dlmZmZ d dlmZ d d	lmZmZmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dl!m"Z"  e jF                  e$      Z% G d de      Z&y)    N)Values)AnyIterableListOptional)Version)
cmdoptions)IndexGroupCommand)ERRORSUCCESS)print_dist_installation_info)CommandErrorDistributionNotFoundPipError)LinkCollector)PackageFinder)SelectionPreferences)TargetPython)
PipSession)write_outputc                       e Zd ZdZdZdZddZdedee	   de
fd	Z	 	 dded
edee   dee   def
dZdedee   ddfdZy)IndexCommandz=
    Inspect information available from package indexes.
    Tz&
        %prog versions <package>
    returnNc                    t        j                  | j                         | j                  j                  t        j                                | j                  j                  t        j
                                | j                  j                  t        j                                | j                  j                  t        j                                t        j                  t         j                  | j                        }| j                  j                  d|       | j                  j                  d| j                         y )Nr   )r	   add_target_python_optionscmd_opts
add_optionignore_requires_pythonpre	no_binaryonly_binarymake_option_groupindex_groupparserinsert_option_group)self
index_optss     ED:\EasyAligner\venv\Lib\site-packages\pip/_internal/commands/index.pyadd_optionszIndexCommand.add_options    s    ,,T]];  !B!B!DE  !12  !5!5!78  !7!7!9:11""KK


 	'':6''4==9    optionsargsc                 t   d| j                   i}t        j                  d       |r|d   |vr4t        j                  ddj	                  t        |                   t        S |d   }	  ||   ||dd         t        S # t        $ r2}t        j                  |j                  d          t        cY d }~S d }~ww xY w)Nversionsztpip index is currently an experimental command. It may be removed/changed in a future release without prior warning.r   zNeed an action (%s) to perform.,    )
get_available_package_versionsloggerwarningerrorjoinsortedr   r   r,   r   )r&   r+   r,   handlersactiones         r(   runzIndexCommand.run0   s    ;;
 	%	
 tAwh.LL1		&*+ La	HVWd12h/
 	  	LL#L	s   'A< <	B7'B2,B72B7sessiontarget_pythonr   c                     t        j                  ||      }t        d|j                  |      }t	        j                  |||      S )zK
        Create a package finder appropriate to the index command.
        )r+   F)allow_yankedallow_all_prereleasesr   )link_collectorselection_prefsr<   )r   creater   r   r   )r&   r+   r;   r<   r   r@   rA   s          r(   _build_package_finderz"IndexCommand._build_package_finderN   sM     '--gwG /")++#9
 ##)+'
 	
r*   c                 j   t        |      dk7  rt        d      t        j                  |      }|d   }| j	                  |      5 }| j                  ||||j                        }d |j                  |      D        }|j                  s	d |D        }t        |      }|st        d|       t        |d	      D cg c]  }t        |       }	}|	d   }
d d d        t        | d

 d       t        dj                  dj                  	                   t!        ||
       y c c}w # 1 sw Y   UxY w)Nr0   z(You need to specify exactly one argumentr   )r+   r;   r<   r   c              3   4   K   | ]  }|j                     y wN)version).0	candidates     r(   	<genexpr>z>IndexCommand.get_available_package_versions.<locals>.<genexpr>v   s      +3Ti	!!3Ts   c              3   :   K   | ]  }|j                   r|  y wrF   )is_prerelease)rH   rG   s     r(   rJ   z>IndexCommand.get_available_package_versions.<locals>.<genexpr>|   s      +37;P;PG8s   z#No matching distribution found for T)reversez ()zAvailable versions: {}r/   )lenr   r	   make_target_python_build_sessionrC   r   find_all_candidatesr   setr   r6   strr   formatr5   r   )r&   r+   r,   r<   queryr;   finderr.   verformatted_versionslatests              r(   r1   z+IndexCommand.get_available_package_versionsg   sA   t9>IJJ"55g>Q  )W//+'.'E'E	 0 F+393M3Me3T+H ;;+3 8}H*9%A  7=Xt6T!U6Ts#c(6T!U'*F3 *6 	wb*+-44TYY?Q5RST$UF3 "V1 *)s   A7D)<D$D)$D))D2)r   N)NN)__name__
__module____qualname____doc__ignore_require_venvusager)   r   r   rT   intr:   r   r   r   boolr   rC   r   r1    r*   r(   r   r      s     E: 6 c s D 1515

 
  -	

 !)
 

2$4f $4DI $4RV $4r*   r   )'loggingoptparser   typingr   r   r   r   pip._vendor.packaging.versionr   pip._internal.clir	   pip._internal.cli.req_commandr
   pip._internal.cli.status_codesr   r   pip._internal.commands.searchr   pip._internal.exceptionsr   r   r   pip._internal.index.collectorr   "pip._internal.index.package_finderr   $pip._internal.models.selection_prefsr   "pip._internal.models.target_pythonr   pip._internal.network.sessionr   pip._internal.utils.miscr   	getLoggerr[   r2   r   rc   r*   r(   <module>rt      sY      0 0 1 ( ; 9 F Q Q 7 < E ; 4 1			8	$u4$ u4r*   