관리-도구
편집 파일: virtualenv.cpython-311.pyc
� �܋f� � �� � d dl Z d dlZd dlZd dlZd dlZd dlmZmZ e j e � � Z ej d� � Zde fd�Zde fd�Zde fd�Zdeee fd�Zde fd �Zde fd �Zde fd�ZdS )� N)�List�Optionalz8include-system-site-packages\s*=\s*(?P<value>true|false)�returnc �^ � t j t t dt j � � k S )znChecks if sys.base_prefix and sys.prefix match. This handles PEP 405 compliant virtual environments. �base_prefix)�sys�prefix�getattr� � �U/opt/cloudlinux/venv/lib64/python3.11/site-packages/pip/_internal/utils/virtualenv.py�_running_under_venvr s � � �:���m�S�Z�@�@�@�@r c �, � t t d� � S )zmChecks if sys.real_prefix is set. This handles virtual environments created with pypa's virtualenv. �real_prefix)�hasattrr r r r � _running_under_legacy_virtualenvr s � � �3� �&�&�&r c �: � t � � p t � � S )zDTrue if we're running inside a virtual environment, False otherwise.)r r r r r �running_under_virtualenvr s � �� � �F�$D�$F�$F�Fr c � � t j � t j d� � } t | d�� � 5 }|� � � � � � cddd� � S # 1 swxY w Y dS # t $ r Y dS w xY w)z�Reads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines Returns None, if it could not read/access the file. z pyvenv.cfgzutf-8)�encodingN) �os�path�joinr r �open�read� splitlines�OSError)�pyvenv_cfg_file�fs r �_get_pyvenv_cfg_linesr $ s� � � �g�l�l�3�:�|�<�<�O�� �/�G� 4� 4� 4� )���6�6�8�8�&�&�(�(� )� )� )� )� )� )� )� )� )� )� )� )���� )� )� )� )� )� )��� � � ��t�t����s4 �A= �&A0�#A= �0A4�4A= �7A4�8A= �= B� Bc �� � t � � } | �t � d� � dS | D ]:}t � |� � }|�|� d� � dk r dS �;dS )aZ Check `{sys.prefix}/pyvenv.cfg` for system site-packages inclusion PEP 405 specifies that when system site-packages are not supposed to be visible from a virtual environment, `pyvenv.cfg` must contain the following line: include-system-site-packages = false Additionally, log a warning if accessing the file fails. Nz�Could not access 'pyvenv.cfg' despite a virtual environment being active. Assuming global site-packages is not accessible in this environment.T�value�falseF)r �logger�warning�#_INCLUDE_SYSTEM_SITE_PACKAGES_REGEX�match�group)� cfg_lines�liner'