o 7]h@spdZddlZddlZddlZddlmZddlmZddlm Z ddl m Z ddl mZmZmZmZmZmZddlmZdd lmZdd lmZd d lmZeeZ   d#d ddede dedede dede deeeffddZ!   d#dede deedeede deedefddZ"defddZ#defddZ$defdd Z%dedeeeffd!d"Z&dS)$z7Locations where we look for configs, install stuff, etcN)Command) SCHEME_KEYS)installget_python_lib)DictListOptionalTupleUnioncast)Scheme)WINDOWS)running_under_virtualenv)get_major_minor_versionF)ignore_config_files dist_nameuserhomerootisolatedprefixrreturnc Csddlm}d|i}|rdg|d<||} |s9z| Wnty8| } tdddd | DYnwd } | jd d d } | d usHJt t | } |r[|r[Jd|d||ri|riJd|d||pm| j | _ |ss|rvd| _ |pz| j | _ |p| j | _ |p| j| _| i} tD] }t| d|| |<qd| d vr| t| j| jdtr|r|}n |r| j}n| j }tj|dddt|| d<|d urtjtj| dd}tj||dd | d<| S)z+ Return a distutils install scheme r) Distributionnamez --no-user-cfg script_argsz6Ignore distutils configs in %s due to encoding errors.z, css|] }tj|VqdS)N)ospathbasename).0pr"D/usr/lib/python3/dist-packages/pip/_internal/locations/_distutils.py 4sz#distutils_scheme..NrT)createzuser=z prefix=zhome=install_ install_lib)purelibplatlibincludesitepythonheadersr)distutils.distrparse_config_filesUnicodeDecodeErrorfind_config_filesloggerwarningjoinget_command_objr distutils_install_commandrrrrfinalize_optionsrgetattrget_option_dictupdatedictr(rinstall_userbaserrr splitdriveabspath)rrrrrrrr dist_argsdpathsobjischemekey path_no_driver"r"r#distutils_schemesd           rHcCs8t||||||}t|d|d|d|d|ddS)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.scriptsdata)r*r)r.rIrJ)rHr )rrrrrrrEr"r"r# get_schemeisrKcCsrtjtj}trtj|d}tj|stj|d}|Stjdddkr2|dddkr2dStj|dS)NScriptsbindarwinz/System/Library/z/usr/local/bin) rrnormpathsysrrr5existsplatform)rbin_pyr"r"r#get_bin_prefixs "rVcC tddS)NF plat_specificrr"r"r"r# get_purelib rZcCrW)NTrXrr"r"r"r# get_platlibr[r\cCstd|dtd|dfS)NF)rYrTr)rr"r"r#get_prefixed_libss  r])FNNFN)'__doc__loggingrrR distutils.cmdrDistutilsCommanddistutils.command.installrrr7distutils.sysconfigrtypingrrr r r r pip._internal.models.schemer pip._internal.utils.compatrpip._internal.utils.virtualenvrbaser getLogger__name__r3strboolrHrKrVrZr\r]r"r"r"r#s|           S #