Your IP : 3.17.174.204


Current Path : /opt/alt/python310/lib64/python3.10/venv/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/venv/__pycache__/__init__.cpython-310.opt-2.pyc

o

6��f�]�
@s�	ddlZddlZddlZddlZddlZddlZddlZdZe�e	�Z
Gdd�d�Z		ddd�Zddd	�Z
e	d
krgdZze
�dZWney_Zzedeejd
�WYdZ[ndZ[wwe�e�dSdS)�N)�pipZ
setuptoolsc@s�eZdZ				d!dd�Zdd�Zdd�Zd	d
�Zdd�Zej	d
kr(d"dd�Z
nd"dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �ZdS)#�
EnvBuilderFNcCsF||_||_||_||_||_|dkrtj�t���}||_	||_
dS)N�.)�system_site_packages�clear�symlinks�upgrade�with_pip�os�path�basename�getcwd�prompt�upgrade_deps)�selfrrrrr	rr�r�4/opt/alt/python310/lib64/python3.10/venv/__init__.py�__init__.s
zEnvBuilder.__init__cCs�	tj�|�}|�|�}|j}d|_|�|�|�|�|jr$|�|�|j	s1|�
|�|�|�|r;d|_|�|�|jrE|�
|�dSdS)NFT)r
r�abspath�ensure_directoriesr�create_configuration�setup_pythonr	�
_setup_pipr�
setup_scripts�
post_setupr�upgrade_dependencies)r�env_dir�contextZtrue_system_site_packagesrrr�create;s$






�zEnvBuilder.createcCs\t�|�D]&}tj�||�}tj�|�stj�|�r t�|�qtj�|�r+t�	|�qdS�N)
r
�listdirr�join�islink�isfile�remove�isdir�shutilZrmtree)rr�fnrrr�clear_directoryWs
��zEnvBuilder.clear_directorycCs�	dd�}tj�|�r|jr|�|�t��}||_tj�|�d|_	|j
dur+|j
n|j	}d||_
||�tj}|s@t
d��tj�tj�|��\}}||_||_||_tjdkrgd}d}	tj�|d	d
�}
nd}d}	tj�|d
dtjdd�d
�}
tj�||	�|_}||�||
�tjdkr�tjdkr�tjdkr�tj�|d�}tj�|�s�t�d
|�tj�||�|_}
||_tj�|
|�|_||
�|j|_tjdkr�tj�|j�}tj�|�tj�|j�kr�t� d|j|�||_|S)NcSsBtj�|�s
t�|�dStj�|�stj�|�rtd|��dS)NzUnable to create directory %r)r
r�exists�makedirsr"r#�
ValueError)�drrr�create_if_neededgs
�z7EnvBuilder.ensure_directories.<locals>.create_if_needed�z(%s) z�Unable to determine path to the running Python interpreter. Provide an explicit path or check that your PATH environment variable is correctly set.Zwin32ZScriptsZInclude�Libz
site-packages�binZinclude�libzpython%d.%d�l�posix�darwinZlib64z�Actual environment location may have moved due to redirects, links or junctions.
  Requested location: "%s"
  Actual location:    "%s")!r
