https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/virtualenv/discovery/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/virtualenv/discovery/__pycache__/py_info.cpython-310.pyc
o

$�"bV[�@s�dZddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlm
Z
mZddlmZedgd��Zdd	�Ze�Ze�d
�ZGdd�de�Zed
kr`ee����dSdS)z�
The PythonInfo contains information about a concrete instance of a Python interpreter

Note: this file is also used to query target interpreters, so can only use standard library methods
�)�absolute_import�print_functionN)�OrderedDict�
namedtuple)�digits�VersionInfo)�major�minor�micro�releaselevel�serialcCs*tt�dgtj�dd����tj���S)N��PATHEXT)	�listr�fromkeys�os�environ�get�lower�split�pathsep�rr�>/usr/lib/python3/dist-packages/virtualenv/discovery/py_info.py�_get_path_extensionss*rz\{\w+\}c@s�eZdZdZdd�Zdd�Zdd�Zedd	��Ze	d
d��Z
e	dd
��Ze	dd��Ze	dd��Z
e	dd��Zdejfdd�ZdIdd�Ze	dd��Ze	dd��Ze	dd��Zd d!�Zd"d#�Zd$d%�Ze	d&d'��Zed(d)��Zd*d+�ZdZdZedJd,d-��ZedJd.d/��Z d0d1�Z!d2d3�Z"edKd5d6��Z#ed7d8��Z$ed9d:��Z%ed;d<��Z&iZ'dLd=d>�Z(d?d@�Z)edAdB��Z*dCdD�Z+dEdF�Z,dGdH�Z-dS)M�
PythonInfoz-Contains information for a Python interpretercsdd��dd�}�tj��_�t����_�jdkr't�fdd�tjD���_tt�fdd�tjD����_tj	d	kr=d
nd�_
�tj��_�tj
��_�|ttdd����_�|ttd
d����_�|ttdd����_�|ttdd����_�|ttdd����_�|tj���_�|�j���_����_ztd�d}Wnty�d}Ynw|�_�fdd�tjD��_�t����_�ttjdd���_dt �!�vr�d�_"�fdd�t �#�D��_$i�_%nd�_"�fdd�t �#�D��_$�fdd���&��'�D��_%tt dtt dd��}�fdd�d|�ffD��_ t(�}�j$�)�D]}t*�+|�D]}|�,�|dd ����q(�q!|�,d!��fd"d�|D��_-�jdk�rZtjj.d#k�rZd$�j-d%<�fd&d��j-�'�D�}��/d'|��_0��/d(|��_1ttd)ttd*d���_2d�_3dS)+NcSst|t�r
|�d�S|S)N�utf-8)�
isinstance�bytes�decode��vrrr�u"�zPythonInfo.__init__.<locals>.ucSs|durdStj�|�S�N)r�path�abspathrrrr�abs_path%r"z%PythonInfo.__init__.<locals>.abs_path�PyPyc3��|]}�|�VqdSr#r��.0�i�r!rr�	<genexpr>,��z&PythonInfo.__init__.<locals>.<genexpr>c3r(r#rr)r,rrr-/r.l�@� �prefix�base_prefix�real_prefix�base_exec_prefix�exec_prefix�venvTFcsg|]}�|��qSrrr)r,rr�
<listcomp>Hsz'PythonInfo.__init__.<locals>.<listcomp>�encodingc	s&i|]}�|��tj|ddd���qS)Fr6)�expand�scheme��	sysconfig�get_pathr)r,rr�
<dictcomp>Ns�z'PythonInfo.__init__.<locals>.<dictcomp>cs$i|]}�|��tj|dd���qS)F)r9r;r)r,rrr>U�$csi|]\}}�|��|��qSrr�r*�kr r,rrr>Vs�get_makefile_filename�_get_makefile_filenamecs&i|]\}}|dur�|��|��qSr#rr@r,rrr>Zs
��makefile_filename�����PYTHONFRAMEWORKcs$i|]}�|��t�|�pd��qS�r
)r<�get_config_varr)r,rrr>ir?��python�implementation_lowerc�(i|]\}}||��j�r�jn|�qSr��
startswithr1�
system_prefixr@��selfrrr>m�(�stdlib�
platstdlib�maxsize�maxint)4�sys�platform�python_implementation�implementation�tuple�pypy_version_inforr�version_inforV�architecture�versionr�name�getattrr1r2r3r4r5�
executable�original_executable�_fast_get_system_executable�system_executable�
__import__�ImportError�has_venvr$�getfilesystemencoding�file_system_encoding�stdout�stdout_encodingr<�get_scheme_names�sysconfig_scheme�get_path_names�sysconfig_paths�distutils_install�_distutils_install�items�set�values�_CONF_VAR_RE�findall�add�sysconfig_varsr�sysconfig_path�
system_stdlib�system_stdlib_platform�max_size�	_creators)rRr&�has�makefile�config_var_keys�elementrA�confsr)rRr!r�__init__!sp

�
�
��	�


zPythonInfo.__init__cCsR|js|jdur&|j|jkr&|jdur$ttdd�}|dur$tj|kr$|SdS|jS)z>Try to get the system executable by just looking at propertiesN�_base_executable)r3r2r1rbrXrcrd)rR�base_executablerrrress

z&PythonInfo._fast_get_system_executablecsZ|j�|�}|dur+|j|j|j|jf��fdd�|j��D�}|j||d��	t
j�}|S)Ncs"i|]
\}}||�vr
dn|�qSrHrr@��prefixesrrr>�s"z+PythonInfo.install_path.<locals>.<dictcomp>)�
config_var)rrrr1r5r2r4rzrtr{�lstripr�sep)rR�key�resultr�rr�r�install_path�szPythonInfo.install_pathc	s�t���.t�d�zddlm}ddlm}Wnty*iYWd�SwWd�n1s5wY|�ddi�}t	t
d�rIdt
_t���t�d�|jdd	d
��Wd�n1sdwYt
j�_����fdd�|D�}|S)
N�ignorer)�dist)�SCHEME_KEYS�script_argsz
--no-user-cfg�
_framework�installT)�createcs.i|]}|t�d�|��dd��tj��qS)z
install_{}rEN)rb�formatr�rr�)r*r��r+rrr>�s.z1PythonInfo._distutils_install.<locals>.<dictcomp>)�warnings�catch_warnings�simplefilter�	distutilsr��distutils.command.installr�rh�Distribution�hasattrrXr��get_command_objrr�r1�finalize_options)r�r��dr�rr�rrs�s,

���


�zPythonInfo._distutils_installcC�d�dd�|jdd�D��S)N�.cs��|]}t|�VqdSr#��strr)rrrr-�r.z)PythonInfo.version_str.<locals>.<genexpr>r���joinr^rQrrr�version_str��zPythonInfo.version_strcCr�)Nr�csr�r#r�r)rrrr-�r.z1PythonInfo.version_release_str.<locals>.<genexpr>rrJr�rQrrr�version_release_str�r�zPythonInfo.version_release_strcCs|j}d�|j|j�S)Nzpython{}.{})r^r�rr	)rRr^rrr�python_name�szPythonInfo.python_namecCs
|jduSr#)r3rQrrr�is_old_virtualenv�s
zPythonInfo.is_old_virtualenvcCs|jduo
|jjdkS)Nr�)r2r^rrQrrr�is_venv�szPythonInfo.is_venvNcCsT|j|}|dur
|j}ndd�|j��D�}|�|�|}|jdi|���d|�S)NcS�i|]\}}||�qSrrr@rrrr>��z-PythonInfo.sysconfig_path.<locals>.<dictcomp>�/r)rqrzrt�updater��replace)rRr�r�r��pattern�baserrrr{�s

zPythonInfo.sysconfig_pathFcCs0|jdus	|durddlm}|�|�|_|jS)NTr)�CreatorSelector)r�virtualenv.run.plugin.creatorsr��for_interpreter)rR�refreshr�rrr�creators�szPythonInfo.creatorscs^��d�fdd��j��D��}tj�|�s-tj��jtj���	d���}tj�|�r-|}|S)N�includecrMrrNr@rQrrr>�rSz-PythonInfo.system_include.<locals>.<dictcomp>�headers)
r{rzrtrr$�existsr�r1�dirnamer�)rRr$�fallbackrrQr�system_include�s�zPythonInfo.system_includecC�|jp|jp|jSr#)r3r2r1rQrrrrP��zPythonInfo.system_prefixcCr�r#)r3r4r5rQrrr�system_exec_prefix�r�zPythonInfo.system_exec_prefixcCs t|�}tjdkr|�d�}|S)NrJr)�reprrXr^r�rR�contentrrr�__unicode__�s

zPythonInfo.__unicode__cCs d�|jjdd�|j��D��S)Nz{}({!r})cSs i|]\}}|�d�s||�qS)�_)rOr@rrrr>�s z'PythonInfo.__repr__.<locals>.<dictcomp>)r��	__class__�__name__�__dict__rtrQrrr�__repr__�s�zPythonInfo.__repr__cCs�d�|jjd�dd�d|jf|jdur|j|jkrdnd|jf|j|jkr-|j|jkr-dnd|jfd|jfd	|jfd
t	|j
�fdd�|j|j�ffD���}|S)
Nz{}({})z, css(�|]\}}|durd�||�VqdS)Nz{}={})r�r@rrrr-�s�
��z%PythonInfo.__str__.<locals>.<genexpr>�spec�system�original�exerYr`�encoding_fs_ioz{}-{})
r�r�r�r�r�rfrcrdrYr�r`rkrmr�rrr�__str__�s.
��	��	���zPythonInfo.__str__cCs$d�|jd�dd�|jD��|j�S)Nz{}{}-{}r�csr�r#r�r)rrrr-r.z"PythonInfo.spec.<locals>.<genexpr>)r�r[r�r^r_rQrrrr�s$zPythonInfo.speccCs"ddlm}||�|j��dS)Nr)�clear)�#virtualenv.discovery.cached_py_infor��_cache_exe_discovery)�cls�app_datar�rrr�clear_cacheszPythonInfo.clear_cachecCs|jr=|jtj�|j�krdS|js=tj�|j�}|j}tjdkr7tj�	|�\}}|�
|�r7|dt|��}||kr=dS|rP|jdurP|j�
�|j�
�krPdS|jdur]|j|jkr]dSt|jdd�|j|j|jf�D]\}}|dur�|dur�||kr�dSqmdS)zWcheck if a given specification can be satisfied by the this python interpreter instanceT�win32NFrr�)r$rcrr%�is_abs�basenamerdrXrY�splitext�endswith�lenr[rr_�zipr^rr	r
)rRr��impl_must_matchr��	spec_path�suffix�our�reqrrr�	satisfiess,

(�zPythonInfo.satisfiescCs&|jdur|jtj|ddd�|_|jS)��
        This locates the current host interpreter information. This might be different than what we run into in case
        the host python has been upgraded from underneath us.
        NTF��raise_on_error�resolve_to_host)�_current�from_exerXrc�r�r�rrr�current7�
zPythonInfo.currentcCs&|jdur|jtj|ddd�|_|jS)r�NTr�)�_current_systemr�rXrcr�rrr�current_systemAr�zPythonInfo.current_systemcCstj|��dd�S)NrJ)�indent)�json�dumps�_to_dictrQrrr�_to_jsonKr�zPythonInfo._to_jsoncs*�fdd�t��D�}|d��|d<|S)Ncs$i|]}||dvrt�|�nd�qS))rN)rb)r*�varrQrrr>Pr?z'PythonInfo._to_dict.<locals>.<dictcomp>r^)�vars�_asdict)rR�datarrQrr�OszPythonInfo._to_dictTc

Cs�ddlm}|dur
tjn|}|||||||d�}t|t�rK|rKz	|�||�}W|StyJ}	z|r5|	�t�	d|j
|	�d}WYd}	~	|Sd}	~	ww|S)z8Given a path to an executable get the python informationr)r�N)�envr��ignore_cachez-ignore %s due cannot resolve system due to %r)r�r�rrrr�_resolve_to_system�	Exception�logging�inford)
r�r�r�r�r�r�r�r��proposed�	exceptionrrrr�Us ���zPythonInfo.from_execCs"t�|�}|�dd�|��D��S)NcSr�rrr@rrrr>lr�z)PythonInfo._from_json.<locals>.<dictcomp>)r��loads�
_from_dictrt)r��payload�rawrrr�
_from_jsonhs
zPythonInfo._from_jsoncCs4tdi|d��|d<|�}dd�|��D�|_|S)Nr^cSr�rrr@rrrr>rr�z)PythonInfo._from_dict.<locals>.<dictcomp>r)rrtr�)r�r�r�rrrrnszPythonInfo._from_dictc	Cs�|j}t�}|jduri|jp|jp|j}||vrXt|�dkr)t�d|�|j|_n@t	|�
�dd�D]\}\}}t�d|||�q1t�dt|�d||�td�
d�|������|||<|j||dd�}|jdus|j|jkrv|�|j|�}||_|S)	NrEz$%r links back to itself via prefixes)�startz%d: prefix=%s, info=%rz prefixes are causing a circle {}�|F)r1�exact)rcrrfr3r2r1r�rr�	enumeratert�error�RuntimeErrorr�r��keys�discover_exer�)	r�r��target�start_executabler�r1�at�p�trrrr�us(

�zPythonInfo._resolve_to_systemc
Cs||f}||jvr|rt�d|||j|�|j|St�d||�|��}|�|�}g}|dur4tjn|}|D] }	|D]}
|�||	|
|||�}|durW||j|<|Sq<q8|dury|ry|�||�}tj	�
|�}||j|<t�d||�|Sd�d�
|�tj	�
|��}
t|
��)Nz)discover exe from cache %s - exact %s: %rzdiscover exe for %s in %sFzFno exact match found, chosen most similar of %s within base folders %szfailed to detect {} in {}r
)
r�r�debug�_find_possible_exe_names�_find_possible_foldersrr�
_check_exe�_select_most_likelyrr�r�r)rRr�r1rr�r��possible_names�possible_folders�
discovered�folderrar�folders�msgrrrr�s2


��
zPythonInfo.discover_exec
Cs�tj�||�}tj�|�sdS|j||dd|d�}|durdSdD]A}	t||	�}
t||	�}|
|krb|	dkrJd�dd�|
D��d�dd�|D��}
}|j}t�d||	|
|�|dur_|�	|�dSq!|S)	NF)r�r�r�)r[r_r^r^r�csr�r#r�r)rrrr-�r.z(PythonInfo._check_exe.<locals>.<genexpr>z2refused interpreter %s because %s differs %s != %s)
rr$r�r�r�rbrcrr�append)
rRr�rrarrr��exe_pathr�item�found�searchedrcrrrr�s(

*
�	zPythonInfo._check_execs&�fdd�}t||dd�}|d}|S)Ncs||j�jk|jj�jjk|jj�jjk|j�jk|jj�jjk|jj�jjk|jj�jjkg}tdd�t	t
|��D��}|S)Ncss$�|]
\}}|rd|>ndVqdS)rErNr)r*�pos�matchrrrr-�s�"zBPythonInfo._select_most_likely.<locals>.sort_by.<locals>.<genexpr>)r[r^rr	r_r
rr�sumr�reversed)r�matches�priority�rrr�sort_by�s

�	z/PythonInfo._select_most_likely.<locals>.sort_byT)r��reverser)�sorted)rrr-�sorted_discovered�most_likelyrr,rr�szPythonInfo._select_most_likelycCs�t�}t�}d|tj�|j�<d||j<d|tj�|j�<d||j<|��D]}tj�|�}|�|j	�rE|t
|j	�d�}d|d�||�<q&d||<tdd�|��D��S)Nz{}{}css �|]}tj�|�r|VqdSr#)rr$r�r)rrrr-�s�z4PythonInfo._find_possible_folders.<locals>.<genexpr>)
rrr$�realpathrcrdrr�rOr1r�r�r)rR�
inside_folder�candidate_folder�executablesr�r��relativerrrr�s

�z!PythonInfo._find_possible_foldersc
Cs�t�}|��D]2}dD]-}d�dd�|jd|�D��}d�|j�dfD]}tD]}d�||||�}d||<q(q$qqt|���S)N)r�rJrErr�csr�r#r�r)rrrr-�r.z6PythonInfo._find_possible_exe_names.<locals>.<genexpr>z-{}r
z{}{}{}{})	r�_possible_baser�r^r�r_�
EXTENSIONSrr)rR�name_candidaterarr`�arch�ext�	candidaterrrr�s
���z#PythonInfo._find_possible_exe_namesccs��t�}tj�tj�|j��d�t�}d||<d||j<d|vr$|d=d|d<|D]$}|�	�}|Vddl
m}|�rN||krC|V|��}||krN|Vq*dS)NrrK)�fs_is_case_sensitive)
rrr$r�r�rc�rstriprr[r�virtualenv.infor=�upper)rR�
possible_baser�r�rr=r@rrrr7�s(� 
��zPythonInfo._possible_base)Fr#)NTFTN)TN).r��
__module__�__qualname__�__doc__r�rer��staticmethodrs�propertyr�r�r�r�r�rr�r{r�r�rPr�r�r�r�r��classmethodr�r�r�r�r�r�r�r�r�rrr�r�rrrrrr7rrrrrsrR	










 

		




r�__main__)rD�
__future__rrr�rrrY�rerXr<r��collectionsrr�stringrrrr8�compilerw�objectrr��printr�rrrr�<module>s.
m�

https://t.me/RX1948 - 2025