Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib/python3.7/site-packages/virtualenv/create/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/virtualenv/create/__pycache__/creator.cpython-37.pyc

B

���a�"�@s*ddlmZmZmZddlZddlZddlZddlZddlm	Z	m
Z
ddlmZddl
mZddlmZddlmZddlmZdd	lmZdd
lmZddlmZmZddlmZmZdd
lm Z ddl!m"Z"ddl#m$Z$eej%�&e'��j(Z)e)dZ*Gdd�de+�Z,ee	�Gdd�de+��Z-dd�Z.dS)�)�absolute_import�print_function�unicode_literalsN)�ABCMeta�abstractmethod)�ArgumentTypeError)�literal_eval)�OrderedDict)�dedent)�
add_metaclass)�LogCmd)�
WIN_CPYTHON_2)�Path�safe_delete)�
ensure_str�ensure_text)�run_cmd)�__version__�)�PyEnvCfgzdebug.pyc@seZdZdd�ZdS)�CreatorMetacCs
d|_dS)N)�error)�self�r�J/opt/alt/python37/lib/python3.7/site-packages/virtualenv/create/creator.py�__init__szCreatorMeta.__init__N)�__name__�
__module__�__qualname__rrrrrrsrc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	edd
��Z
edd��Zedd��Z
dd�Zdd�Zdd�Zedd��Zdd�ZdS)�CreatorzEA class that given a python Interpreter creates a virtual environmentcCsJ||_d|_t|j�|_|j|_|j|_t�|j�|_|j	|_	|j
|_
dS)z�Construct a new virtual environment creator.

        :param options: the CLI option as parsed from :meth:`add_parser_arguments`
        :param interpreter: the interpreter to create virtual environment from
        N)�interpreter�_debugr�dest�clear�
no_vcs_ignorerZfrom_folder�	pyenv_cfg�app_data�env)r�optionsr rrrr%szCreator.__init__cCst|���S)N)r�__unicode__)rrrr�__repr__4szCreator.__repr__cCs$d�|jjd�dd�|��D���S)Nz{}({})z, css|]\}}d�||�VqdS)z{}={}N)�format)�.0�k�vrrr�	<genexpr>8sz&Creator.__unicode__.<locals>.<genexpr>)r+�	__class__r�join�_args)rrrrr)7szCreator.__unicode__cCs$dtt|j��fd|jfd|jfgS)Nr"r#r$)r�strr"r#r$)rrrrr2:sz
Creator._argscCsdS)aDetermine if we can create a virtual environment.

        :param interpreter: the interpreter in question
        :return: ``None`` if we can't create, any other object otherwise that will be forwarded to                   :meth:`add_parser_arguments`
        Tr)�clsr rrr�
can_createAszCreator.can_createcCs>|jdd|jd�|jdddddd	�|jd
ddddd	�d
S)aAdd CLI arguments for the creator.

        :param parser: the CLI parser
        :param app_data: the application data folder
        :param interpreter: the interpreter we're asked to create virtual environment for
        :param meta: value as returned by :meth:`can_create`
        r"z!directory to create virtualenv at)�help�typez--clearr#�
