
    ^iM7                    D   % S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SKJ	r	J
r
  S SKJr  S SKJr  S SKJr  SSKJr  SS	KJrJrJrJrJrJr  / S
Qr\R6                  " \5      r\" \SS5      rS\ S'   \RB                  S:  r"S$S jr#\#" 5       r$\$(       d  SSKJ%r%  \"(       a  \$(       d  \RL                  r'O\RP                  r'S$S jr)S%S jr*\RV                  S$S j5       r,\RV                  S$S j5       r-\RV                  S$S j5       r.\RV                  S$S j5       r/\RV                  S$S j5       r0\RV                  S&S j5       r1S'S jr2\RV                  SSSSS.         S(S jj5       r3     S)             S*S jjr4S+S jr5S+S  jr6S,S! jr7S+S" jr8S+S# jr9g)-    )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)   
   c                 >    [        [        [        S[        5      5      $ )a\  This function determines the value of _USE_SYSCONFIG.

By default, pip uses sysconfig on Python 3.10+.
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_SYSCONFIG)boolgetattr	sysconfig_USE_SYSCONFIG_DEFAULT     K/app/.venv/lib/python3.13/site-packages/pip/_internal/locations/__init__.py_should_use_sysconfigr%   /   s     	#79OPQQr#   
_distutilsc                 J    SSK Jn    U S   S   nUS:H  $ ! [         a     gf = f)zkThe 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_platlibs     r$   _looks_like_bpo_44860r0   M   s=    
 :+K8C ++  s    
""c                    U S   nSU;   a  UR                  SS[         S35      nSU;  a  gUR                  SS5      nUR                  SS5      U S	   :H  $ )
Nr,   z/$platlibdir///lib64/Fz/lib/z
$platbase/z$base/purelib)replacer   )schemer,   	unpatcheds      r$   +_looks_like_red_hat_patched_platlib_purelibr8   [   se    YG'!///Q{m13EF	73I\84y8IIIr#   c                 :   ^  SSK Jm   [        U 4S jS 5       5      $ )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  X   >#    U  H  nUT;   =(       a    [        TU   5      v   M!     g 7fN)r8   ).0kr*   s     r$   	<genexpr>*_looks_like_red_hat_lib.<locals>.<genexpr>m   s8       .A 	
_ 	L78JK	L-s   '*)unix_prefix	unix_home)r-   r*   allr)   s   @r$   _looks_like_red_hat_librC   e   s$     :  .  r#   c                 0    SSK Jn   SU ;   =(       a    SU ;   $ )z#Debian adds two additional schemes.r   r)   
deb_system
unix_local)r-   r*   r)   s    r$   _looks_like_debian_schemerG   t   s     :?*N|/NNr#   c                 V   SSK Jn   SSKJn  U " U" 5       5      nUR	                  5         UR
                  [        R                  R                  [        R
                  5       S3:H  =(       a=    UR                  [        R                  R                  [        R                  5       S3:H  $ )aH  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-   rI   distutils.distrJ   finalize_optionsexec_prefixospathnormpathsysprefix)rI   rJ   cmds      r$   _looks_like_red_hat_schemerT   |   s{     2+
,.
!Cbgg..s?@GG 	BJJRWW--cjj9:&AAr#   c                     [         c  g [        R                  " SSS9n SU S   ;   =(       a	    S[         ;  $ ! [         a     gf = f)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.
F
posix_user)r6   expandr3   r4   )r   r    	get_pathsr.   pathss    r$   _looks_like_slackware_schemer[      sT     ##<F i((GYi-GG  s   7 
AAc                 f   ^  [         R                  " SSS9m [        S U 4S jS 5        5       5      $ )aq  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)rW   c              3  ~   #    U  H3  nS U;  =(       a"    SU;   =(       a    UR                  S5      (       + v   M5     g7f)Libr   zsite-packagesN)endswith)r<   ps     r$   r>   1_looks_like_msys2_mingw_scheme.<locals>.<genexpr>   s8      ?A 	QI5A:Iajj.I*II?s   ;=c              3  .   >#    U  H
  nTU   v   M     g 7fr;   r"   )r<   keyrZ   s     r$   r>   rb      s     ?(>%*(>s   r,   r4   )r    rX   rB   rY   s   @r$   _looks_like_msys2_mingw_schemerf      s7     U3E ?(>?  r#   c               D    SnSn[         R                  [        XBX0U5        g )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)oldnewrd   	issue_urlmessages        r$   _warn_mismatchedro      s%    :I	 
 JJicBr#   c               $    X:X  a  g[        XUS9  g)NFrd   T)ro   )rk   rl   rd   s      r$   _warn_if_mismatchrr      s    
zS3'r#   FuserhomerootrR   c                b    / SQn[         R                  [        SR                  U5      XX#5        g )N)zAdditional context:z	user = %rz	home = %rz	root = %rzprefix = %r
)rh   ri   rj   join)rt   ru   rv   rR   partss        r$   _log_contextr{      s&    E JJ		% 0$dKr#   c           
     L  ^^ [         R                  " U UUUUUS9n[        (       a  U$ [        R                  " U UUUUUS9m/ n[         GHf  n[
        R                  " [        TU5      5      n	[
        R                  " [        Xh5      5      n
X:X  a  MJ  [        R                  R                  S:H  =(       at    US L=(       ai    US;   =(       a]    U	R                  U
R                  :H  =(       a=    U	R                  R                  S5      =(       a    U
R                  R                  S5      nU(       a  M  U=(       al    [        5       =(       a[    US:H  =(       aO    U	R                  R                  U
R                  :H  =(       a%    U	R                  R                  R                  S5      nU(       a  GMj  US:X  a  [        5       (       a  GM  U=(       a8    US:H  =(       a,    [        (       + =(       a    [         S:g  =(       a
    [#        5       nU(       a  GM  U=(       a(    US;   =(       a    [        (       + =(       a
    [%        5       nU(       a  GM  U=(       d    U=(       d    U=(       d
    ['        5       (       + =(       a    U	R(                  SS	 S
:H  =(       a    [+        U
R(                  5      S:  =(       al    U
R(                  S   S:H  =(       aS    [+        U
R(                  5      S	:  =(       d    U
R(                  S   S:g  =(       a    [-        5       =(       d
    [/        5       nU(       a  GM  [        =(       a    US;   =(       a
    [1        5       nU(       a  GM  [2        R4                  " SS9=(       a    [        (       + =(       a    US;   nU(       a  GMP  UR7                  XSU 345        GMi     U(       d  T$ [        R8                  " U UUUUUSS9m[;        UU4S j[         5       5      (       a  [=        SS S S9  T$ U H  u  pn[?        XUS9  M     [A        XX5S9  T$ )N)rt   ru   rv   isolatedrR   pypyre   pythonheadersr,   r   r	   r   )usrlocalr      r   T)
check_home)r   includeplatincludezscheme.)ignore_config_filesc              3  H   >#    U  H  nTU   [        TU5      :g  v   M     g 7fr;   )r   )r<   r=   default_oldrk   s     r$   r>   get_scheme.<locals>.<genexpr>h  s      
Bk;q>WS!_,ks   "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_inrq   rs   )!r
   r   _USE_SYSCONFIGr'   r   pathlibPathr   rQ   implementationnameparent
startswithr   rC   r   r   r0   r[   r   rz   lenrT   rG   rf   r    is_python_buildappenddistutils_schemeanyr   ro   r{   )	dist_namert   ru   rv   r}   rR   rl   warning_contextsr=   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_buildrd   r   rk   s                      @@r$   r   r      s    

C ~



C [WS!_-WS_-> ##v- .D .++. ,. 

%%h/	.
 

%%f- 	 "  7 "7Y7 ##u||37 !!,,X6 	- 0 	>577  (Y(( u$( &' 	 
  /++// -.	 	# & EEE+C+EF NAa $44NEKK 1$N A%'N U[[!A%BQ7)B	N
 ,-L1J1L 	' *
 X33X8V8X 	   %%6 ;;:: 	
 } =>G J 

 -- K 
Bk
BBBL
 		
 
 .c3/ .dD@Jr#   c                     [         R                  " 5       n [        (       a  U $ [        R                  " 5       n[	        [
        R                  " U5      [
        R                  " U 5      SS9(       a
  [        5         U$ )N
bin_prefixrq   )r
   r   r   r'   rr   r   r   r{   rl   rk   s     r$   r   r   }  sP    

#
#
%C~


#
#
%Cc*GLL,=<PJr#   c                 @    [         R                  " SSS9R                  $ )N T)rt   )r
   r   scriptsr"   r#   r$   r   r     s      $/777r#   c                2    [        5       (       d  gU S:X  a  gg)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)rG   )values    r$   $_looks_like_deb_system_dist_packagesr     s     %&&00r#   c                    [         R                  " 5       n [        (       a  U $ [        R                  " 5       n[	        U5      (       a  U$ [        [        R                  " U5      [        R                  " U 5      SS9(       a
  [        5         U$ )z,Return the default pure-Python lib location.r4   rq   )	r
   r   r   r'   r   rr   r   r   r{   r   s     r$   r   r     s`    

 
 
"C~


 
 
"C+C00
c*GLL,=9MJr#   c                     [         R                  " 5       n [        (       a  U $ SSKJn  UR                  " 5       n[        U5      (       a  U$ [        [        R                  " U5      [        R                  " U 5      SS9(       a
  [        5         U$ )z0Return the default platform-shared lib location.r	   r&   r,   rq   )
r
   r   r   r   r'   r   rr   r   r   r{   )rl   r'   rk   s      r$   r   r     sc    

 
 
"C~


 
 
"C+C00
c*GLL,=9MJr#   )returnr   )r6   zdict[str, str]r   r   )rk   pathlib.Pathrl   r   rd   r   r   None)rk   r   rl   r   rd   r   r   r   )
rt   r   ru   
str | Nonerv   r   rR   r   r   r   )FNNFN)r   r   rt   r   ru   r   rv   r   r}   r   rR   r   r   r   )r   r   )r   r   r   r   ):
__future__r   	functoolsloggingrN   r   rQ   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__rh   r   r   __annotations__version_infor!   r%   r   r'   WARNINGrj   DEBUGr0   r8   cacherC   rG   rT   r[   rf   ro   rr   r{   r   r   r   r   r   r   r"   r#   r$   <module>r      s    "   	  
  ; . 6 C   
		8	$ 3e4S 4))W4 R '(  .ooOmmO,J   O O  & H H  " C C  L
L L 	L
 L 
L L( cc
c c 	c
 c c cL8"r#   