<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
B
    a"                 @   s*  d dl mZmZmZ d dlZd dlZd dlZd dlZd dlm	Z	m
Z
 d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZmZ d dlmZmZ d dlm Z  d dl!m"Z" ddl#m$Z$ eej%&e'j(Z)e)d Z*G dd de+Z,ee	G dd de+Z-dd Z.dS )    )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__   )PyEnvCfgzdebug.pyc               @   s   e Zd Zdd ZdS )CreatorMetac             C   s
   d | _ d S )N)error)self r   J/opt/alt/python37/lib/python3.7/site-packages/virtualenv/create/creator.py__init__   s    zCreatorMeta.__init__N)__name__
__module____qualname__r   r   r   r   r   r      s   r   c               @   s   e Zd ZdZdd Zdd Zdd Z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edd Zdd ZdS )CreatorzEA class that given a python Interpreter creates a virtual environmentc             C   sJ   || _ d| _t|j| _|j| _|j| _t| j| _|j	| _	|j
| _
dS )zConstruct 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_ignorer   Zfrom_folder	pyenv_cfgapp_dataenv)r   optionsr    r   r   r   r   %   s    zCreator.__init__c             C   s   t |  S )N)r   __unicode__)r   r   r   r   __repr__4   s    zCreator.__repr__c             C   s$   d | jjddd |  D S )Nz{}({})z, c             s   s   | ]\}}d  ||V  qdS )z{}={}N)format).0kvr   r   r   	<genexpr>8   s    z&Creator.__unicode__.<locals>.<genexpr>)r+   	__class__r   join_args)r   r   r   r   r)   7   s    zCreator.__unicode__c             C   s$   dt t| jfd| jfd| jfgS )Nr"   r#   r$   )r   strr"   r#   r$   )r   r   r   r   r2   :   s    zCreator._argsc             C   s   dS )a  Determine 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    r   r   r   
can_createA   s    zCreator.can_createc             C   s>   |j dd| jd |j dddddd	 |j d
ddddd	 dS )a  Add 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&   r   r   r   add_parser_argumentsK   s     	
zCreator.add_parser_argumentsc             C   s   t dS )z)Perform the virtual environment creation.N)NotImplementedError)r   r   r   r   createh   s    zCreator.createc          	   C   s  dd }t  }t }|dkr&ddini }xXt|D ]L}y*|j|f||}||krXw4t|W q4 tk
r~   d||< Y q4X q4W |rtd|d	|
 |tj|krtd	|tjt|}| r| rtd
|dt j  krdkrn nttj|}	nttjt| }	|	}xb|	r|	 rhttt|	tjr^P n
||	| |	j|	j }
}|
|	kr||	| |
}	q2W t|S )zANo path separator in the path, valid chars and must be write-ablec             S   s2   t tj|j| jg }td| ||d S )Nz*the destination {} is not write-able at {})r   ospathcommonprefixpartsr   r+   relative_to)r"   valuecommonr   r   r   non_write_ableq   s    z-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
ValueErrorr   r+   r1   keysrB   pathsepr   existsis_fileversion_inforC   realpathabspathr3   resolveaccessW_OKparentname)r4   Z	raw_valuerI   encodingZrefusedkwargscharZtriprG   r"   base_r   r   r   r<   m   sN    





zCreator.validate_destc             C   sJ   | j  r(| jr(td| j  t| j  |   |   | jsF| 	  d S )Nz	delete %s)
r"   rW   r#   loggingdebugr   rA   set_pyenv_cfgr$   setup_ignore_vcs)r   r   r   r   run   s    
zCreator.runc             C   sR   t  | j_| jj| jd< | jj| jd< ddd | jjD | jd< t| jd< d S )Nhomeimplementation.c             s   s   | ]}t |V  qd S )N)r3   )r,   ir   r   r   r/      s    z(Creator.set_pyenv_cfg.<locals>.<genexpr>rY   Z
virtualenv)	r	   r%   contentr    Zsystem_exec_prefixrl   r1   rY   r   )r   r   r   r   rh      s
    
zCreator.set_pyenv_cfgc             C   s(   | j d }| s$|td  dS )z9Generate ignore instructions for version control systems.z
.gitignoreze
                    # created by virtualenv automatically
                    *
                    N)r"   rW   Z
write_textr
   lstrip)r   Z
git_ignorer   r   r   ri      s
    
zCreator.setup_ignore_vcsc             C   s4   | j dkr.| jdk	r.t| j|  | j| j| _ | j S )zt
        :return: debug information about the virtual environment (only valid after :meth:`create` has run)
        N)r!   Zexeget_env_debug_infodebug_scriptr&   r'   )r   r   r   r   rg      s    zCreator.debugc             C   s   t S )N)DEBUG_SCRIPT)r   r   r   r   rr      s    zCreator.debug_scriptN)r   r   r   __doc__r   r*   r)   r2   classmethodr5   r?   r   rA   r<   rj   rh   ri   propertyrg   rr   r   r   r   r   r   !   s   
:	
r   c       
   
   C   s   |  }|tdd  ||J}t| t|g}trFdd |D }ttdt| t|\}}}W d Q R X y,|dkrt	|}n
t
|}|r||d< W n0 tk
r }	 z|||t|	dS d }	~	X Y nX d|krd	|d kr|d d	 d= |S )
N
PYTHONPATHc             S   s   g | ]}t |qS r   )r   )r,   rn   r   r   r   
<listcomp>   s    z&get_env_debug_info.<locals>.<listcomp>zdebug via %rr   err)outry   
returncode	exceptionrP   rC   )copypopr3   Zensure_extractedr   rf   rg   r   r   r   jsonloads	Exceptionrepr)
Zenv_exerr   r&   r'   cmdcoderz   ry   resultr|   r   r   r   rq      s&    

 rq   )/
__future__r   r   r   r   rf   rB   rP   abcr   r   argparser   astr   collectionsr	   textwrapr
   Zsixr   Z#virtualenv.discovery.cached_py_infor   Zvirtualenv.infor   Zvirtualenv.util.pathr   r   Zvirtualenv.util.sixr   r   Zvirtualenv.util.subprocessr   Zvirtualenv.versionr   r%   r   rC   r[   __file__r_   ZHERErs   objectr   r   rq   r   r   r   r   <module>   s0    7