§
]<ˆj€
ã óê — 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*(?Ptrue|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© ó úp/builddir/build/BUILD/cloudlinux-venv-1.0.12/venv/lib/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' s r
Ú_no_global_under_venvr+ 3 s„ € õ &Ñ'Ô'€IØÐõ �Šð
#ñ
ô
ð
ð
ˆtàð ð ˆÝ3×9Ò9¸$Ñ?Ô?ˆØÐ §¢¨WÑ!5Ô!5¸Ò!@Ð!@Ø�4�4øØˆ5r c ó — t j t j t j ¦ « ¦ « } t j | d¦ « }t j |¦ « 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)r r ÚdirnameÚabspathÚsiteÚ__file__r Úexists)Úsite_mod_dirÚno_global_site_packages_files r
Ú"_no_global_under_legacy_virtualenvr4 P sZ € õ ”7—?’?¥2¤7§?¢?µ4´=Ñ#AÔ#AÑBÔB€LÝ#%¤7§<¢<ØØ%ñ$ô $Ð õ Œ7�>Š>Ð6Ñ7Ô7Ð7r c óv — t ¦ « rt ¦ « S t ¦ « rt ¦ « S dS )zHReturns a boolean, whether running in venv with no system site-packages.F)r r+ r r4 r r r
Úvirtualenv_no_globalr6 ^ s= € õ ÑÔð 'Ý$Ñ&Ô&Ð&å'Ñ)Ô)ð 4Ý1Ñ3Ô3Ð3àˆ5r )Úloggingr Úrer/ r Útypingr r Ú getLoggerÚ__name__r$ Úcompiler&