3 Pf @sdZddlmZddlZddlZddlZddlZddlmZddl m Z m Z ddl m Z mZddlmZejdZd Zd Zd d Zd dZddZerejjejdZn6yejjejdZWnek rejdYnXejjeZej Z!ej"Z#edZ$e rtejjejdZ%ejje#dZ&ejj'e%sRejjejdZ%ejje#dZ&dZ(ejje$dZ)ejje)e(Z*njejjejdZ%ejje#dZ&dZ(ejje$dZ)ejje)e(Z*ej+dddkrejdddkrdZ%ddej,dDZ-d#d!d"Z.dS)$z7Locations where we look for configs, install stuff, etc)absolute_importN) sysconfig)install SCHEME_KEYS)WINDOWS expanduser)appdirsZpipzThis file is placed here by pip to indicate the source was put here by pip. Once this package is successfully installed this source code will be deleted (unless you remove this file). zpip-delete-this-directory.txtc Cs2tjj|t}t|d}|jtWdQRXdS)z? Write the pip delete marker file into this directory. wN)ospathjoinPIP_DELETE_MARKER_FILENAMEopenwriteDELETE_MARKER_MESSAGE)Z directoryfilepathZ marker_fpr/usr/lib/python3.6/locations.pywrite_delete_marker_files rcCs*ttdrdStjttdtjkr&dSdS)zM Return True if we're running inside a virtualenv, False otherwise. Z real_prefixT base_prefixF)hasattrsysprefixgetattrrrrrrunning_under_virtualenv's  rcCs>tjjtjjtj}tjj|d}tr:tjj|r:dSdS)z? Return True if in a venv and no system site packages. zno-global-site-packages.txtTN) r r dirnameabspathsite__file__r risfile)Z site_mod_dirZno_global_filerrrvirtualenv_no_global4sr srcz=The folder you are executing pip from can no longer be found.~ZScriptsbinzpip.inizpip.confz.pipdarwinz/System/Library/z/usr/local/bincCsg|]}tjj|tqSr)r r r config_basename).0r rrr wsr)FcCsNddlm}i}|r ddgi}ni}d|i} | j||| } | j| jddd} |p\| j| _|rjd | _|pr| j| _|p~| j| _|p| j| _| j xt D]} t | d | || <qWd | j dkr|jt | j| jd trJtjjtjd ddtjdd||d<|dk rJtjjtjj|dd} tjj|| dd|d<|S)z+ Return a distutils install scheme r) DistributionZ script_argsz --no-user-cfgnamerT)ZcreateZinstall_ install_lib)purelibplatlibincluderpythonNZheaders)Zdistutils.distr*updateZparse_config_filesZget_command_objuserrhomerootZfinalize_optionsrrZget_option_dictdictr-rr r r rversion splitdriver)Z dist_namer5r6r7isolatedrr*schemeZextra_dist_argsZ dist_argsdikeyZ path_no_driverrrdistutils_scheme|sF          r@)FNNFN)/__doc__Z __future__rr Zos.pathrrZ distutilsrZdistutils.command.installrrZ pip.compatrrZ pip.utilsrZuser_cache_dirZUSER_CACHE_DIRrr rrr r r rZ src_prefixgetcwdOSErrorexitrZget_python_libZ site_packages USER_SITE user_siteZuser_dirZbin_pyZbin_userexistsr'Zlegacy_storage_dirZlegacy_config_fileplatformZsite_config_dirsZsite_config_filesr@rrrrsd         (