HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc
a

g��e�
�@s�ddlZddlZddlZddlZddlZddlmZmZe�e	�Z
e�d�Zdd�Z
dd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�ZdS)�N)�List�Optionalz8include-system-site-packages\s*=\s*(?P<value>true|false)cCstjttdtj�kS)znChecks if sys.base_prefix and sys.prefix match.

    This handles PEP 405 compliant virtual environments.
    �base_prefix)�sys�prefix�getattr�rr�B/usr/lib/python3.9/site-packages/pip/_internal/utils/virtualenv.py�_running_under_venvsr
cCs
ttd�S)zmChecks if sys.real_prefix is set.

    This handles virtual environments created with pypa's virtualenv.
    Zreal_prefix)�hasattrrrrrr	�!_running_under_regular_virtualenvsrcCst�p
t�S)zBReturn True if we're running inside a virtualenv, False otherwise.)r
rrrrr	�running_under_virtualenv!sr
cCshtj�tjd�}z>t|dd��}|����Wd�WS1sB0YWntybYdS0dS)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�joinrr�open�read�
splitlines�OSError)Zpyvenv_cfg_file�frrr	�_get_pyvenv_cfg_lines's0rcCsPt�}|durt�d�dS|D]*}t�|�}|dur |�d�dkr dSq dS)aZCheck `{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�valueZfalseF)r�loggerZwarning�#_INCLUDE_SYSTEM_SITE_PACKAGES_REGEX�match�group)Z	cfg_lines�linerrrr	�_no_global_under_venv7s�
rcCs0tj�tj�tj��}tj�|d�}tj�|�S)z�Check if "no-global-site-packages.txt" exists beside site.py

    This mirrors logic in pypa/virtualenv for determining whether system
    site-packages are visible in the virtual environment.
    zno-global-site-packages.txt)rr�dirname�abspath�site�__file__r�exists)Zsite_mod_dirZno_global_site_packages_filerrr	�#_no_global_under_regular_virtualenvUs�r$cCst�rt�St�rt�SdS)zHReturns a boolean, whether running in venv with no system site-packages.F)r
rrr$rrrr	�virtualenv_no_globalds
r%)Zloggingr�rer!r�typingrrZ	getLogger�__name__r�compilerr
rr
rrr$r%rrrr	�<module>s 
