U
    b^	                     @   sT   d dl mZmZ d dlZd dlZd dlmZ G dd deZdZ	G dd deZ
dS )	    )absolute_importunicode_literalsN)ensure_textc                   @   s   e Zd ZdZdd Zedd Zedd Zedd	 Zed
d Z	edd Z
dd Zdd Zdd Zdd Zdd Zdd ZdS )Sessionz1Represents a virtual environment creation sessionc                 C   s(   || _ || _|| _|| _|| _|| _d S N)
_verbosity	_app_data_interpreter_creator_seeder_activators)self	verbosityZapp_datainterpretercreatorseeder
activators r   4/usr/lib/python3/dist-packages/virtualenv/session.py__init__   s    zSession.__init__c                 C   s   | j S )zThe verbosity of the run)r   r   r   r   r   r      s    zSession.verbosityc                 C   s   | j S )z@Create a virtual environment based on this reference interpreter)r	   r   r   r   r   r      s    zSession.interpreterc                 C   s   | j S )z[The creator used to build the virtual environment (must be compatible with the interpreter))r
   r   r   r   r   r      s    zSession.creatorc                 C   s   | j S )zHThe mechanism used to provide the seed packages (pip, setuptools, wheel))r   r   r   r   r   r   #   s    zSession.seederc                 C   s   | j S )z/Activators used to generate activations scripts)r   r   r   r   r   r   (   s    zSession.activatorsc                 C   s(   |    |   |   | jj  d S r   )_create_seed	_activater   Z	pyenv_cfgwriter   r   r   r   run-   s    zSession.runc                 C   s@   t dtt| j | j  t t t dt| j d S )Nz!create virtual environment via %sz%s)	logginginfor   strr   r   debug_DEBUG_MARKER_Debugr   r   r   r   r   3   s    

zSession._createc                 C   s2   | j d k	r.| j jr.td| j  | j | j d S )Nzadd seed packages via %s)r   enabledr   r   r   r   r   r   r   r   r   9   s    zSession._seedc                 C   s@   | j r<tdddd | j D  | j D ]}|| j q*d S )Nzadd activators for %sz, c                 s   s    | ]}t |jd dV  qdS )Z	Activator N)type__name__replace).0ir   r   r   	<genexpr>A   s     z$Session._activate.<locals>.<genexpr>)r   r   r   joinZgenerater   )r   Z	activatorr   r   r   r   >   s     
zSession._activatec                 C   s   | S r   r   r   r   r   r   	__enter__F   s    zSession.__enter__c                 C   s   | j   d S r   )r   close)r   exc_typeZexc_valexc_tbr   r   r   __exit__I   s    zSession.__exit__N)r%   
__module____qualname____doc__r   propertyr   r   r   r   r   r   r   r   r   r+   r/   r   r   r   r   r   	   s$   




r   zJ============================== target debug ==============================c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	r!   zlazily populate debugc                 C   s
   || _ d S r   )r   )r   r   r   r   r   r   S   s    z_Debug.__init__c                 C   s   t t| S r   )r   reprr   r   r   r   __unicode__V   s    z_Debug.__unicode__c                 C   s   t j| jjddS )N   )indent)jsondumpsr   r   r   r   r   r   __repr__Y   s    z_Debug.__repr__N)r%   r0   r1   r2   r   r5   r:   r   r   r   r   r!   P   s   r!   )Z
__future__r   r   r8   r   Zvirtualenv.util.sixr   objectr   r    r!   r   r   r   r   <module>   s   D