3
g              	   @   sd  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m	Z	 d dl
mZmZ d dlmZ ddlmZmZ ejeZeej ZeeddZedd	d
ZedddZedddZedddZddddddgZ ej!ddk	re j"d d%eeej#e ej#e eej#e edddZ$edddZ%edddZ&edd d!Z'eej(eef d"d#d$Z)dS )&    N)InvalidSchemeCombinationUserInstallationInvalid)SCHEME_KEYSScheme)running_under_virtualenv   )get_major_minor_versionis_osx_frameworkZget_preferred_scheme)returnc               C   s   dt kot  ot S )a  Check for Apple's ``osx_framework_library`` scheme.

    Python distributed by Apple's Command Line Tools has this special scheme
    that's used when:

    * This is a framework build.
    * We are installing into the system prefix.

    This does not account for ``pip install --prefix`` (also means we're not
    installing to the system prefix), which should use ``posix_prefix``, but
    logic here means ``_infer_prefix()`` outputs ``osx_framework_library``. But
    since ``prefix`` is not available for ``sysconfig.get_default_scheme()``,
    which is the stdlib replacement for ``_infer_prefix()``, presumably Apple
    wouldn't be able to magically switch between ``osx_framework_library`` and
    ``posix_prefix``. ``_infer_prefix()`` returning ``osx_framework_library``
    means its behavior is consistent whether we use the stdlib implementation
    or our own, and we deal with this special case in ``get_scheme()`` instead.
    osx_framework_library)_AVAILABLE_SCHEMESr   r	    r   r   `/var/www/tester-filtro-web/env/lib/python3.6/site-packages/pip/_internal/locations/_sysconfig.py _should_use_osx_framework_prefix   s    r   c              C   sv   t rt dS t rdS tjj dtj } | tkr6| S tjjtkrJtjjS tj d}|tkrb|S tjtkrrtjS dS )a!  Try to find a prefix scheme for the current platform.

    This tries:

    * A special ``osx_framework_library`` for Python distributed by Apple's
      Command Line Tools, when not running in a virtual environment.
    * Implementation + OS, used by PyPy on Windows (``pypy_nt``).
    * Implementation without OS, used by PyPy on POSIX (``pypy``).
    * OS + "prefix", used by CPython on POSIX (``posix_prefix``).
    * Just the OS name, used by CPython on Windows (``nt``).

    If none of the above works, fall back to ``posix_prefix``.
    prefixr   __prefixposix_prefix)_PREFERRED_SCHEME_APIr   sysimplementationnameosr   )Zimplementation_suffixedsuffixedr   r   r   _infer_prefix8   s    
r   c              C   sJ   t rt dS t r t  r d} ntj d} | tkr8| S dtkrFt dS )z3Try to find a user scheme for the current platform.userosx_framework_user_user
posix_user)r   r	   r   r   r   r   r   )r   r   r   r   _infer_userW   s    r   c              C   s(   t rt dS tj d} | tkr$| S dS )z,Try to find a home for the current platform.home_home
posix_home)r   r   r   r   )r   r   r   r   _infer_homef   s    r#   installed_basebaseinstalled_platbaseplatbaser   exec_prefixuserbaseF)	dist_namer   r    rootisolatedr   r
   c                sf  |rrt dd r$r$t dd dk	r4t }n|r@t }nt }dk	rZ|dkrZd} dk	rv fddtD }n dk	rfd	dtD }ni }tj||d
}t r|r|jdt	j
}	n|jdt	j
}	dt  }
tjj|	dd|
|d< n| sd} t|d |d tjj|d | |d |d d}|dk	rbx.tD ]&}tjj|t||}t||| q8W |S )a\  
    Get the "scheme" corresponding to the input parameters.

    :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
    :param root: root under which other directories are re-based
    :param isolated: ignored, but kept for distutils compatibility (where
        this controls whether the user-site pydistutils.cfg is honored)
    :param prefix: indicates to use the "prefix" scheme and provides the
        base directory for the same
    z--userz--prefixz--homeNr   r   c                s   i | ]
} |qS r   r   ).0k)r    r   r   
<dictcomp>   s    zget_scheme.<locals>.<dictcomp>c                s   i | ]
} |qS r   r   )r-   r.   )r   r   r   r/      s    )schemevarsr)   r%   pythonincludesiteUNKNOWNplatlibpurelibscriptsdata)r6   r7   headersr8   r9   )r   r#   r   r   
_HOME_KEYS	sysconfig	get_pathsr   getr   r   r   r   pathjoinr   r   	distutilsutilchange_rootgetattrsetattr)r*   r   r    r+   r,   r   Zscheme_name	variablespathsr%   Z	python_xyr0   keyvaluer   )r    r   r   
get_scheme}   sH    



rJ   c               C   s4   t jd d dkr(t jd d dkr(dS tj d S )N   darwin   z/System/Library/z/usr/local/binr8   )r   platformr   r<   r=   r   r   r   r   get_bin_prefix   s    $rO   c               C   s   t j d S )Nr7   )r<   r=   r   r   r   r   get_purelib   s    rP   c               C   s   t j d S )Nr6   )r<   r=   r   r   r   r   get_platlib   s    rQ   )r   r
   c             C   s"   t j| | dd}|d |d fS )N)r%   r'   )r1   r7   r6   )r<   r=   )r   rG   r   r   r   get_prefixed_libs   s    rR   )FNNFN)*distutils.utilrA   loggingr   r   r<   typingpip._internal.exceptionsr   r   pip._internal.models.schemer   r   pip._internal.utils.virtualenvr   r%   r   r	   	getLogger__name__loggersetget_scheme_namesr   rD   r   boolr   strr   r   r#   r;   get_config_varappendOptionalrJ   rO   rP   rQ   TuplerR   r   r   r   r   <module>   sD   

     F