관리-도구
편집 파일: __init__.cpython-39.pyc
a R�f�Z � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZdZe� e �ZG dd� d�Zddd�Z dd d �Ze dkr�dZze� dZW n6 ey� Z zed e ejd� W Y dZ[n dZ[0 0 e�e� dS )z� Virtual environment (venv) package for Python. Based on PEP 405. Copyright (C) 2011-2014 Vinay Sajip. Licensed to the PSF under a contributor agreement. � N)�pipZ setuptoolsc @ s� e Zd ZdZd dd�Zdd� Zdd � Zd d� Zdd � Ze j dkrLd!dd�Zn d"dd�Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd� ZdS )#� EnvBuildera� This class exists to allow virtual environment creation to be customized. The constructor parameters determine the builder's behaviour when called upon to create a virtual environment. By default, the builder makes the system (global) site-packages dir *un*available to the created environment. If invoked using the Python -m option, the default is to use copying on Windows platforms but symlinks elsewhere. If instantiated some other way, the default is to *not* use symlinks. :param system_site_packages: If True, the system (global) site-packages dir is available to created environments. :param clear: If True, delete the contents of the environment directory if it already exists, before environment creation. :param symlinks: If True, attempt to symlink rather than copy files into virtual environment. :param upgrade: If True, upgrade an existing virtual environment. :param with_pip: If True, ensure pip is installed in the virtual environment :param prompt: Alternative terminal prefix for the environment. :param upgrade_deps: Update the base venv modules to the latest on PyPI FNc C sF || _ || _|| _|| _|| _|dkr6tj�t�� �}|| _ || _ d S )N�.)�system_site_packages�clear�symlinks�upgrade�with_pip�os�path�basename�getcwd�prompt�upgrade_deps)�selfr r r r r r r � r �2/opt/alt/python39/lib64/python3.9/venv/__init__.py�__init__. s zEnvBuilder.__init__c C s� t j�|�}| �|�}| j}d| _| �|� | �|� | jrF| �|� | j s`| � |� | �|� |rtd| _| �|� | jr�| � |� dS )z� Create a virtual environment in a directory. :param env_dir: The target directory to create an environment in. FTN)r r �abspath�ensure_directoriesr �create_configuration�setup_pythonr � _setup_pipr � setup_scripts� post_setupr �upgrade_dependencies)r �env_dir�contextZtrue_system_site_packagesr r r �create; s zEnvBuilder.createc C s\ t �|�D ]L}t j�||�}t j�|�s4t j�|�r@t �|� q t j�|�r t� |� q d S )N) r �listdirr �join�islink�isfile�remove�isdir�shutilZrmtree)r r �fnr r r �clear_directoryW s zEnvBuilder.clear_directoryc C s� dd� }t j�|�r$| jr$| �|� t�� }||_t j�|�d |_ | j durT| j n|j }d| |_ ||� tj}t j�t j� |��\}}||_||_||_tjdkr�d}d} t j�|d d �} n(d}d} t j�|d dtjdd� d �} t j�|| � |_}||� || � tjdk�rXt jdk�rXtjdk�rXt j�|d�}t j�|��sXt �d |� t j�||� |_} ||_t j�| |�|_|| � |j|_tjdk�r�t j�|j�}t j�|�t j�|j�k�r�t�d|j|� ||_|S )z� Create the directories for the environment. Returns a context object which holds paths in the environment, for use by subsequent logic. c S s@ t j�| �st �| � n$t j�| �s0t j�| �r<td| ��d S )NzUnable to create directory %r)r r �exists�makedirsr! r"