rr)rr(�types�SimpleNamespacer�split�env_namer�sys�_base_executabler+r�
executable�
python_dirZ
python_exe�platformr!�version_infoZinc_path�maxsize�name�symlink�bin_path�bin_name�env_exe�env_exec_cmd�realpath�normcase�logger�warning)rrr-rrr;�dirnameZexenameZbinnameZincpathZlibpathrZ	link_path�binpathZreal_env_exerrrr_s`



�

�zEnvBuilder.ensure_directoriescCs�	tj�|jd�|_}t|ddd��C}|�d|j�|jr"d}nd}|�d|�|�d	t	j
dd
��|jdurN|�d|j�d��Wd�dSWd�dS1sYwYdS)
Nz
pyvenv.cfg�w�utf-8)�encodingz
home = %s
�trueZfalsez"include-system-site-packages = %s
zversion = %d.%d.%d
�z	prompt = �
)r
rr!rZcfg_path�open�writer<rr9r>r)rrr�fZinclrrrr�s
�"�zEnvBuilder.create_configuration�ntcCs�	|j}|s5ztj�|�s!|rt�tj�|�|�nt�||�Wnty4t�d||�d}Ynw|r?t	�
||�dSdS)N�Unable to symlink %r to %rT)rr
rr"rAr�	ExceptionrHrIr&�copyfile)r�src�dst�relative_symlinks_okZ
force_copyrrr�symlink_or_copy�s ���zEnvBuilder.symlink_or_copycCsX	tj�|�o
tj�|�}|jrB|sBtj�|�sBz|r)t�tj�|�|�WdSt�||�WdStyAt	�
d||�Ynwtj�tj�|��\}}tj�tj�
t�dd||�}t�d�shtj�|�s�|�d�rwd|}|dd�}|dkr~d}n|d	kr�d
}tj�tj�
|�||�}n|}tj�|�s�|s�t	�
d|�dSt�||�dS)NrV�scriptsrUTZ_d����pythonZvenvlauncherZpythonwZ
venvwlauncherzUnable to copy %r)r
r�lexistsr)rr"rArrWrHrI�splitextr!rJ�__file__�	sysconfig�is_python_buildr#�endswithr&rX)rrYrZr[Zbad_srcrZextZsrcfnrrrr\�sB���
cCs�	|j}|j}|j}|j}tjdkrU||j|�tj�|�s$t�	|d�dddt
jd��fD]#}tj�||�}tj�
|�sR||j|dd�tj�|�sRt�	|d�q/dS|jrod	d
�t�|�D�}t�d�rndd
�|D�}nhd�}tj�|j�}|�|�|D]}tj�||�}	tj�|	�r�||	tj�||��q�t�d�r�t�|j�D]<\}
}}d
|vr�tj�|
�}
tj�|jd|
�}
tj�
|
�s�t�|
�tj�|
d
�}	tj�|
d
�}t�|	|�dSq�dSdS)NrUi�r_Zpython3zpython3.r.T)r[cSs,g|]}tj�tj�|�d�dvr|�qS)r.)�.exez.dll)r
rrGra��.0rTrrr�
<listcomp>s
�z+EnvBuilder.setup_python.<locals>.<listcomp>cSs"g|]
}tj�|��d�r|�qS))r_Z	vcruntime)r
rrG�
startswithrgrrrris��>zpython_d.exez
pythonw_d.exezpythonw.exez
python.exezinit.tclr/)rBrDr\r<r
r@r;rr"�chmodr9r>r!r)rr rcrdr�addr`�walkrr*r&rX)rrrKrZcopierrJ�suffix�suffixesZbase_exerY�root�dirs�filesZtcldirrZrrrr�s`
��	�
��
�

��zEnvBuilder.setup_pythoncOsl	|jg|�}tj��|d<}|j|d<|�dd�|�dd�|j|d<|j|d<tj|fi|��dS)N�envZVIRTUAL_ENVZ
PYTHONHOMEZ
PYTHONPATH�cwdr;)rEr
�environ�copyr�pop�
subprocessZcheck_output)rrZpy_args�kwargs�argsrsrrr�_call_new_python7s


zEnvBuilder._call_new_pythoncCs	|j|ddddtjd�dS)N�-mZ	ensurepip�	--upgradez
--default-pip)�stderr)r{rxZSTDOUT�rrrrrrFs
�zEnvBuilder._setup_pipcCs4	tj�tj�t��}tj�|d�}|�||�dS)Nr])r
rrrJrbr!�install_scripts)rrrrrrrKs
zEnvBuilder.setup_scriptscCs	dSrrrrrrrZszEnvBuilder.post_setupcCsL	|�d|j�}|�d|j�}|�d|j�}|�d|j�}|�d|j�}|S)NZ__VENV_DIR__Z
__VENV_NAME__Z__VENV_PROMPT__Z__VENV_BIN_NAME__Z__VENV_PYTHON__)�replacerr8rrCrD)r�textrrrr�replace_variablesds
zEnvBuilder.replace_variablescCs�	|j}t|�}t�|�D]�\}}}||kr,|dd�D]}|dtjfvr*|�|�qq
|D]�}	tjdkr@|	�d�r@|	�d�r@q.tj�	||	�}
||d��
tj�dd�}|sZ|}n
tjj	|g|�R�}tj�|�sot�
|�tj�	||	�}
t|
d��}	|	��}Wd�n1s�wY|
�d�s�z|�d�}|�||�}|�d�}Wnty�}zd}t�d|
|�WYd}~nd}~ww|dur�t|
d	��
}	|	�|�Wd�n1s�wYt�|
|
�q.q
dS)
N�commonrUr_)rfz.pdbr2�rbrMz+unable to copy script %r, may be binary: %s�wb)rB�lenr
rmr@r$rjrerr!r7�sepr)r*rR�read�decoder��encode�UnicodeErrorrHrIrSr&Zcopymode)rrrrKZplenrprqrrr,rTZsrcfilernZdstdirZdstfile�data�errrr�vs\
��

�

�������zEnvBuilder.install_scriptscCs6t�dt�d|j���|j|ddddgt�R�dS)Nz
Upgrading z
 packages in r|rZinstallr})rH�debug�CORE_VENV_DEPSrBr{rrrrr�s��zEnvBuilder.upgrade_dependencies)FFFFFNF)F)�__name__�
__module__�__qualname__rrr(rrr
r@r\rr{rrrr�r�rrrrrrs*
�
G

+=
2rFcCs$	t||||||d�}|�|�dS)N)rrrr	rr)rr)rrrrr	rr�builderrrrr�s�rc	
Csxd}tjdkr
d}nttd�sd}|std��ddl}|jtddd	�}|jd
ddd
d�|jdddddd�tj	dkr>d}nd}|�
�}|jd|dddd�|jd|dddd�|jdddddd�|jddddd d�|jd!d"ddd#d$�|jd%d&d'�|jd(ddd)d*�d+�t
��d�|�|�}|jr�|jr�td,��t|j|j|j|j|j|j|jd-�}|jD]}|�|�q�dS).NT)rPrPF�base_prefixz.This script is only for use with Python >= 3.3rzFCreates virtual Python environments in one or more target directories.z|Once an environment has been created, you may wish to activate it, e.g. by sourcing an activate script in its bin directory.)�prog�descriptionZepilogrqZENV_DIR�+z)A directory to create the environment in.)�metavar�nargs�helpz--system-site-packages�
store_true�system_sitezDGive the virtual environment access to the system site-packages dir.)�default�action�destr�rUz
--symlinksrz[Try to use symlinks rather than copies, when symlinks are not the default for the platform.z--copiesZstore_falsez\Try to use copies rather than symlinks, even when symlinks are the default for the platform.z--clearrzcDelete the contents of the environment directory if it already exists, before environment creation.r}rzlUpgrade the environment directory to use this version of Python, assuming Python has been upgraded in-place.z
--without-pipr	z]Skips installing or upgrading pip in the virtual environment (pip is bootstrapped by default))r�r�r�r�z--promptz;Provides an alternative prompt prefix for this environment.)r�z--upgrade-depsrz;Upgrade core dependencies: {} to the latest version in PyPI� z1you cannot supply --upgrade and --clear together.)rrrrr	rr)r9r>�hasattrr+�argparse�ArgumentParserr��add_argumentr
r@Zadd_mutually_exclusive_group�formatr!r��
parse_argsrrrr�rr	rrrqr)	rzZ
compatibler��parserZuse_symlinks�groupZoptionsr�r,rrr�main�s�

�

��
�
�
�
���
��
�
�r��__main__r.z	Error: %s)�file)FFFFNFr)Zloggingr
r&rxr9rcr5r�Z	getLoggerr�rHrrr�ZrcrWr��printr~�exitrrrr�<module>s:

�
N���

?>