
    Wh                        d dl mZ d dlZd dlZd dlZd dlZd dlZ ej        e          Z	 ej
        d          ZddZddZddZdd
ZddZddZddZdS )    )annotationsNz8include-system-site-packages\s*=\s*(?P<value>true|false)returnboolc                 ^    t           j        t          t           dt           j                  k    S )znChecks if sys.base_prefix and sys.prefix match.

    This handles PEP 405 compliant virtual environments.
    base_prefix)sysprefixgetattr     p/var/www/tools.fuzzalab.pt/emblema-extractor/venv/lib/python3.11/site-packages/pip/_internal/utils/virtualenv.py_running_under_venvr      s    
 :mSZ@@@@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   list[str] | Nonec                    t           j                            t          j        d          } 	 t          | d          5 }|                                                                cddd           S # 1 swxY w Y   dS # t          $ r Y dS w xY w)zReads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines

    Returns None, if it could not read/access the file.
    z
pyvenv.cfgzutf-8)encodingN)	ospathjoinr   r	   openread
splitlinesOSError)pyvenv_cfg_filefs     r   _get_pyvenv_cfg_linesr!   %   s    
 gll3:|<<O /G444 	)6688&&((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)   tts4   A= &A0#A= 0A44A= 7A48A= =
B
Bc                     t                      } | t                              d           dS | D ]:}t                              |          }||                    d          dk    r dS ;dS )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.
    NzCould 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(   s      r   _no_global_under_venvr,   4   s     &''I 	#	
 	
 	

 t  399$??W!5!5!@!@445r   c                    t           j                            t           j                            t          j                            } t           j                            | d          }t           j                            |          S )zCheck 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.
    zno-global-site-packages.txt)r   r   dirnameabspathsite__file__r   exists)site_mod_dirno_global_site_packages_files     r   "_no_global_under_legacy_virtualenvr5   Q   sZ     7??27??4=#A#ABBL#%7<<%$ $  7>>6777r   c                 v    t                      rt                      S t                      rt                      S dS )zHReturns a boolean, whether running in venv with no system site-packages.F)r   r,   r   r5   r   r   r   virtualenv_no_globalr7   _   s=      '$&&&')) 413335r   )r   r   )r   r   )
__future__r   loggingr   rer0   r   	getLogger__name__r%   compiler'   r   r   r   r!   r,   r5   r7   r   r   r   <module>r>      s   " " " " " "  				 				  



		8	$	$&0bj?' ' #
A A A A' ' ' 'G G G G
      :8 8 8 8
 
 
 
 
 
r   