
    wi                        d dl mZ d dlZd dlZd dlZd dlZd dlmZ  ej        e	          Z
d	dZ G d d          Zd
dZe	dk    r e             dS dS )    )annotationsN)default_timerc                r   |t           j        n|}t                      }ddlm} ddlm} | t          j        dd          } 	  || ||          }t          
                    t          ||                     d S # |$ rz}t          d|j         d|j                    t          |j        t          j        d           t          |j        t          j        d           t'          |j                  d }~wt(          $ r6}|j        t*          j        k    rt          d	t          j        
            d }~ww xY w)Nr   )cli_run)ProcessCallFailedError   zsubprocess call failed for z with code  )fileendzOSError: [Errno 24] Too many open files. You may need to increase your OS open files limit.
  On macOS/Linux, try 'ulimit -n 2048'.
  For Windows, this is not a common issue, but you can try to close some applications.)r
   )osenvironr   virtualenv.runr   virtualenv.util.errorr   sysargvLOGGERwarning
LogSessionprintcmdcodeoutstdouterrstderr
SystemExitOSErrorerrnoEMFILE)argsoptionsenvstartr   r   session	exceptions           c/root/.openclaw/workspace/chatterbox_venv_py311/lib/python3.11/site-packages/virtualenv/__main__.pyrunr'      s^   "**COOE&&&&&&<<<<<<|x|'$--z'51122222! ) ) )VIMVVinVVWWWim#*"5555im#*"5555(((   ?el**i Z	    	s%   5A9 9D6>A5C33D6 1D11D6c                      e Zd ZddZddZdS )	r   returnNonec                "    || _         || _        d S N)r$   r#   )selfr$   r#   s      r&   __init__zLogSession.__init__(   s    


    strc                   | j         j        j        j        }t	                      | j        z
  dz  }d| d|ddd| j         j        g}| j         j        j        r|                    d| j         j                   | j         j        j	        
                                }t          d |D                       }|                    d	d
                    |                      | j         j        r?|                    dd                    d | j         j        D                                   d                    |          S )Ni  zcreated virtual environment z in z.0fmsz
  creator z	  seeder c              3     K   | ]<}|j         d k    d                    |j                            d                    V  =dS )z
.dist-infoz==-N)suffixjoinstemsplit.0is     r&   	<genexpr>z%LogSession.__str__.<locals>.<genexpr>6   sI      eeqAHXdLdLddiiS(9(9::LdLdLdLdeer/   z    added seed packages: z, z  activators ,c              3  .   K   | ]}|j         j        V  d S r,   )	__class____name__r9   s     r&   r<   z%LogSession.__str__.<locals>.<genexpr>:   s'      1h1h1!+2F1h1h1h1h1h1hr/   
)r$   creatorinterpreterspecr   r#   seederenabledappendpurelibiterdirsortedr6   
activators)r-   rD   elapsedlinespathpackagess         r&   __str__zLogSession.__str__,   sC   |#/4 ??TZ/47D4DDWDDDD1-11
 <& 	LLL<T\%8<<===<'/7799DeeDeeeeeHLLJTYYx5H5HJJKKK<" 	lLLj1h1hPTP\Pg1h1h1h)h)hjjkkkyyr/   N)r)   r*   )r)   r0   )r@   
__module____qualname__r.   rP    r/   r&   r   r   '   s<                      r/   r   c                r   ddl m} |t          j        n|} |            }	 t	          | ||           d S # t
          t          t          f$ r}	 t          |dd          r t          |t                    r|j
        dk    s.t                              dt          |          j        |           t          |t                    r|j
        nd}t          j        |           t          j        D ]}|                                 n(# t          j        D ]}|                                 w xY wY d }~d S d }~ww xY w)Nr   )VirtualEnvOptionswith_tracebackFz%s: %sr   )virtualenv.config.cli.parserrU   r   r   r'   KeyboardInterruptr   	Exceptiongetattr
isinstancer   r   errortyper@   r   exithandlersflush)r    r"   rU   r!   r%   r   handlers          r&   run_with_catchrb   >   sa   >>>>>>"**C!!G D'3z95 
  
  
 		 w 0%88 y*55 L).A:M:MXtI'?KKK%/	:%F%FM9>>ADHTNNN!?     6?                 
 s(   5 D6BD$D1%D((D11D6__main__)NNN)NN)
__future__r   r   loggingr   r   timeitr   	getLoggerr@   r   r'   r   rb   rS   r/   r&   <module>rh      s    " " " " " "   				 



            		8	$	$   6               .       ( zN r/   