U .e&@sdZddlmZddlZddlZddlZddlZddlZddlZddl mZ ddl m Z ddl mZddlmZddlmZdd lmZerdd lmZmZmZmZmZed Zd d ZddZedZ e!"dkre #Z z e$Z%Wne&k r ej'Z%YnXer`ej()ej*dZ+ej()e%dZ,ej(-e+sej()ej*dZ+ej()e%dZ,nJej()ej*dZ+ej()e%dZ,ejdddkrej*dddkrdZ+dddZ.dS)z7Locations where we look for configs, install stuff, etc)absolute_importN) sysconfig) SCHEME_KEYS)appdirs)WINDOWS)MYPY_CHECK_RUNNING)running_under_virtualenv)AnyUnionDictListOptionalZpipcCs djtjS)ze Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". z{}.{})formatsys version_inforr;/usr/lib/python3.8/site-packages/pip/_internal/locations.pyget_major_minor_versionsrcCsZtrtjtjd}n6ztjtd}Wntk rLtdYnXtj |S)Nsrcz=The folder you are executing pip from can no longer be found.) rospathjoinrprefixgetcwdOSErrorexitabspath)Z src_prefixrrrget_src_prefix(s rpurelibZpypyZScriptsbindarwinz/System/Library/z/usr/local/binFcCsHddlm}i}|r ddgi}ni}d|i} | ||| } | | jddd} |p\| j| _|sh|rnd | _|pv| j| _|p| j| _|p| j| _| t D]} t | d | || <qd | dkr|t | j| jd trDtjtjd ddt||d<|dk rDtjtj|dd} tj|| dd|d<|S)z+ Return a distutils install scheme r) DistributionZ script_argsz --no-user-cfgnameZinstallT)ZcreateZinstall_ install_lib)rZplatlibZincludesitezpython{}ZheadersN)Zdistutils.distr#updateZparse_config_filesZget_command_objuserrhomerootZfinalize_optionsrgetattrZget_option_dictdictr&rrrrrrr splitdriver)Z dist_namer*r+r,isolatedrr#ZschemeZextra_dist_argsZ dist_argsdikeyZ path_no_driverrrdistutils_scheme[sP           r4)FNNFN)/__doc__Z __future__rrZos.pathplatformr'rrZ distutilsZdistutils_sysconfigZdistutils.command.installrZpip._internal.utilsrZpip._internal.utils.compatrZpip._internal.utils.typingrZpip._internal.utils.virtualenvrtypingr r r r r Zuser_cache_dirZUSER_CACHE_DIRrrZget_pathZ site_packagesZpython_implementationlowerZget_python_libgetusersitepackages user_siteAttributeError USER_SITErrrZbin_pyZbin_userexistsr4rrrrsN            (