관리-도구
편집 파일: rotate.cpython-36.pyc
3 K�Ret � @ s` d dl mZ d dlmZ d dlmZ d dlZd dlZd dlm Z d dl mZ G dd� de�ZdS ) � )�convert_path)�log)�DistutilsOptionErrorN)�six)�Commandc @ s: e Zd ZdZdZdddgZg Zdd � Zdd� Zdd� Z dS )�rotatezDelete older distributionsz2delete older distributions, keeping N newest files�match=�m�patterns to match (required)� dist-dir=�d�%directory where the distributions are�keep=�k�(number of matching distributions to keepc C s d | _ d | _d | _d S )N)�match�dist_dir�keep)�self� r ��/builddir/build/BUILDROOT/alt-python36-setuptools-38.5.2-7.el8.x86_64/opt/alt/python36/lib/python3.6/site-packages/setuptools/command/rotate.py�initialize_options s zrotate.initialize_optionsc C s� | j d krtd��| jd kr$td��yt| j�| _W n tk rP td��Y nX t| j tj�rxdd� | j jd�D �| _ | j dd � d S ) NzQMust specify one or more (comma-separated) match patterns (e.g. '.zip' or '.egg')z$Must specify number of files to keepz--keep must be an integerc S s g | ]}t |j� ��qS r )r �strip)�.0�pr r r � <listcomp>+ s z+rotate.finalize_options.<locals>.<listcomp>�,�bdistr )r r ) r r r �int� ValueError� isinstancer �string_types�split�set_undefined_options)r r r r �finalize_options s zrotate.finalize_optionsc C s� | j d� ddlm} x�| jD ]�}| jj� d | }|tjj| j|��}dd� |D �}|j � |j � tjdt |�|� || jd � }xD|D ]<\}}tjd|� | js�tjj|�r�tj|� q�tj|� q�W qW d S ) N�egg_infor )�glob�*c S s g | ]}t jj|�|f�qS r )�os�path�getmtime)r �fr r r r 6 s zrotate.run.<locals>.<listcomp>z%d file(s) matching %szDeleting %s)�run_commandr&