o
    “si€  ã                   @   s˜  d Z zedƒ ¡  W n eefy   Y nw ddlZddlZddl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mZ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 e  e!¡Z"					d$ddœde#de$de#de#de$de#de$dee#e#f fdd„Z%					d$de#de$dee# dee# de$dee# defdd„Z&de#fdd„Z'de#fdd„Z(de#fd d!„Z)de#dee#e#f fd"d#„Z*dS )%z7Locations where we look for configs, install stuff, etcZ_distutils_hacké    N)ÚCommand)ÚSCHEME_KEYS)Úinstall©Úget_python_lib)ÚDictÚListÚOptionalÚTupleÚUnionÚcast)ÚScheme)ÚWINDOWS)Úrunning_under_virtualenvé   )Úget_major_minor_versionF)Úignore_config_filesÚ	dist_nameÚuserÚhomeÚrootÚisolatedÚprefixr   Úreturnc             
   C   sà  ddl m} d| i}|rdg|d< ||ƒ}	|s9z|	 ¡  W n ty8   |	 ¡ }
t dd dd	„ |
D ƒ¡¡ Y nw d
}|	jddd�}|d
usHJ ‚t	t
|ƒ}|r[|r[J d|› d|› �ƒ‚|ri|riJ d|› d|› �ƒ‚|pm|j|_|ss|rvd|_|pz|j|_|p€|j|_|p†|j|_| ¡  i }tD ]}t|d| ƒ||< q�d|	 d¡v r®| t|j|jd�¡ tƒ rî|r¶|}n	|r¼|j}n|j}tj |dddtƒ › �| ¡|d< |d
urîtj tj |d ¡¡d }tj ||dd
… ¡|d< |S )z+
    Return a distutils install scheme
    r   )ÚDistributionÚnamez--no-user-cfgZscript_argsz6Ignore distutils configs in %s due to encoding errors.z, c                 s   s   � | ]	}t j |¡V  qd S )N)ÚosÚpathÚbasename)Ú.0Úp© r!   úqC:\Users\PC\students\dividedattentionclub\venv\lib\python3.10\site-packages\pip/_internal/locations/_distutils.pyÚ	<genexpr>?   s   € z#distutils_scheme.<locals>.<genexpr>Nr   T)Úcreatezuser=z prefix=zhome=Ú Zinstall_Úinstall_lib)ÚpurelibÚplatlibÚincludeÚsiteÚpythonÚheadersr   )Údistutils.distr   Zparse_config_filesÚUnicodeDecodeErrorZfind_config_filesÚloggerÚwarningÚjoinZget_command_objr   Údistutils_install_commandr   r   r   r   Úfinalize_optionsr   ÚgetattrZget_option_dictÚupdateÚdictr&   r   Zinstall_userbaser   r   r   Ú
splitdriveÚabspath)r   r   r   r   r   r   r   r   Z	dist_argsÚdÚpathsÚobjÚiÚschemeÚkeyZpath_no_driver!   r!   r"   Údistutils_scheme#   sd   
þý

ûr?   c                 C   s8   t | |||||ƒ}t|d |d |d |d |d d�S )a;  
    Get the "scheme" corresponding to the input parameters. The distutils
    documentation provides the context for the available schemes:
    https://docs.python.org/3/install/index.html#alternate-installation

    :param dist_name: the name of the package to retrieve the scheme for, used
        in the headers scheme path
    :param user: indicates to use the "user" scheme
    :param home: indicates to use the "home" scheme and provides the base
        directory for the same
    :param root: root under which other directories are re-based
    :param isolated: equivalent to --no-user-cfg, i.e. do not consider
        ~/.pydistutils.cfg (posix) or ~/pydistutils.cfg (non-posix) for
        scheme paths
    :param prefix: indicates to use the "prefix" scheme and provides the
        base directory for the same
    r(   r'   r,   ÚscriptsÚdata)r(   r'   r,   r@   rA   )r?   r   )r   r   r   r   r   r   r=   r!   r!   r"   Ú
get_schemet   s   ûrB   c                  C   sr   t j tj¡} trt j | d¡}t j |¡st j | d¡}|S tjd d… dkr2| d d… dkr2dS t j | d¡S )NÚScriptsÚbiné   Údarwiné   z/System/Library/z/usr/local/bin)	r   r   ÚnormpathÚsysr   r   r1   ÚexistsÚplatform)r   Zbin_pyr!   r!   r"   Úget_bin_prefix—   s   "rL   c                   C   ó
   t dd�S )NF©Úplat_specificr   r!   r!   r!   r"   Úget_purelib¨   ó   
rP   c                   C   rM   )NTrN   r   r!   r!   r!   r"   Úget_platlib¬   rQ   rR   c                 C   s   t d| d�t d| d�fS )NF)rO   r   Tr   )r   r!   r!   r"   Úget_prefixed_libs°   s   

þrS   )FNNFN)+Ú__doc__Ú
__import__Zremove_shimÚImportErrorÚAttributeErrorÚloggingr   rI   Zdistutils.cmdr   ZDistutilsCommandÚdistutils.command.installr   r   r2   Údistutils.sysconfigr   Útypingr   r   r	   r
   r   r   Úpip._internal.models.schemer   Úpip._internal.utils.compatr   Úpip._internal.utils.virtualenvr   Úbaser   Ú	getLoggerÚ__name__r/   ÚstrÚboolr?   rB   rL   rP   rR   rS   r!   r!   r!   r"   Ú<module>   s†    ÿ 
úøÿþýüûúø
	
÷Súÿþýüûú
ù#