o
    i                     @  s   d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 ddej
j dej
j dej
j gZe	rGddhZd	d
 eeeD ZddddZdddZdddZdS )    )annotationsN)main)WINDOWSZpip. z.exec                 C  s   g | ]}d  |qS )r   )join).0parts r
   ?lib/python3.10/site-packages/pip/_internal/utils/entrypoints.py
<listcomp>   s    r   argslist[str] | Nonereturnintc                 C  s   t jd t| S )a  Central wrapper for all old entrypoints.

    Historically pip has had several entrypoints defined. Because of issues
    arising from PATH, sys.path, multiple Pythons, their interactions, and most
    of them having a pip installed, users suffer every time an entrypoint gets
    moved.

    To alleviate this pain, and provide a mechanism for warning users and
    directing them to an appropriate place for help, we now define all of
    our old entrypoints as wrappers for the current one.
    a  WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
)sysstderrwriter   )r   r
   r
   r   _wrapper   s   r   strc                  C  s   t rdnd} tjtj| }tjtjdd	tj
}tj||v }|rKtD ]!}t|}tj||}|rJtj|rJtj||rJ|  S q)t  dS )zHTry to figure out the best way to invoke pip in the current environment.ZScriptsbinPATHr   z -m pip)r   ospathr   r   prefixnormcaseenvirongetsplitpathsep_EXECUTABLE_NAMESshutilwhichexistssamefile#get_best_invocation_for_this_python)Zbinary_directoryZbinary_prefix
path_partsZexe_are_in_PATHexe_namefound_executableZbinary_executabler
   r
   r    get_best_invocation_for_this_pip/   s(   

r)   c                  C  sB   t j} tj| }t|}|rtjt|t| r|S | S )z<Try to figure out the best way to invoke the current Python.)	r   
executabler   r   basenamer!   r"   samestatlstat)Zexer'   r(   r
   r
   r   r%   J   s   
r%   )N)r   r   r   r   )r   r   )Z
__future__r   	itertoolsr   r!   r   Zpip._internal.cli.mainr   Zpip._internal.utils.compatr   version_infomajorminorr    Z_allowed_extensionsproductr   r)   r%   r
   r
   r
   r   <module>   s&    

