HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/virtualenv/discovery/__pycache__/builtin.cpython-310.pyc
o

3�h�%�@s6ddlmZddlZddlZddlZddlmZddlmZddl	m
Z
ddlmZddl
mZdd	lmZmZdd
lmZddlmZe
r`ddlmZdd
lmZmZmZmZmZddlmZe� e!�Z"Gdd�de�Z#	d,d-dd�Z$		d,d.dd�Z%d/d"d#�Z&Gd$d%�d%�Z'd0d'd(�Z(Gd)d*�d*e�Z)gd+�Z*dS)1�)�annotationsN)�suppress)�Path)�
TYPE_CHECKING)�user_data_path�)�Discover)�IS_WIN�
fs_path_id)�
PythonInfo)�
PythonSpec)�ArgumentParser)�Callable�	Generator�Iterable�Mapping�Sequence)�AppDatacsZeZdZUded<ded<ded<d�fdd	�Zeddd
��Zddd�Zddd�Z�Z	S)�Builtinz
Sequence[str]�python_specr�app_data�try_first_with�return�NonecsZt��|�|jptjg|_|j�d�r#|jdd�|jdd�|_|j|_|j	|_	dS)N�VIRTUALENV_PYTHONr)
�super�__init__�python�sys�
executabler�_env�getrr)�self�options��	__class__��G/usr/local/lib/python3.10/dist-packages/virtualenv/discovery/builtin.pyrszBuiltin.__init__�parserr
c
Cs6|jddddtdgdd�|jdd	d
tdgdd�dS)Nz-pz--pythonr�py�appendz�interpreter based on what to create environment (path/identifier) - by default use the interpreter where the tool is installed - first found wins)�dest�metavar�type�action�default�helpz--try-first-withr�py_exez:try first these interpreters before starting the discovery)�add_argument�str)�clsr(r&r&r'�add_parser_arguments&s&�
�zBuiltin.add_parser_arguments�PythonInfo | NonecCs4|jD]}t||j|j|j�}|dur|SqdS�N)r�get_interpreterrrr )r"r�resultr&r&r'�run=s
�zBuiltin.runr3cCs0t|j�dkr|jdn|j}|jj�d|��S)Nrrz discover of python_spec=)�lenrr%�__name__)r"�specr&r&r'�__repr__DszBuiltin.__repr__)rr)r(r
rr)rr6�rr3)
r<�
__module__�__qualname__�__annotations__r�classmethodr5r:r>�
__classcell__r&r&r$r'rs

rr�
Iterable[str]r�AppData | None�env�Mapping[str, str] | Nonerr6cCs�t�|�}t�d|�t�}|durtjn|}t||||�D])\}}|j|f}||vr,qt�d|�|�	||�rBt�
d|�|S|�|�qdS)Nzfind interpreter for spec %rzproposed %szaccepted %s)r�from_string_spec�LOGGER�info�set�os�environ�propose_interpreters�system_executable�	satisfies�debug�add)�keyrrrGr=�proposed_paths�interpreter�impl_must_matchr&r&r'r8Is

r8r=r�.Generator[tuple[PythonInfo, bool], None, None]c	cs&�|durtjn|}t�}|jrDzt�|j�Wn
ty"YdSwtj�|j�}t|�}||vrB|�	|�t
j|||d�dfVdS|D]8}tj�|�}zt�|�Wn	ty^YqFwtj�|�}t|�}||vrnqF|�	|�t
j|||d�dfVqF|jdur�zt�|j�Wn	ty�Yn wtj�|j�}t|�}||vr�|�	|�t
j|||d�dfV|jr�dSnFt
�|�}	t
|	j�}t|�}||vr�|�	|�|	dfVt�rddlm}
|
|||�D]}t
|j�}t|�}||vr�q�|�	|�|dfVq�t|�}tt|��D]?\}
}t�t|
||��||�D],\}}t
|�}t|�}||v�r/�q|�	|�tj||d|d�}|du�rG||fV�q�qt�d�}�rZt|���}nt�d�}�rmt|���d	d
}ntd	�d
}|�d�D]}tjt
|�|d|d�}|du�r�|dfV�qxdS)N)rGTr)rOF)�raise_on_errorrG�UV_PYTHON_INSTALL_DIR�
XDG_DATA_HOME�uvrz*/bin/python)rMrNrL�is_abs�lstat�path�OSError�abspathr
rSr�from_exe�current_systemr3rr	�windowsrO�path_exe_finder�	enumerate�	get_pathsrJrR�LazyPathDump�PathPythonInfo�getenvr�
expanduserr�glob)r=rrrG�tested_exes�exe_raw�exe_idr1r_�current_pythonrOrV�find_candidates�pos�exerW�
uv_python_dir�uv_python_path�
xdg_data_home�exe_pathr&r&r'rO\s���
�

�
�









��

��rO�Mapping[str, str]�Generator[Path, None, None]c	cs��|�dd�}|dur!zt�d�}Wnttfy tj}Ynw|rQtt|�tj	��D]&}t
t��|��rAt
|��d�rA|VWd�n1sKwYq,dSdS)N�PATH�CS_PATH)r!rM�confstr�AttributeError�
ValueError�defpath�mapr�split�pathseprr`�is_dir�next�iterdir)rGr_�pr&r&r'rg�s$�
�
����rgc@s eZdZdd	d
�Zddd
�ZdS)rhrr�intr_rrGrxrrcCs||_||_||_dSr7)rrr_rG)r"rrr_rGr&r&r'r�s
zLazyPathDump.__init__r3c	s�d|j�d|j��}|j�d�r[|d7}|j��D]A�z,���r"Wqtr<|j�dd��d�}t�fdd	�|D��s;Wqn
��	�j
tj@sFWqWn	t
yPYnw|d
7}|�j7}q|S)Nzdiscover PATH[z]=�_VIRTUALENV_DEBUGz with =>�PATHEXTz.COM;.EXE;.BAT;.CMD�;c3s �|]}�j���|�VqdSr7)�name�upper�endswith)�.0�ext��	file_pathr&r'�	<genexpr>�s�z(LazyPathDump.__repr__.<locals>.<genexpr>� )rrr_rGr!r�r�r	r��any�stat�st_moderM�X_OKr`r�)r"�content�pathextr&r�r'r>�s*���zLazyPathDump.__repr__N)rrr�r_rrGrxrrr?)r<r@rArr>r&r&r&r'rh�s
rh�:Callable[[Path], Generator[tuple[Path, bool], None, None]]cs@|jtjdkd��|j�tjdkr��d��d��fdd	�}|S)z^Given a spec, return a function that can be called on a path to find all matching files in it.�win32)rdz.exer_rr�(Generator[tuple[Path, bool], None, None]c3sT�|�}|��r|dfV|��D]}��|j�}|r'|��|ddkfVqdS)NF�implr)�existsr��	fullmatchr��absolute)r_�direct_pathrs�match��direct�patr&r'�	path_exes�s�
��z"path_exe_finder.<locals>.path_exesN)r_rrr�)�generate_rer�platform�str_spec)r=r�r&r�r're�s


rec@seZdZdZdS)rizpython info from path.N)r<r@rA�__doc__r&r&r&r'risri)rrir8)NN)rrErrFrGrHrr6)
r=rrrErrFrGrHrrX)rGrxrry)r=rrr�)+�
__future__r�loggingrMr�
contextlibr�pathlibr�typingr�platformdirsr�discoverrrKr	r
�py_infor�py_specr�argparser
�collections.abcrrrrr�virtualenv.app_data.baser�	getLoggerr<rJrr8rOrgrhreri�__all__r&r&r&r'�<module>s8
1��
d