σ
Π²Ebc           @@  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 Z d d l	 m Z
 d d l m Z d d l m Z d d l m Z d d l m Z d d	 l m Z d d
 l m Z m Z d d l m Z e rd d l m Z d d l m Z m Z m  Z  m! Z! n  e j" d  Z# d   Z$ d   Z% e j& d  Z' e j(   j)   d k rve
 j*   Z' n  y e j+   Z, Wn e- k
 r’e j. Z, n Xe re j/ j0 e j1 d  Z2 e j/ j0 e, d  Z3 e j/ j4 e2  swe j/ j0 e j1 d  Z2 e j/ j0 e, d  Z3 qwn\ e j/ j0 e j1 d  Z2 e j/ j0 e, d  Z3 e j d  d k rwe j1 d  d k rwd Z2 n  e5 d d e5 d d  Z7 e5 d d e5 d d  Z8 d S(   s7   Locations where we look for configs, install stuff, etci    (   t   absolute_importN(   t	   sysconfig(   t   SCHEME_KEYS(   t   install(   t   Scheme(   t   appdirs(   t   WINDOWS(   t   MYPY_CHECK_RUNNINGt   cast(   t   running_under_virtualenv(   t   Command(   t   Dictt   Listt   Optionalt   Uniont   pipc           C@  s   d j  t j   S(   se   
    Return the major-minor version of the current Python as a string, e.g.
    "3.7" or "3.10".
    s   {}.{}(   t   formatt   syst   version_info(    (    (    s4   /tmp/pip-build-UPPWic/pip/pip/_internal/locations.pyt   get_major_minor_version!   s    c          C@  st   t    r$ t j j t j d  }  n@ y t j j t j   d  }  Wn t k
 rc t j d  n Xt j j	 |   S(   Nt   srcs=   The folder you are executing pip from can no longer be found.(
   R	   t   ost   patht   joinR   t   prefixt   getcwdt   OSErrort   exitt   abspath(   t
   src_prefix(    (    s4   /tmp/pip-build-UPPWic/pip/pip/_internal/locations.pyt   get_src_prefix*   s    	t   purelibt   pypyt   Scriptst   bini   t   darwini   s   /System/Library/s   /usr/local/binc         C@  s4  d d l  m } i |  d 6} | r3 d g | d <n  | |  } | j   d }	 | j d d t }	 |	 d k	 sv t  t t |	  }
 | o | sͺ t d j	 | |    | o³ | sΟ t d	 j	 | |    | pΫ |
 j
 |
 _
 | sν | rω d
 |
 _ n  | p|
 j |
 _ | p|
 j |
 _ | p)|
 j |
 _ |
 j   i  } x% t D] } t |
 d |  | | <qFWd | j d  k r‘| j t d |
 j d |
 j   n  t   r0t j j |
 j d d d j	 t    |   | d <| d k	 r0t j j t j j | d   d } t j j | | d  | d <q0n  | S(   s+   
    Return a distutils install scheme
    i    (   t   Distributiont   names   --no-user-cfgt   script_argsR   t   creates   user={} prefix={}s   home={} prefix={}t    t   install_t   install_libR   t   platlibt   includet   sites   python{}t   headersi   N(   t   distutils.distR$   t   parse_config_filest   Nonet   get_command_objt   Truet   AssertionErrorR   t   distutils_install_commandR   t   userR   t   homet   roott   finalize_optionsR   t   getattrt   get_option_dictt   updatet   dictR*   R	   R   R   R   R   t
   splitdriveR   (   t	   dist_nameR6   R7   R8   t   isolatedR   R$   t	   dist_argst   dt   objt   it   schemet   keyt   path_no_drive(    (    s4   /tmp/pip-build-UPPWic/pip/pip/_internal/locations.pyt   distutils_scheme^   sL    
%%
%				c         C@  sT   t  |  | | | | |  } t d | d d | d d | d d | d d | d  S(   s;  
    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.   t   scriptst   data(   RH   R   (   R?   R6   R7   R8   R@   R   RE   (    (    s4   /tmp/pip-build-UPPWic/pip/pip/_internal/locations.pyt
   get_scheme   s    



(9   t   __doc__t
   __future__R    R   t   os.patht   platformR-   R   R   t	   distutilst   distutils_sysconfigt   distutils.command.installR   R   R5   t   pip._internal.models.schemeR   t   pip._internal.utilsR   t   pip._internal.utils.compatR   t   pip._internal.utils.typingR   R   t   pip._internal.utils.virtualenvR	   t   distutils.cmdR
   t   DistutilsCommandt   typingR   R   R   R   t   user_cache_dirt   USER_CACHE_DIRR   R   t   get_patht   site_packagest   python_implementationt   lowert   get_python_libt   getusersitepackagest	   user_sitet   AttributeErrort	   USER_SITER   R   R   t   bin_pyt   bin_usert   existst   FalseR1   RH   RK   (    (    (    s4   /tmp/pip-build-UPPWic/pip/pip/_internal/locations.pyt   <module>   sX   %			&	A