o
    5d                     @   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| ||< qd|	dv r|t|j|jd t r|r|}n	|r|j}n|j}tj|dddt  | |d< |d
urt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!   yC:\Users\jesus\OneDrive\Desktop\erpjis_fastapi\backend\jisbackend\Lib\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
#