store_truezZremove the destination directory if exist before starting (will overwrite files otherwise)F)r"�actionr6�defaultz--no-vcs-ignorer$z>don't create VCS ignore directive in the destination directoryN)�add_argument�
validate_dest)r4�parserr �metar&rrr�add_parser_argumentsKs 	
zCreator.add_parser_argumentscCst�dS)z)Perform the virtual environment creation.N)�NotImplementedError)rrrr�createhszCreator.createc	Cs�dd�}t��}t�}|dkr&ddini}xXt|�D]L}y*|j|f|��|�}||krXw4t|��Wq4tk
r~d||<Yq4Xq4W|r�td�|d�	|�
��|���tj|kr�td	�|tj���t
|�}|��r�|��r�td
�|���dtjkr�dk�rnnt
tj�|��}	nt
tj�t|�����}	|	}xb|	�r�|	���rht�tt|	��tj��r^Pn
||	|�|	j|	j}
}|
|	k�r�||	|�|
}	�q2Wt|�S)
zANo path separator in the path, valid chars and must be write-ablecSs2ttj�|j|jg��}td�|�|�|���dS)Nz*the destination {} is not write-able at {})r�os�path�commonprefix�partsrr+�relative_to)r"�value�commonrrr�non_write_ableqsz-Creator.validate_dest.<locals>.non_write_able�mbcs�errors�ignoreNzDthe file system codec ({}) cannot handle characters {!r} within {!r}�zddestination {!r} must not contain the path separator ({}) as this would break the activation scriptsz/the destination {} already exists and is a file)�rN)rN�)�sys�getfilesystemencodingr	r�encode�decode�
ValueErrorrr+r1�keysrB�pathsepr�exists�is_file�version_inforC�realpath�abspathr3�resolve�access�W_OK�parent�name)r4Z	raw_valuerI�encodingZrefused�kwargs�charZtriprGr"�base�_rrrr<msN





zCreator.validate_destcCsJ|j��r(|jr(t�d|j�t|j�|��|��|jsF|�	�dS)Nz	delete %s)
r"rWr#�logging�debugrrA�
set_pyenv_cfgr$�setup_ignore_vcs)rrrr�run�s
zCreator.runcCsRt�|j_|jj|jd<|jj|jd<d�dd�|jjD��|jd<t|jd<dS)N�home�implementation�.css|]}t|�VqdS)N)r3)r,�irrrr/�sz(Creator.set_pyenv_cfg.<locals>.<genexpr>rYZ
virtualenv)	r	r%�contentr Zsystem_exec_prefixrlr1rYr)rrrrrh�s

zCreator.set_pyenv_cfgcCs(|jd}|��s$|�td����dS)z9Generate ignore instructions for version control systems.z
.gitignoreze
                    # created by virtualenv automatically
                    *
                    N)r"rWZ
write_textr
�lstrip)rZ
git_ignorerrrri�s

zCreator.setup_ignore_vcscCs4|jdkr.|jdk	r.t|j|��|j|j�|_|jS)zt
        :return: debug information about the virtual environment (only valid after :meth:`create` has run)
        N)r!Zexe�get_env_debug_info�debug_scriptr&r')rrrrrg�sz
Creator.debugcCstS)N)�DEBUG_SCRIPT)rrrrrr�szCreator.debug_scriptN)rrr�__doc__rr*r)r2�classmethodr5r?rrAr<rjrhri�propertyrgrrrrrrr!s
:	
rc

Cs�|��}|�td�d�|�|��J}t|�t|�g}trFdd�|D�}t�td�t|��t|�\}}}WdQRXy,|dkr�t	|�}n
t
�|�}|r�||d<Wn0tk
r�}	z|||t
|	�d�Sd}	~	XYnXd|kr�d	|dkr�|dd	d=|S)
N�
PYTHONPATHcSsg|]}t|��qSr)r)r,rnrrr�
<listcomp>�sz&get_env_debug_info.<locals>.<listcomp>zdebug via %rr�err)�outry�
returncode�	exceptionrPrC)�copy�popr3Zensure_extractedr
rfrgrrr�json�loads�	Exception�repr)
Zenv_exerrr&r'�cmd�coderzry�resultr|rrrrq�s&

 rq)/�
__future__rrrrrfrBrP�abcrr�argparser�astr�collectionsr	�textwrapr
ZsixrZ#virtualenv.discovery.cached_py_inforZvirtualenv.infor
Zvirtualenv.util.pathrrZvirtualenv.util.sixrrZvirtualenv.util.subprocessrZvirtualenv.versionrr%rrCr[�__file__r_ZHERErs�objectrrrqrrrr�<module>s07

Hacked By AnonymousFox1.0, Coded By AnonymousFox