관리-도구
편집 파일: command.cpython-37.pyc
B �M!V - � @ s� d dl Z ddlmZ ddlmZ ddlmZ ddlmZ dd� Z d$d d�Z d%dd�Zd&dd�Zd'dd�Z d(dd�Zdd� Zd)dd�Zd*dd�Zd+dd�Zd,dd�Zd-d d!�Zd"d#� ZdS ).� N� )�ScriptDirectory)�EnvironmentContext)�util)�autogeneratec C st | � d� xPt�| �� �D ]>}ttj�| �� |d���}t|�}W dQ R X | � d||� qW | � d� | � d� dS )zList available templateszAvailable templates: ZREADMENz%s - %sz1 Templates are used via the 'init' command, e.g.:z, alembic init --template generic ./scripts)�print_stdout�os�listdir�get_template_directory�open�path�join�next)�config�tempname�readmeZsynopsis� r �@/opt/alt/python37/lib/python3.7/site-packages/alembic/command.py�list_templates s r �genericc C s8 t �|t j�rt�d| ��t j�| �� |�}t �|t j�sJt�d| ��t�dt j� |� t j |� t j�|d�}t�dt j� |� t j |� t|�}x�t �|�D ]~}t j�||�}|dkr�t j� | j �}t �|t j�r�t�d| � n|j|||d� q�t j�|�r�t j�||�} |�|| � q�W t�d| � d S ) z#Initialize a new scripts directory.zDirectory %s already existszNo such template %rzCreating directory %s�versionszalembic.ini.makoz File %s already exists, skipping)Zscript_locationzNPlease edit configuration/connection/logging settings in %r before proceeding.N)r �access�F_OKr �CommandErrorr r r �status�abspath�makedirsr r Zconfig_file_name�msgZ_generate_template�isfileZ _copy_file) r � directory�templateZtemplate_dirr �scriptZfile_� file_path�config_file�output_filer r r �init s: r% F�headc s� t �| �} t||||||||| d� }t�| | |�� t�| �d��}|rfd}|rXt�d��� fdd�} n |rx� fdd�} n|r�t�d��|r�t | | | |� j � d �� | �� W d Q R X dd� � �� D �}t |�d kr�|d S |S d S )zCreate a new revision file.) �messager �sqlr&