Your IP : 18.218.63.176


Current Path : /opt/alt/python39/lib64/python3.9/venv/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/venv/__pycache__/__init__.cpython-39.opt-2.pyc

a

R�f�Z�
@s�ddlZddlZddlZddlZddlZddlZddlZdZe�e	�Z
Gdd�d�Zddd�Zddd	�Z
e	d
kr�dZze
�dZWn6ey�Zzedeejd
�WYdZ[n
dZ[00e�e�dS)�N)�pipZ
setuptoolsc@s�eZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zej	d
krHd dd�Z
n
d!dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)"�
EnvBuilderFNcCsF||_||_||_||_||_|dkr6tj�t���}||_	||_
dS)N�.)�system_site_packages�clear�symlinks�upgrade�with_pip�os�path�basename�getcwd�prompt�upgrade_deps)�selfrrrrr	rr�r�2/opt/alt/python39/lib64/python3.9/venv/__init__.py�__init__.szEnvBuilder.__init__cCs�tj�|�}|�|�}|j}d|_|�|�|�|�|jrF|�|�|j	s`|�
|�|�|�|rtd|_|�|�|jr�|�
|�dS)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]L}tj�||�}tj�|�s4tj�|�r@t�|�q
tj�|�r
t�	|�q
dS�N)
r
�listdirr�join�islink�isfile�remove�isdir�shutilZrmtree)rr�fnrrr�clear_directoryWszEnvBuilder.clear_directorycCs�dd�}tj�|�r$|jr$|�|�t��}||_tj�|�d|_	|j
durT|j
n|j	}d||_
||�tj}tj�tj�
|��\}}||_||_||_tjdkr�d}d}	tj�|dd	�}
n(d
}d}	tj�|dd
tjdd�d	�}
tj�||	�|_}||�||
�tjdk�rXtjdk�rXtjdk�rXtj�|d�}tj�|��sXt�d|�tj�||�|_}
||_tj�|
|�|_||
�|j|_tjdk�r�tj�|j�}tj�|�tj�|j�k�r�t�d|j|�||_|S)NcSs@tj�|�st�|�n$tj�|�s0tj�|�r<td|��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) 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�
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��t}|�d|j�|jrBd}nd}|�d|�|�d	t	j
dd
��|jdur�|�d|j�d��Wd�n1s�0YdS)
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}|shz6tj�|�s@|r4t�tj�|�|�nt�||�Wn$tyft�d||�d}Yn0|rxt	�
||�dS)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_copycCsZtj�|�otj�|�}|jr~|s~tj�|�s~z,|rLt�tj�|�|�nt�||�WdSty|t	�
d||�Yn0tj�tj�|��\}}tj�tj�
t�dd||�}t�d�s�tj�|��s"|�d�r�d|}|dd�}|dkr�d}n|d	k�rd
}tj�tj�
|�||�}n|}tj�|��sJ|�sFt	�
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\�s<�

cCs�|j}|j}|j}|j}tjdkr�||j|�tj�|�sFt�	|d�dddt
jd��fD]F}tj�||�}tj�
|�s\||j|dd�tj�|�s\t�	|d�q\�n$|jr�d	d
�t�|�D�}t�d�r�dd
�|D�}n hd�}tj�|j�}|�|�|D]6}tj�||�}	tj�|	��r||	tj�||���qt�d��r�t�|j�D]z\}
}}d
|v�rPtj�|
�}
tj�|jd|
�}
tj�
|
��s�t�|
�tj�|
d
�}	tj�|
d
�}t�|	|��q̐qPdS)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�>zpythonw.exezpython_d.exez
python.exez
pythonw_d.exezinit.tclr/)rBrDr\r<r
r@r;rr"�chmodr9r>r!r)rr rcrdr�addr`�walkrr*r&rX)rrrKrZcopierrJ�suffix�suffixesZbase_exerY�root�dirs�filesZtcldirrZrrrr�sP
�
�


zEnvBuilder.setup_pythoncCs$|jddddg}tj|tjd�dS)Nz-ImZ	ensurepip�	--upgradez
--default-pip)�stderr)rE�
subprocessZcheck_outputZSTDOUT�rr�cmdrrrr2s
�zEnvBuilder._setup_pipcCs2tj�tj�t��}tj�|d�}|�||�dS)Nr])r
rrrJrbr!�install_scripts)rrrrrrr;szEnvBuilder.setup_scriptscCsdSrr)rrrrrrJszEnvBuilder.post_setupcCsJ|�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_variablesTszEnvBuilder.replace_variablescCs�|j}t|�}t�|�D�]�\}}}||krX|dd�D]}|dtjfvr8|�|�q8q|D�]x}	tjdkr�|	�d�r�|	�d�r�q\tj�	||	�}
||d��
tj�dd�}|s�|}ntjj	|g|�R�}tj�|�s�t�
|�tj�	||	�}
t|
d��}	|	��}Wd�n1�s0Y|
�d��s�z$|�d�}|�||�}|�d�}Wn8t�y�}zd}t�d|
|�WYd}~n
d}~00|dur\t|
d	��}	|	�|�Wd�n1�s�0Yt�|
|
�q\qdS)
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�errrrxfsJ

�
(
�*zEnvBuilder.install_scriptscCs@t�dt�d|j���|jddddg}|�t�t�|�dS)Nz
Upgrading z
 packages in z-mrZinstallrs)rH�debug�CORE_VENV_DEPSrBrE�extendruZ
check_callrvrrrr�s�
zEnvBuilder.upgrade_dependencies)FFFFFNF)F)F)�__name__�
__module__�__qualname__rrr(rrr
r@r\rrrrr{rxrrrrrrs$�

B

+=	
2rFcCs"t||||||d�}|�|�dS)N)rrrr	rr)rr)rrrrr	rr�builderrrrr�s
�rc	
Cs�d}tjdkrd}nttd�s"d}|s2td���nLddl}|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�|�|�}|j�rB|j�rBtd,��t|j|j|j|j|j|j|jd-�}|jD]}|�|��qldS).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.)�progZdescriptionZepilogrqZENV_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.rsrzlUpgrade 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)	�argsZ
compatibler��parserZuse_symlinks�groupZoptionsr�r,rrr�main�s~

�

��
�
�
�
���
��
�
r��__main__r.z	Error: %s)�file)FFFFNF)N)Zloggingr
r&rur9rcr5r�Z	getLoggerr�rHrrr�ZrcrWr��printrt�exitrrrr�<module>s0
�

N(

?>