
    VPic                       U d dl m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mZ d dlmZ ddlmZmZmZ  ej        e          Z e ej                              Z eed	d          Zd
ed<   d"dZd#dZd#dZd#dZ g dZ! ej"        d          e!#                    d           	 	 	 	 	 d$d%dZ$d#dZ%d#d Z&d#d!Z'dS )&    )annotationsN)Callable)InvalidSchemeCombinationUserInstallationInvalid)SCHEME_KEYSScheme)running_under_virtualenv   )change_rootget_major_minor_versionis_osx_frameworkget_preferred_schemezCallable[[str], str] | None_PREFERRED_SCHEME_APIreturnboolc                 N    dt           v 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        v/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/pip/_internal/locations/_sysconfig.py _should_use_osx_framework_prefixr   !   s1    ( 	 #55 	(***	r   strc                 l   t           rt          d          S t                      rdS t          j        j         dt
          j         } | t          v r| S t          j        j        t          v rt          j        j        S t
          j         d}|t          v r|S t
          j        t          v rt
          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)r   r   sysimplementationnameosr   )implementation_suffixedsuffixeds     r   _infer_prefixr%   ;   s      /$X...')) '&&!$!3!8DD27DD"444&&
"444!&&'"""H%%%	w$$$w>r   c                     t           rt          d          S t                      rt                      sd} nt          j         d} | t
          v r| S dt
          vrt                      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$   s    r   _infer_userr,   Z   sy     -$V,,, %":"<"< %'g$$$%%%---%'''<r   c                 f    t           rt          d          S t          j         d} | t          v r| S dS )z,Try to find a home for the current platform.home_home
posix_home)r   r"   r!   r   r+   s    r   _infer_homer1   i   s>     -$V,,,'   H%%%<r   )installed_basebaseinstalled_platbaseplatbaser   exec_prefixuserbaseF	dist_namer'   r.   
str | Nonerootisolatedr   r   c                   |rrt          dd          rrt          dd          t                      }n|rt                      }nt                      }|dk    rd}fdt          D             }nfdt          D             }ni }t          j        ||	          }t                      rz|r!|                    d
t          j
                  }	n |                    dt          j
                  }	dt                       }
t          j                            |	dd|
          |d<   n| sd} t          |d         |d         t          j                            |d         |           |d         |d                   }|9i }t           D ]#}t#          |t%          ||                    ||<   $t          di |}|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                    i | ]}|S r   r   ).0kr.   s     r   
<dictcomp>zget_scheme.<locals>.<dictcomp>   s    111Q111r   c                    i | ]}|S r   r   )r>   r?   r   s     r   r@   zget_scheme.<locals>.<dictcomp>   s    3331Q333r   )schemevarsr7   r3   pythonincludesiteUNKNOWNplatlibpurelibscriptsdata)rH   rI   headersrJ   rK   r   )r   r1   r,   r%   
_HOME_KEYS	sysconfig	get_pathsr	   getr   r   r   r"   pathjoinr   r   r   getattr)r8   r'   r.   r:   r;   r   scheme_name	variablespathsr3   	python_xyrB   converted_keyskeys     `  `        r   
get_schemerZ      s   *  = =&x<<< = =&x<<<!mm	 &!mm#oo
 k-DDD$1111j111				3333
333			{CCCE  !!  	5==SZ88DD==44D846688	7<<iKKi 	i i U9-y99i 6]  F  	J 	JC"-dGFC4H4H"I"IN3)).))Mr   c                     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/binrJ   )r   platformr   rN   rO   r   r   r   get_bin_prefixr`      sG    
|BQB8##
3B3;M(M(M  ++r   c                 4    t          j                    d         S )NrI   rN   rO   r   r   r   get_purelibrc            ++r   c                 4    t          j                    d         S )NrH   rb   r   r   r   get_platlibrf      rd   r   )r   r   )r   r   )FNNFN)r8   r   r'   r   r.   r9   r:   r9   r;   r   r   r9   r   r   )(
__future__r   loggingr"   r   rN   typingr   pip._internal.exceptionsr   r   pip._internal.models.schemer   r   pip._internal.utils.virtualenvr	   r3   r   r   r   	getLogger__name__loggersetget_scheme_namesr   rS   r   __annotations__r   r%   r,   r1   rM   get_config_varappendrZ   r`   rc   rf   r   r   r   <module>ru      s   " " " " " " "  				 



           V V V V V V V V ; ; ; ; ; ; ; ; C C C C C C H H H H H H H H H H		8	$	$ S335566 5<W%t6 6     
   4   >        
 9J''3j!!!
 K K K K K\, , , ,, , , ,, , , , , ,r   