o
    j6                     @  s  U d dl mZ 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	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mZmZmZmZmZ g d
ZeeZeeddZde d< dFddZ!e! Z"e"srddlm#Z# e"rxej$Z%nej&Z%dFddZ'dGddZ(ej)dFddZ*ej)dFddZ+ej)dFddZ,ej)dFd d!Z-ej)dFd"d#Z.ej)dHd)d*Z/dId+d,Z0ej)d-dddd.dJd4d5Z1	-			-	dKdLd9d:Z2dMd;d<Z3dMd=d>Z4dNd@dAZ5dMdBdCZ6dMdDdEZ7dS )O    )annotationsN)SCHEME_KEYSScheme)WINDOWS)
deprecated)running_under_virtualenv   )
_sysconfig)USER_CACHE_DIRget_major_minor_versionget_src_prefixis_osx_frameworksite_packages	user_site)
r
   get_bin_prefixget_bin_userr   get_platlibget_purelib
get_schemer   r   r   
platlibdirlibstr_PLATLIBDIRreturnboolc                   C  s   t ttddS )ah  This function determines the value of _USE_SYSCONFIG.

    By default, pip uses sysconfig.
    But Python distributors can override this decision by setting:
        sysconfig._PIP_USE_SYSCONFIG = True / False
    Rationale in https://github.com/pypa/pip/issues/10647

    This is a function for testability, but should be constant during any one
    run.
    _PIP_USE_SYSCONFIGT)r   getattr	sysconfig r   r   a/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/pip/_internal/locations/__init__.py_should_use_sysconfig-   s   r    
_distutilsc                  C  s8   ddl m}  z| d d }W |dkS  ty   Y dS w )zsThe resolution to bpo-44860 will change this incorrect platlib.

    See <https://bugs.python.org/issue44860>.
    r   INSTALL_SCHEMES	unix_userplatlibFz	$usersite)distutils.command.installr$   KeyError)r$   unix_user_platlibr   r   r   _looks_like_bpo_44860K   s   r*   schemedict[str, str]c                 C  sP   | d }d|v r| ddt d}d|vrdS | dd}| dd| d	 kS )
Nr&   z/$platlibdir///lib64/Fz/lib/z
$platbase/z$base/purelib)replacer   )r+   r&   	unpatchedr   r   r   +_looks_like_red_hat_patched_platlib_purelibY   s   r2   c                     s"   ddl m  t fdddD S )zRed Hat patches platlib in unix_prefix and unix_home, but not purelib.

    This is the only way I can see to tell a Red Hat-patched Python.
    r   r#   c                 3  s$    | ]}| v ot  | V  qd S N)r2   .0kr#   r   r   	<genexpr>k   s    

z*_looks_like_red_hat_lib.<locals>.<genexpr>)unix_prefix	unix_home)r'   r$   allr   r   r#   r   _looks_like_red_hat_libc   s   r;   c                  C  s   ddl m}  d| v od| v S )z#Debian adds two additional schemes.r   r#   
deb_system
unix_local)r'   r$   r#   r   r   r   _looks_like_debian_schemer   s   r>   c                  C  s^   ddl m}  ddlm} | | }|  |jtjt	j dko.|j
tjt	j
 dkS )a\  Red Hat patches ``sys.prefix`` and ``sys.exec_prefix``.

    Red Hat's ``00251-change-user-install-location.patch`` changes the install
    command's ``prefix`` and ``exec_prefix`` to append ``"/local"``. This is
    (fortunately?) done quite unconditionally, so we create a default command
    object without any configuration to detect this.
    r   )install)Distributionz/local)r'   r?   distutils.distr@   finalize_optionsexec_prefixospathnormpathsysprefix)r?   r@   cmdr   r   r   _looks_like_red_hat_schemez   s   	
rJ   c                  C  sH   t du rdS z	tjddd} W n
 ty   Y dS w d| d v o#dt vS )zSlackware patches sysconfig but fails to patch distutils and site.

    Slackware changes sysconfig's user scheme to use ``"lib64"`` for the lib
    path, but does not do the same to the site module.
    NF
posix_user)r+   expandr.   r/   )r   r   	get_pathsr(   pathsr   r   r   _looks_like_slackware_scheme   s   rP   c                     s.   t jddd tdd  fdddD D S )a  MSYS2 patches distutils and sysconfig to use a UNIX-like scheme.

    However, MSYS2 incorrectly patches sysconfig ``nt`` scheme. The fix is
    likely going to be included in their 3.10 release, so we ignore the warning.
    See msys2/MINGW-packages#9319.

    MSYS2 MINGW's patch uses lowercase ``"lib"`` instead of the usual uppercase,
    and is missing the final ``"site-packages"``.
    ntF)rL   c                 s  s,    | ]}d |vod|v o| d V  qdS )Libr   zsite-packagesN)endswith)r5   pr   r   r   r7      s
    
