3
[                 @   sp  d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	mZ
 ddlmZ ddlmZ ddlmZmZ ejdZd	Zd
Zdd Zdd Zdd Ze rejjejdZn6yejjej dZW n ek
r   ejd Y nX ejj eZej!dZ"ej# j$ dkre
j% Z"yej& Z'W n e(k
rD   ej)Z'Y nX edZ*erejjejdZ+ejje'dZ,ejj-e+sejjejdZ+ejje'dZ,dZ.ejje*dZ/ejje/e.Z0njejjejdZ+ejje'dZ,dZ.ejje*dZ/ejje/e.Z0ejdd dkr*ejdd dkr*dZ+d d! ej1dD Z2ejjeje.Z3ejjej4de.Z5d%d#d$Z6dS )&z7Locations where we look for configs, install stuff, etc    )absolute_importN)	sysconfig)SCHEME_KEYS)appdirs)WINDOWS
expanduserpipzThis 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).
zpip-delete-this-directory.txtc          	   C   s2   t jj| t}t|d}|jt W dQ R X dS )z?
    Write the pip delete marker file into this directory.
    wN)ospathjoinPIP_DELETE_MARKER_FILENAMEopenwriteDELETE_MARKER_MESSAGE)	directoryfilepath	marker_fp r   8/tmp/pip-install-65viz3iy/pip/pip/_internal/locations.pywrite_delete_marker_file   s    r   c               C   s*   t tdrdS tjttdtjkr&dS dS )zM
    Return True if we're running inside a virtualenv, False otherwise.

    real_prefixTbase_prefixF)hasattrsysprefixgetattrr   r   r   r   running_under_virtualenv'   s
    
r   c              C   s>   t jjt jjtj} t jj| d}t r:t jj|r:dS dS )z?
    Return True if in a venv and no system site packages.
    zno-global-site-packages.txtTN)	r
   r   dirnameabspathsite__file__r   r   isfile)site_mod_dirno_global_filer   r   r   virtualenv_no_global4   s    r%   srcz=The folder you are executing pip from can no longer be found.purelibZpypy~Scriptsbinzpip.inizpip.confz.pip   darwin   z/System/Library/z/usr/local/binc             C   s   g | ]}t jj|tqS r   )r
   r   r   config_basename).0r   r   r   r   
<listcomp>   s   r0   Fc             C   sh  ddl m} i }|r ddgi}ni }d| i}	|	j| ||	}
|
j  |
jddd}|oZ| sntd	j|||pv|j|_|rd
|_|p|j|_|p|j	|_	|p|j
|_
|j  xtD ]}t|d| ||< qW d|
jdkr|jt|j|jd t rdtjjtjdddtjdd  | |d< |dk	rdtjjtjj|d d }tjj||dd |d< |S )z+
    Return a distutils install scheme
    r   )Distributionscript_argsz--no-user-cfgnameinstallT)createzuser={} prefix={} install_install_lib)r'   platlibincluder    pythonN   headers   )distutils.distr1   updateparse_config_filesget_command_objAssertionErrorformatuserr   homerootfinalize_optionsr   r   get_option_dictdictr8   r   r
   r   r   r   version
splitdriver   )	dist_namerE   rF   rG   isolatedr   r1   schemeextra_dist_args	dist_argsdikeypath_no_driver   r   r   distutils_scheme   sH    



rV   )FNNFN)7__doc__
__future__r   r
   os.pathplatformr    r   r   	distutilsdistutils_sysconfigdistutils.command.installr   pip._internal.utilsr   Zpip._internal.utils.compatr   r   user_cache_dirUSER_CACHE_DIRr   r   r   r   r%   r   r   r   
src_prefixgetcwdOSErrorexitr   get_pathsite_packagespython_implementationlowerget_python_libZgetusersitepackages	user_siteAttributeError	USER_SITEuser_dirbin_pybin_userexistsr.   legacy_storage_dirlegacy_config_filesite_config_dirssite_config_filesvenv_config_fileuser_config_dirnew_config_filerV   r   r   r   r   <module>   sv   
		
( 