File manager - Edit - /home/newsbmcs.com/public_html/static/img/logo/locations.tar
Back
base.py 0000644 00000004774 15030036676 0006052 0 ustar 00 import functools import os import site import sys import sysconfig import typing from pip._internal.exceptions import InstallationError from pip._internal.utils import appdirs from pip._internal.utils.virtualenv import running_under_virtualenv # Application Directories USER_CACHE_DIR = appdirs.user_cache_dir("pip") # FIXME doesn't account for venv linked to global site-packages site_packages: str = sysconfig.get_path("purelib") def get_major_minor_version() -> str: """ Return the major-minor version of the current Python as a string, e.g. "3.7" or "3.10". """ return "{}.{}".format(*sys.version_info) def change_root(new_root: str, pathname: str) -> str: """Return 'pathname' with 'new_root' prepended. If 'pathname' is relative, this is equivalent to os.path.join(new_root, pathname). Otherwise, it requires making 'pathname' relative and then joining the two, which is tricky on DOS/Windows and Mac OS. This is borrowed from Python's standard library's distutils module. """ if os.name == "posix": if not os.path.isabs(pathname): return os.path.join(new_root, pathname) else: return os.path.join(new_root, pathname[1:]) elif os.name == "nt": (drive, path) = os.path.splitdrive(pathname) if path[0] == "\\": path = path[1:] return os.path.join(new_root, path) else: raise InstallationError( f"Unknown platform: {os.name}\n" "Can not change root path prefix on unknown platform." ) def get_src_prefix() -> str: if running_under_virtualenv(): src_prefix = os.path.join(sys.prefix, "src") else: # FIXME: keep src in cwd for now (it is not a temporary folder) try: src_prefix = os.path.join(os.getcwd(), "src") except OSError: # In case the current working directory has been renamed or deleted sys.exit("The folder you are executing pip from can no longer be found.") # under macOS + virtualenv sys.prefix is not properly resolved # it is something like /path/to/python/bin/.. return os.path.abspath(src_prefix) try: # Use getusersitepackages if this is present, as it ensures that the # value is initialised properly. user_site: typing.Optional[str] = site.getusersitepackages() except AttributeError: user_site = site.USER_SITE @functools.lru_cache(maxsize=None) def is_osx_framework() -> bool: return bool(sysconfig.get_config_var("PYTHONFRAMEWORK")) __pycache__/_sysconfig.cpython-310.pyc 0000644 00000013546 15030036676 0013637 0 ustar 00 o �h, � @ sT d dl Z d dlZd dlZd dlZd dlZd dlmZmZ d dlm Z m Z d dlmZ ddl mZmZmZ e �e�Zee�� �Zeedd�Zdefd d �Zdefdd�Zdefd d�Zdefdd�Zg d�Ze� d�durqe�!d� d"dededej"e dej"e dedej"e de fdd�Z#defdd�Z$defdd�Z%defd d!�Z&dS )#� N)�InvalidSchemeCombination�UserInstallationInvalid)�SCHEME_KEYS�Scheme)�running_under_virtualenv� )�change_root�get_major_minor_version�is_osx_framework�get_preferred_scheme�returnc C s dt 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 � r r �U/usr/local/CyberCP/lib/python3.10/site-packages/pip/_internal/locations/_sysconfig.py� _should_use_osx_framework_prefix s ��r c C sv t rt d�S t� rdS tjj� dtj� �} | tv r| S tjjtv r%tjjS tj� d�}|tv r1|S tjtv r9tjS dS )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 )�implementation_suffixed�suffixedr r r � _infer_prefix7 s r c C sH t rt d�S t� rt� sd} ntj� d�} | tv r| S dtvr"t� �dS )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_userV s r# c C s( t rt d�S tj� d�} | tv r| S dS )z,Try to find a home for the current platform.�home�_home� posix_home)r r r r r"