Your IP : 3.135.201.101


Current Path : /usr/lib64/python3.8/venv/__pycache__/
Upload File :
Current File : //usr/lib64/python3.8/venv/__pycache__/__init__.cpython-38.opt-2.pyc

U

e5dFR�
@s�ddlZddlZddlZddlZddlZddlZddlZe�e�Z	Gdd�d�Z
d
dd�Zddd�Zed	kr�d
Z
ze�dZ
Wn4ek
r�Zzedeejd�W5dZ[XYnXe�e
�dS)�Nc@s�eZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zej	d
krHddd�Z
n
ddd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS) �
EnvBuilderFNcCs(||_||_||_||_||_||_dS�N��system_site_packages�clear�symlinks�upgrade�with_pip�prompt)�selfrrrrr	r
�r�%/usr/lib64/python3.8/venv/__init__.py�__init__+szEnvBuilder.__init__cCsxtj�|�}|�|�}|j}d|_|�|�|�|�|jrF|�|�|j	s`|�
|�|�|�|rtd|_|�|�dS)NFT)�os�path�abspath�ensure_directoriesr�create_configuration�setup_pythonr	�
_setup_pipr�
setup_scripts�
post_setup)r�env_dir�contextZtrue_system_site_packagesrrr
�create4s





zEnvBuilder.createcCs\t�|�D]L}tj�||�}tj�|�s4tj�|�r@t�|�q
tj�|�r
t�	|�q
dSr)
r�listdirr�join�islink�isfile�remove�isdir�shutilZrmtree)rr�fnrrr
�clear_directoryNszEnvBuilder.clear_directorycCs�dd�}tj�|�r$|jr$|�|�t��}||_tj�|�d|_	|j
dk	rT|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�|
|�|_||
�|S)NcSs@tj�|�st�|�n$tj�|�s0tj�|�r<td|��dS)NzUnable to create directory %r)rr�exists�makedirsrr�
ValueError)�drrr
�create_if_needed^sz7EnvBuilder.ensure_directories.<locals>.create_if_needed�z(%s) Zwin32ZScriptsZInclude�Libz
site-packages�binZinclude�libzpython%d.%d�l�posix�darwin�lib64)rrr$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)rrr(rr
r7�dirnameZexenameZbinnameZincpathZlibpathrZ	link_path�binpathrrr
rVsL



��zEnvBuilder.ensure_directoriesc	Cs�tj�|jd�|_}t|ddd��j}|�d|j�|jrBd}nd}|�d|�|�d	t	j
dd
��|jdk	r�|�d|j�d��W5QRXdS)
Nz
pyvenv.cfg�w�utf-8)�encodingz
home = %s
�trueZfalsez"include-system-site-packages = %s
zversion = %d.%d.%d
�z	prompt = �
)rrrrZcfg_path�open�writer8rr5r:r
)rrr�fZinclrrr
r�s	
zEnvBuilder.create_configuration�ntcCs~|j}|sjz6tj�|�s@|r4t�tj�|�|�nt�||�Wn&tk
rht�d||�d}YnX|rzt	�
||�dS)N�Unable to symlink %r to %rT)rrrrr=�basename�	Exception�logger�warningr!�copyfile)r�src�dst�relative_symlinks_okZ
force_copyrrr
�symlink_or_copy�s
zEnvBuilder.symlink_or_copycCs\tj�|�otj�|�}|jr�|s�tj�|�s�z,|rLt�tj�|�|�nt�||�WdStk
r~t	�
d||�YnXtj�tj�|��\}}tj�tj�
t�dd||�}t�d�s�tj�|��s$|�d�r�d|}|dd�}|dkr�d}n|d	k�rd
}tj�tj�
|�||�}n|}tj�|��sL|�sHt	�
d|�dSt�||�dS)NrM�scriptsrLTZ_d����pythonZvenvlauncherZpythonwZ
venvwlauncherzUnable to copy %r)rr�lexistsr$rrr=rNrOrPrQ�splitextrrA�__file__�	sysconfig�is_python_buildr�endswithr!rR)rrSrTrUZbad_srcrNZextZsrcfnrrr
rV�s<�

cCs�|j}|j}|j}|j}tjdkr�||j|�tj�|�sFt�	|d�dD]F}tj�
||�}tj�|�sJ||j|dd�tj�|�sJt�	|d�qJ�n|jr�dd�t�
|�D�}t�d�r�dd�|D�}nd	d
ddg}|D]2}tj�
||�}tj�|�r�||tj�
||��q�t�d��r�t�|j�D]z\}	}
}d
|k�r&tj�|	�}tj�
|jd|�}tj�|��spt�|�tj�
|	d
�}tj�
|d
�}
t�||
��q��q&dS)NrLi�)rYZpython3T)rUcSs,g|]$}tj�tj�|�d�dkr|�qS)r))�.exez.dll)rr�normcaser[��.0rKrrr
�
<listcomp>�s�z+EnvBuilder.setup_python.<locals>.<listcomp>cSs"g|]}tj�|��d�r|�qS))rYZ	vcruntime)rrra�
startswithrbrrr
rds�z
python.exezpython_d.exezpythonw.exez
pythonw_d.exezinit.tclr*)r>r@rVr8rr<r7rr�chmodrr$rrr]r^rZ�walkrNrr%r!rR)rrrBrZcopierrA�suffix�suffixesrS�root�dirs�filesZtcldirrTrrr
r�sP
�
��

zEnvBuilder.setup_pythoncCs$|jddddg}tj|tjd�dS)Nz-ImZ	ensurepip�	--upgradez
--default-pip)�stderr)r@�
subprocessZcheck_outputZSTDOUT)rr�cmdrrr
rs
�zEnvBuilder._setup_pipcCs2tj�tj�t��}tj�|d�}|�||�dS)NrW)rrrrAr\r�install_scripts)rrrrrr
r#szEnvBuilder.setup_scriptscCsdSrr)rrrrr
r2szEnvBuilder.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__)�replacerr4r
r?r@)r�textrrrr
�replace_variables<szEnvBuilder.replace_variablescCs�|j}t|�}t�|�D�]�\}}}||krX|dd�D]}|dtjfkr8|�|�q8q|D�]H}	tjdkr�|	�d�r�|	�d�r�q\tj�	||	�}
||d��
tj�dd�}|s�|}ntjj	|f|��}tj�|�s�t�
|�tj�	||	�}
t|
d��}	|	��}W5QRX|
�d��srz$|�d�}|�||�}|�d�}Wn6tk
�rp}zd}t�d|
|�W5d}~XYnX|dk	r\t|
d	��}	|	�|�W5QRXt�|
|
�q\qdS)
N�commonrLrY)r`z.pdbr-�rbrDz+unable to copy script %r, may be binary: %s�wb)r>�lenrrgr<rrer_rrr3�sepr$r%rI�read�decodert�encode�UnicodeErrorrPrQrJr!Zcopymode)rrrrBZplenrjrkrlr'rKZsrcfilerhZdstdirZdstfile�data�errr
rqNsL

�

�zEnvBuilder.install_scripts)FFFFFN)F)F)�__name__�
__module__�__qualname__rrr#rrrr<rVrrrrrtrqrrrr
rs&�
	4

+<	
rFcCs t|||||d�}|�|�dS)N)rrrr	r
)rr)rrrrr	r
�builderrrr
r�s�rc	Cs^d}tjdkrd}nttd�s"d}|s2td���n(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'�|�|�}|j�r"|j
�r"td(��t|j|j
|j|j|j|jd)�}|jD]}|�|��qHdS)*NT)rGrGF�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.)�progZdescriptionZepilogrkZENV_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�rLz
--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.rmrzlUpgrade 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�z1you cannot supply --upgrade and --clear together.r)r5r:�hasattrr&�argparse�ArgumentParserr��add_argumentrr<Zadd_mutually_exclusive_group�
parse_argsrrrr�rr	r
rkr)	�argsZ
compatibler��parserZuse_symlinks�groupZoptionsr�r'rrr
�main�s|

�

��
�
�
�
���
�
r��__main__r)z	Error: %s)�file)FFFFN)N)Zloggingrr!ror5r]r1Z	getLoggerr�rPrrr�ZrcrOr�printrn�exitrrrr
�<module>s0
q�

H$

?>