R`i d dl Z d dlZd dlZd dlZd dlZd dlmZmZ d dlm Z m Z d dlmZ ddl mZmZmZ e j" e Z e ej* Z eedd Zdefd Zdefd ZdefdZdefdZg d Z ej@ d ejC d ddededejD e dejD e dedejD e de fdZ#defdZ$defdZ%defdZ&y) N)InvalidSchemeCombinationUserInstallationInvalid)SCHEME_KEYSScheme)running_under_virtualenv )change_rootget_major_minor_versionis_osx_frameworkget_preferred_schemereturnc D dt v xr t xr 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 /builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_internal/locations/_sysconfig.py _should_use_osx_framework_prefixr s+ ( #55 (** r c t rt d S t ryt j j dt j } | t v r| S t j j t v rt j j S t j d}|t v r|S t j t v rt j S y)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 __prefixposix_prefix)_PREFERRED_SCHEME_APIr sysimplementationnameosr )implementation_suffixedsuffixeds r _infer_prefixr! 7 s $X..')&!$!3!3!8!8 9277)D"44&& "44!!&&&'''"H%% ww$$wwr c t rt d S t r t sd} nt j d} | t v r| S dt vr t y)z3Try to find a user scheme for the current platform.userosx_framework_user_user posix_user)r r r r r r r r s r _infer_userr( V sT $V,,":"<'ggYe$%%--%''r c ` t rt d S t j d} | t v r| S y)z,Try to find a home for the current platform.home_home posix_home)r r r r r' s r _infer_homer- e s1 $V,,''% H%%r )installed_basebaseinstalled_platbaseplatbaser exec_prefixuserbase dist_namer# r* rootisolatedr c $ |r|rt dd |r|rt dd |t }n|rt }n t }||dk( rd}|t D ci c] }|| }}n|t D ci c] }|| }}ni }t j || } t rv|r!|j dt j } n |j dt j } d t }t j j | d d| | d <