관리-도구
편집 파일: env.cpython-38.pyc
U 0?�f* � @ s d dl Zd dlZd dlZd dlZd dlmZ d dlmZ ddlm Z ddlmZ ddlmZ ddlm Z dd lm Z dd lmZ dd� Zd2dd�Zdd� Zdd� Zdd� Zd3dd�Zd4dd�Zd5dd�Zd6d!d"�Zd#d$� Zd%d&� Zd7d(d)�Zd*d+� Zd,d-� Zd.d/� Zd0d1� ZdS )8� N)�config)� provision� )�util� )�command)�script)�Script)�ScriptDirectoryc C s t jrdt j S dS d S )Nz scratch_%sZscratch)r ZFOLLOWER_IDENT� r r �A/opt/hc_python/lib/python3.8/site-packages/alembic/testing/env.py�_get_staging_directory s r T�genericFc C s� t � }| r�tj�t� d�}tj�|�r2td| ��tj|||d� |r�zt � |d� W n tk rj Y nX |dks|t|��ttj�|d�d|kr�dnd� t j�|�}|S )N�scriptsz2staging directory %s already exists; poor cleanup?)�template�env.py)Zpep3147_envonly�simple�pep3147_everything�pep3147r )�_testing_config�os�path�joinr �exists�AssertionErrorr �initr Zload_python_file�AttributeError�make_sourcelessr r �from_config)�creater � sourceless�cfgr �scr r r �staging_env s* � ��r# c C s( ddl m} | j�� t�t� d� d S )Nr ��enginesT)�sqlalchemy.testingr% Ztesting_reaperZ close_all�shutil�rmtreer r$ r r r �clear_staging_env: s r) c C sB t j�t� d�}t j�|d�}t|d��}|�| � W 5 Q R X d S )Nr zscript.py.mako�w)r r r r �open�write)�txt�dir_r �fr r r �script_file_fixtureA s r0 c C sb t j�t� d�}d| } t j�|d�}t�|�}|r>t �|� t|d��}|�| � W 5 Q R X d S )Nr z6 from alembic import context config = context.config r r* ) r r r r r �pyc_file_from_path�unlinkr+ r, )r- r. r �pyc_pathr/ r r r �env_file_fixtureH s �� r4 �foo.dbc K s>