U ʗRe @s`ddlZddlZddlZddlZddlZddlmZmZddlm Z m Z ddl m Z ddl mZmZmZeeZeeZeeddZedd d Zedd d Zedd dZedddZddddddgZe ddk re!dd%eeej"eej"eeej"ee dddZ#edddZ$edddZ%edd d!Z&eej'eefd"d#d$Z(dS)&N)InvalidSchemeCombinationUserInstallationInvalid) SCHEME_KEYSScheme)running_under_virtualenv) change_rootget_major_minor_versionis_osx_frameworkZget_preferred_scheme)returncCsdtkot otS)aCheck 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_SCHEMESrr rr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/locations/_sysconfig.py _should_use_osx_framework_prefixs rcCsvtr tdStrdStjjdtj}|tkr6|StjjtkrJtjjStjd}|tkrb|StjtkrrtjSdS)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_APIrsysimplementationnameosr )implementation_suffixedsuffixedrrr _infer_prefix7s   rcCsHtr tdStrtsd}n tjd}|tkr6|SdtkrDtdS)z3Try to find a user scheme for the current platform.userosx_framework_user_user posix_user)rr rrrr rrrrr _infer_userVs  r"cCs(tr tdStjd}|tkr$|SdS)z,Try to find a home for the current platform.home_home posix_home)rrrr r!rrr _infer_homees  r&installed_basebaseinstalled_platbaseplatbaser exec_prefixuserbaseF) dist_namerr#rootisolatedrr cs^|rrtddr$r$tdddk r4t}n|r@t}nt}dk rZ|dkrZd}dk rvfddtD}n dk rfd dtD}ni}tj||d }tr|r|d t j } n|d t j } d t } t j | dd| |d<n|sd}t|d|dt j |d||d|dd} |dk rZtD]"} t|t| | } t| | | q6| 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 rcsi|] }|qSrr.0k)r#rr szget_scheme..csi|] }|qSrrr0)rrrr3s)schemevarsr,r(pythonincludesiteUNKNOWNplatlibpurelibscriptsdata)r:r;headersr<r=)rr&r"r _HOME_KEYS sysconfig get_pathsrgetrrr rpathjoinrrrgetattrsetattr)r-rr#r.r/r scheme_name variablespathsr( python_xyr4keyvaluer)r#rr get_scheme|sJ    rMcCs4tjdddkr(tjdddkr(dStdS)Ndarwinz/System/Library/z/usr/local/binr<)rplatformrr@rArrrrget_bin_prefixs$rRcCs tdS)Nr;r@rArrrr get_purelibsrTcCs tdS)Nr:rSrrrr get_platlibsrU)rr cCs"tj||dd}|d|dfS)N)r(r*)r5r;r:rS)rrIrrrget_prefixed_libssrV)FNNFN))loggingrrr@typingpip._internal.exceptionsrrpip._internal.models.schemerrpip._internal.utils.virtualenvrr(rr r getLogger__name__loggersetget_scheme_namesr rErboolrstrrr"r&r?get_config_varappendOptionalrMrRrTrUTuplerVrrrrsT      M