Rel8|UddlZddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z ddl mZmZddlmZddlmZddlmZddlmZmZdd lmZmZmZmZmZmZgd Z ej!e"Z#ej$%d rej&Z'nej(Z'e)ed d Z*e+e,d<ej-dkZ.de/fdZ0dee+e+fde/fdZ1ej2dde/fdZ3ej2dde/fdZ4ej2dde/fdZ5ej2dde/fdZ6de e+de e+fdZ7ej2ddej8dej8de+ddfdZ9dej8dej8de+de/fdZ:ej2dd dddd!d"e/d#e e+d$e e+d%e e+ddf d&Z; d4d'e+d"e/d#e e+d$e e+d(e/d%e e+defd)Zd,e+de/fd-Z?de+fd.Z@de+fd/ZAd0e+d1e+de e+fd2ZBd%e+de e+fd3ZCdS)5N)AnyDictIteratorListOptionalTuple) SCHEME_KEYSScheme)WINDOWS) deprecated)running_under_virtualenv) _distutils _sysconfig)USER_CACHE_DIRget_major_minor_versionget_src_prefixis_osx_framework site_packages user_site) rget_bin_prefix get_bin_userr get_platlibget_prefixed_libs get_purelib get_schemerrr"_PIP_LOCATIONS_NO_WARN_ON_MISMATCH platlibdirlib _PLATLIBDIR) returnc\ddlm} |dd}n#t$rYdSwxYw|dkS)zsThe resolution to bpo-44860 will change this incorrect platlib. See . rINSTALL_SCHEMES unix_userplatlibFz $usersite)distutils.command.installr&KeyError)r&unix_user_platlibs /builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/locations/__init__.py_looks_like_bpo_44860r-3s[ :99999+K8C uu  ++s  %%schemec|d}d|vr9ttdr$|ddtjd}d|vrdS|dd}|dd |d kS) Nr(z /$platlibdir/r/z/lib64/Fz/lib/z $platbase/z$base/purelib)hasattrsysreplacer)r.r( unpatcheds r,+_looks_like_red_hat_patched_platlib_purelibr6AsYG'!!gc<&@&@!///3Hs~3H3H3HIIu 733I   \8 4 4y8I II)maxsizecFddlmtfddDS)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. rr%c3JK|]}|vot|VdSN)r6).0kr&s r, z*_looks_like_red_hat_lib..SsT  _ L 78J K Kr7) unix_prefix unix_home)r)r&allr%s@r,_looks_like_red_hat_librBKsQ :99999 .  r7cddlm}d|vod|vS)z#Debian adds two additional schemes.rr% deb_system unix_local)r)r&r%s r,_looks_like_debian_schemerFZs+:99999 ? * N|/NNr7c<ddlm}ddlm}||}||jt jtjdko4|j t jtj dkS)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)rHdistutils.distrIfinalize_options exec_prefixospathnormpathr3prefix)rHrIcmds r,_looks_like_red_hat_schemerRbs211111++++++w||~~&&C bg..s??GGGG B JRW--cj99AAA Ar7cztjddtdfddDDS)aMSYS2 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)expandc3RK|]"}d|vod|vo|d V#dS)Librz site-packagesN)endswith)r<ps r,r>z1_looks_like_msys2_mingw_scheme..sW  QI5A:Iajj.I.I*Ir7c3(K|] }|V dSr;)r<keypathss r,r>z1_looks_like_msys2_mingw_scheme..s'??%*??????r7r(r1) sysconfig get_pathsrA)r]s@r,_looks_like_msys2_mingw_schemeravs]  U 3 3 3E ????(>???  r7partsc#Ktjd}ttdd}|r|r||s |Ed{VdS|D]5}||r|ddt |z }|V6dS)N LDVERSIONabiflagsr)r_get_config_vargetattrr3rXlen)rb ldversionreparts r, _fix_abiflagsrks(55ICT22H HI,>,>x,H,H == # # /-1s8}},-.D r7oldnewr\cVd}d}tt|||||dS)Nz(https://github.com/pypa/pip/issues/10151zSValue for %s does not match. Please report this to <%s> distutils: %s sysconfig: %s)loggerlog_MISMATCH_LEVEL)rlrmr\ issue_urlmessages r,_warn_mismatchedrts5:I   JJicBBBBBr7c:||krdSt|||dS)NFr\T)rt)rlrmr\s r,_warn_if_mismatchrws* czzuS#3'''' 4r7FuserhomerootrPryrzr{rPc|gd}ttd|||||dS)N)zAdditional context:z user = %rz home = %rz root = %rz prefix = %r )rorprqjoin)ryrzr{rPrbs r, _log_contextrsC   E JJ % 0 0$dFKKKKKr7 dist_nameisolatedc tj||||||}tr|Stj||||||g}tD]}t jt|} t jt||} | | krNtj j dkoK|duoG|dvoC| j | j ko3| j do| j d} | r|oGto9|dko3| j j | j ko| j j d} | r|dkrtr|o6|dko0t o(tjdkot"dko t%} | rR|p|p|p t' o| jd d d komt+| jd koU| jd d koDt+| jd kp| jd dkot-p t/}|rtjdko5t o-|dvo)t1t3| j| jk}|r6to|dvo t5}|rSt7jdo t o|dv}|rx|| | d|f|sStj||||||dt?fdtDrtAdddS|D]\} } }tC| | |tE||||S)N)ryrzr{rrPpypyr^pythonheadersr()r! rrr!)usrlocalrr)r!)rr(r1T) check_home)rinclude platincludezscheme.)ignore_config_filesc3LK|]}|t|kVdSr;)rg)r<r= default_oldrls r,r>zget_scheme..Os4 B B;q>WS!__ , B B B B B Br7zConfiguring 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 replacementgone_inrvrx)#rr_USE_SYSCONFIGrr pathlibPathrgr3implementationnameparent startswithrrBr version_infor r-r rbrhrRrFtuplerkrar_is_python_buildappenddistutils_schemeanyr rtr)rryrzr{rrPrmwarning_contextsr=old_vnew_vskip_pypy_special_case$skip_osx_framework_user_special_caseskip_bpo_44860skip_linux_system_special_caseskip_sysconfig_abiflag_bugskip_msys2_mingw_bugskip_cpython_buildr\rrls @@r,rrs         C         C d?d? WS!__-- WS!__-- E>>    #v - .D  .++ .  , . %%h//  .  %%f--  "    7 "" 7Y 7 #u|3 7 !,,X66 - 0   >>577>   (Y (  ( F* (u$  ( &''     EEE+C+E+E F N AaC $44 NEK  1$ N A%' NU[!!A%BQ7)B  N ,--L1J1L1L ' *    v % A  A66 AmEK0011U[@ # &    X33 X8V8X8X      % 6 6 6 ;  ;::    }}} =>>>>  -    K B B B B Bk B B BBB L   .00uc3/////dD@@@@ Jr7ctj}tr|Stj}t t j|t j|drt|S)N bin_prefixrv)rrrrrwrrrrmrls r,rrdsd  # % %C  # % %Cc**GL,=,=<PPP Jr7c8tjddjS)NT)ry)rrscriptsr[r7r,rros  $ / / / 77r7valuec6tsdS|dkrdSdS)aCheck 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)rF)rs r,$_looks_like_deb_system_dist_packagesrss- % & &u 000t 5r7ctj}tr|Stj}t |r|St t j|t j|drt|S)z,Return the default pure-Python lib location.r1rv) rrrrrrwrrrrs r,rry  " "C  " "C+C00 c**GL,=,=9MMM Jr7ctj}tr|Stj}t |r|St t j|t j|drt|S)z0Return the default platform-shared lib location.r(rv) rrrrrrwrrrrs r,rrrr7v1v2c||kr|gS||gS)zDeduplicate values from a list.r[)rrs r, _deduplicatedrs Rxxt 8Or7ctj|\}}trt||St j|\}}t t j|t j|dt t j|t j|dg}t|rt|t||S)z*Return the lib locations under ``prefix``.zprefixed-purelibrvzprefixed-platlib)rP) rrrrrrwrrrr)rPnew_purenew_platold_pureold_platwarneds r,rrs#5f==Hh1Xx000#5f==Hh  L " " L " ""    L " " L " ""   F 6{{$F#### 8 , ,,r7)FNNFN)D functoolsloggingrMrr3r_typingrrrrrrpip._internal.models.schemer r pip._internal.utils.compatr pip._internal.utils.deprecationr pip._internal.utils.virtualenvr rrrbaserrrrrr__all__ getLogger__name__roenvirongetDEBUGrqWARNINGrgr str__annotations__rrboolr-r6 lru_cacherBrFrRrarkrrtrwrrrrrrrrrr[r7r,rs  ================;;;;;;;;......666666CCCCCC$$$$$$$$     8 $ $:>>677&mOOoO73 e44 S444!W, ,t , , , ,JS#XJ4JJJJT"""    #" T"""O4OOO#"OT"""D#"&T"""#"" s      T"""C',CW\C3C4CCC#"C7<glCDT""" LLL L 3-L 3- L SM L  LLL#"L( ddd d 3-d 3- d  d SM d ddddN8c8888" S     S    cstCy-c-d3i------r7