a
    ӗa                     @   s   d dl Z d dl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gZ
dZdZd	ed
fded
fgZdddZdd Zdd Zdddddd dddZdddddd dddZd dddZdddZdS )    N)	resources   )_bundledversion	bootstrapz58.1.0z21.2.4Z
setuptoolsZpy3pipc                 C   s.   d|pg  d|  d}t jtjd|gddjS )Nz$
import runpy
import sys
sys.path = z + sys.path
sys.argv[1:] = z>
runpy.run_module("pip", run_name="__main__", alter_sys=True)
z-cT)Zcheck)
subprocessrunsys
executable
returncode)argsadditional_pathscode r   5/home/manager/Python-3.9.10/Lib/ensurepip/__init__.py_run_pip   s    r   c                   C   s   t S )zA
    Returns a string specifying the bundled version of pip.
    )_PIP_VERSIONr   r   r   r   r   %   s    c                  C   s2   dd t jD } | D ]}t j|= qt jt jd< d S )Nc                 S   s   g | ]}| d r|qS )ZPIP_)
startswith).0kr   r   r   
<listcomp>/       z7_disable_pip_configuration_settings.<locals>.<listcomp>ZPIP_CONFIG_FILE)osenvirondevnull)Zkeys_to_remover   r   r   r   #_disable_pip_configuration_settings+   s    
r   Frootupgradeuser
altinstalldefault_pip	verbosityc                 C   s   t | |||||d dS )z
    Bootstrap pip into the current Python installation (or the given root
    directory).

    Note that calling this function will alter both sys.path and os.environ.
    r   N)
_bootstrapr   r   r   r   r   7   s    
c              
   C   s\  |r|rt dtd|  t  |r2dtjd< n|s@dtjd< t  }g }tD ]v\}}	}
d	||	|
}t
t|}ttj||d}|| W d   n1 s0    Y  |tj|| qTdd	d
d|g}| r|d| g7 }|r|dg7 }|r|dg7 }|r |dd|  g7 }t|dd tD  |W  d   S 1 sN0    Y  dS )z
    Bootstrap pip into the current Python installation (or the given root
    directory). Returns pip command status code.

    Note that calling this function will alter both sys.path and os.environ.
    z.Cannot use altinstall and default_pip togetherzensurepip.bootstrapr!   ZENSUREPIP_OPTIONSZinstallz{}-{}-{}-none-any.whlwbNz--no-cache-dirz
--no-indexz--find-links--root	--upgrade--user-vc                 S   s   g | ]}|d  qS r   r   r   pr   r   r   r   }   r   z_bootstrap.<locals>.<listcomp>)
ValueErrorr
   auditr   r   r   tempfileZTemporaryDirectory	_PROJECTSformatr   Zread_binaryr   openpathjoinwriteappendr   )r   r   r    r!   r"   r#   Ztmpdirr   Zprojectr   Zpy_tagZ
wheel_nameZwhlfpr   r   r   r   r$   F   s:    	
(

r$   )r#   c                 C   s   zddl }W n ty    Y dS 0 |jtkrLd}t||jttjd dS t  g d}| rp|dd|   g7 }t	|dd	 t
tD  S )
z~Helper to support a clean default uninstall process on Windows

    Note that calling this function may alter os.environ.
    r   NzOensurepip will only uninstall a matching version ({!r} installed, {!r} bundled))file)Z	uninstallz-yz--disable-pip-version-checkr)   r*   c                 S   s   g | ]}|d  qS r+   r   r,   r   r   r   r      r   z%_uninstall_helper.<locals>.<listcomp>)r   ImportError__version__r   printr2   r
   stderrr   r   reversedr1   )r#   r   msgr   r   r   r   _uninstall_helper   s    
r@   c                 C   s   dd l }|jdd}|jdddt dd |jd	d
ddddd |jdddddd |jddddd |jdd dd |jddddd |jddddd || }t|j|j|j	|j
|j|jdS )Nr   zpython -m ensurepip)Zprogz	--versionr   zpip {}z9Show the version of pip that is bundled with this Python.)actionr   helpz-vz	--verbosecountr#   zDGive more output. Option is additive, and can be used up to 3 times.)rA   defaultZdestrB   z-Ur'   Z
store_trueFz8Upgrade pip and dependencies, even if already installed.)rA   rD   rB   r(   zInstall using the user scheme.r&   z=Install everything relative to this alternate root directory.)rD   rB   z--altinstallzoMake an alternate install, installing only the X.Y versioned scripts (Default: pipX, pipX.Y, easy_install-X.Y).z--default-pipzqMake a default pip install, installing the unqualified pip and easy_install in addition to the versioned scripts.)r   r   r    r#   r!   r"   )argparseZArgumentParserZadd_argumentr2   r   Z
parse_argsr$   r   r   r    r#   r!   r"   )argvrE   Zparserr   r   r   r   _main   sj    

rG   )N)N)r   Zos.pathr
   Zrunpyr0   r   	importlibr    r   __all__Z_SETUPTOOLS_VERSIONr   r1   r   r   r   r   r$   r@   rG   r   r   r   r   <module>   s4   
9