σ
¨9Vc           @@  s#  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 m	 Z	 d d l
 m Z m Z d d l m Z d d l m Z d d	 d
 d d d g Z e d   e D d  Z e j d  Z d Z d Z d   Z d   Z d   Z d   Z e   r,e j j e j d  Z  n@ y e j j e j!   d  Z  Wn e" k
 rke j# d  n Xe j j$ e   Z  e	 j%   Z& e j' Z( e j j) d  Z* e rMe j j e j d  Z+ e j j e( d  Z, e j j- e+  se j j e j d  Z+ e j j e( d  Z, n  d Z. e j j e* d  Z/ e j j e/ e.  Z0 n e 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.  Z0 e j1 d  d k rΩe j d   d! k rΩd" Z+ n  g  e j2 d  D] Z e j j e e.  ^ qιZ3 e4 d d e4 d#  Z5 d S($   s7   Locations where we look for configs, install stuff, etci    (   t   absolute_importN(   t	   sysconfig(   t   installt   SCHEME_KEYS(   t   WINDOWS(   t   appdirss"   /etc/ssl/certs/ca-certificates.crts    /etc/pki/tls/certs/ca-bundle.crts   /etc/ssl/ca-bundle.pems   /etc/ssl/cert.pems&   /usr/local/share/certs/ca-root-nss.crts   /usr/local/etc/openssl/cert.pemc         c@  s'   |  ] } t  j j |  r | Vq d  S(   N(   t   ost   patht   exists(   t   .0t   x(    (    s*   /tmp/pip-build-5Z5nTX/pip/pip/locations.pys	   <genexpr>.   s    t   pipsΉ   This 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).
s   pip-delete-this-directory.txtc         C@  s>   t  j j |  t  } t | d   } | j t  Wd QXd S(   s?   
    Write the pip delete marker file into this directory.
    t   wN(   R   R   t   joint   PIP_DELETE_MARKER_FILENAMEt   opent   writet   DELETE_MARKER_MESSAGE(   t	   directoryt   filepatht	   marker_fp(    (    s*   /tmp/pip-build-5Z5nTX/pip/pip/locations.pyt   write_delete_marker_file?   s    c           C@  s9   t  t d  r t St j t t d t j  k r5 t St S(   sM   
    Return True if we're running inside a virtualenv, False otherwise.

    t   real_prefixt   base_prefix(   t   hasattrt   syst   Truet   prefixt   getattrt   False(    (    (    s*   /tmp/pip-build-5Z5nTX/pip/pip/locations.pyt   running_under_virtualenvH   s
    c          C@  sY   t  j j t  j j t j   }  t  j j |  d  } t   rU t  j j |  rU t	 Sd S(   s?   
    Return True if in a venv and no system site packages.
    s   no-global-site-packages.txtN(
   R   R   t   dirnamet   abspatht   sitet   __file__R   R   t   isfileR   (   t   site_mod_dirt   no_global_file(    (    s*   /tmp/pip-build-5Z5nTX/pip/pip/locations.pyt   virtualenv_no_globalU   s    !c          C@  s2   t  r t j   Sd d l }  |  j t j    j S(   s8    Returns the effective username of the current process. i    N(   R   t   getpasst   getusert   pwdt   getpwuidR   t   geteuidt   pw_name(   R)   (    (    s*   /tmp/pip-build-5Z5nTX/pip/pip/locations.pyt   __get_usernamea   s    
t   srcs=   The folder you are executing pip from can no longer be found.t   ~t   Scriptst   bins   pip.inis   pip.confs   .pipi   t   darwini   s   /System/Library/s   /usr/local/binc      
   C@  sͺ  d d l  m } i  } | r/ i d g d 6} n i  } i |  d 6} | j |  | |  }	 |	 j   |	 j d d t }
 | p |
 j |
 _ | r d |
 _ n  | pͺ |
 j |
 _ | pΌ |
 j	 |
 _	 |
 j
   x% t D] } t |
 d	 |  | | <qΣ Wd
 |	 j d  k r.| j t d |
 j d |
 j   n  t   r¦t j j t j d d d t j d  |   | d <| d k	 r¦t j j | t j j | d  d  | d <q¦n  | S(   s+   
    Return a distutils install scheme
    i    (   t   Distributions   --no-user-cfgt   script_argst   nameR   t   createt    t   install_t   install_libt   purelibt   platlibt   includeR!   t   pythoni   t   headersi   N(   t   distutils.distR3   t   updatet   parse_config_filest   get_command_objR   t   userR   t   homet   roott   finalize_optionsR   R   t   get_option_dictt   dictR9   R   R   R   R   R   t   versiont   NoneR    (   t	   dist_nameRC   RD   RE   t   isolatedR3   t   schemet   extra_dist_argst	   dist_argst   dt   it   key(    (    s*   /tmp/pip-build-5Z5nTX/pip/pip/locations.pyt   distutils_scheme₯   s@    

%			'(6   t   __doc__t
   __future__R    R'   R   t   os.pathR!   R   t	   distutilsR   t   distutils.command.installR   R   t
   pip.compatR   t	   pip.utilsR   t   CA_BUNDLE_PATHSt   nextRJ   t   CA_BUNDLE_PATHt   user_cache_dirt   USER_CACHE_DIRR   R   R   R   R&   R-   R   R   R   t
   src_prefixt   getcwdt   OSErrort   exitR    t   get_python_libt   site_packagest	   USER_SITEt	   user_sitet
   expandusert   user_dirt   bin_pyt   bin_userR   t   config_basenamet   legacy_storage_dirt   legacy_config_filet   platformt   site_config_dirst   site_config_filesR   RS   (    (    (    s*   /tmp/pip-build-5Z5nTX/pip/pip/locations.pyt   <module>   sv   												&	.	