z1_looks_like_msys2_mingw_scheme.<locals>.<genexpr>c                 3  s    | ]} | V  qd S r3   r   )r5   keyrN   r   r   r7      s    r&   r/   )r   rM   r:   r   r   rN   r   _looks_like_msys2_mingw_scheme   s   rW   oldpathlib.PathnewrU   Nonec                C  s    d}d}t t|||| | d S )Nz(https://github.com/pypa/pip/issues/10151zSValue for %s does not match. Please report this to <%s>
distutils: %s
sysconfig: %s)loggerlog_MISMATCH_LEVEL)rX   rZ   rU   	issue_urlmessager   r   r   _warn_mismatched   s   ra   c                C  s   | |krdS t | ||d dS )NFrU   T)ra   )rX   rZ   rU   r   r   r   _warn_if_mismatch   s   rc   FuserhomerootrH   re   rf   
str | Nonerg   rH   c                 C  s&   g d}t td|| ||| d S )N)zAdditional context:z	user = %rz	home = %rz	root = %rzprefix = %r
)r\   r]   r^   join)re   rf   rg   rH   partsr   r   r   _log_context   s   rl   	dist_nameisolatedr   c              	     sz  t j| |||||d}tr|S tj| |||||dg }tD ]}tt|}	tt||}
|	|
kr5qtj	j
dkoT|d uoT|dv oT|	j|
jkoT|	j
doT|
j
d}|rXq|ont on|dkon|	jj|
jkon|	jj
d}|rrq|dkrzt rzq|o|dkot otdkot }|rq|o|dv ot ot }|rq|p|p|pt  o|	jdd	 d
kot|
jdko|
jd dkot|
jd	k p|
jd dkot pt }|rqto|dv ot }|rqtjddot o|dv }|rq||	|
d| f q|sS tj| |||||dd t fddtD r#tdd d d S |D ]\}	}
}t|	|
|d q%t ||||d S )N)re   rf   rg   rn   rH   pypyrV   pythonheadersr&   r   r      )usrlocalrs      rt   T)
check_home)rq   includeplatincludezscheme.)ignore_config_filesc                 3  s"    | ]} | t |kV  qd S r3   )r   r4   default_oldrX   r   r   r7   f  s     zget_scheme.<locals>.<genexpr>zConfiguring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621)reasonreplacementgone_inrb   rd   )!r	   r   _USE_SYSCONFIGr"   r   pathlibPathr   rG   implementationnameparent
startswithr   r;   r   r   r*   rP   r   rk   lenrJ   r>   rW   r   is_python_buildappenddistutils_schemeanyr   ra   rl   )rm   re   rf   rg   rn   rH   rZ   warning_contextsr6   old_vnew_vskip_pypy_special_case$skip_osx_framework_user_special_caseskip_bpo_44860skip_slackware_user_schemeskip_linux_system_special_caseskip_msys2_mingw_bugskip_cpython_buildrU   r   rz   r   r      s   	



	
r   c                  C  s<   t  } tr| S t }tt|t| ddrt  |S )N
bin_prefixrb   )r	   r   r   r"   rc   r   r   rl   rZ   rX   r   r   r   r   {  s   r   c                   C  s   t jdddjS )N T)re   )r	   r   scriptsr   r   r   r   r     s   r   valuec                 C  s   t  sdS | dkrdS dS )a  Check if the value is Debian's APT-controlled dist-packages.

    Debian's ``distutils.sysconfig.get_python_lib()`` implementation returns the
    default package path controlled by APT, but does not patch ``sysconfig`` to
    do the same. This is similar to the bug worked around in ``get_scheme()``,
    but here the default is ``deb_system`` instead of ``unix_local``. Ultimately
    we can't do anything about this Debian bug, and this detection allows us to
    skip the warning when needed.
    Fz/usr/lib/python3/dist-packagesT)r>   )r   r   r   r   $_looks_like_deb_system_dist_packages  s
   
r   c                  C  sH   t  } tr| S t }t|r|S tt|t| ddr"t  |S )z,Return the default pure-Python lib location.r/   rb   )	r	   r   r   r"   r   rc   r   r   rl   r   r   r   r   r     s   r   c                  C  sT   t  } tr| S ddlm} | }t|r|S tt|t| ddr(t	  |S )z0Return the default platform-shared lib location.r   r!   r&   rb   )
r	   r   r   r   r"   r   rc   r   r   rl   )rZ   r"   rX   r   r   r   r     s   r   )r   r   )r+   r,   r   r   )rX   rY   rZ   rY   rU   r   r   r[   )rX   rY   rZ   rY   rU   r   r   r   )
re   r   rf   rh   rg   rh   rH   rh   r   r[   )FNNFN)rm   r   re   r   rf   rh   rg   rh   rn   r   rH   rh   r   r   )r   r   )r   r   r   r   )8
__future__r   	functoolsloggingrD   r   rG   r   pip._internal.models.schemer   r   pip._internal.utils.compatr   pip._internal.utils.deprecationr   pip._internal.utils.virtualenvr   r   r	   baser
   r   r   r   r   r   __all__	getLogger__name__r\   r   r   __annotations__r    r   r"   DEBUGr^   WARNINGr*   r2   cacher;   r>   rJ   rP   rW   ra   rc   rl   r   r   r   r   r   r   r   r   r   r   <module>   sp     	






 
'


