Your IP : 18.221.161.43


Current Path : /lib/python3.8/site-packages/setuptools/command/__pycache__/
Upload File :
Current File : //lib/python3.8/site-packages/setuptools/command/__pycache__/rotate.cpython-38.pyc

U

�Qabt�@s`ddlmZddlmZddlmZddlZddlZddlm	Z	ddl
mZGdd�de�ZdS)	�)�convert_path)�log)�DistutilsOptionErrorN)�six)�Commandc@s:eZdZdZdZdddgZgZdd�Zdd	�Zd
d�Z	dS)
�rotatezDelete older distributionsz2delete older distributions, keeping N newest files)zmatch=�mzpatterns to match (required))z	dist-dir=�dz%directory where the distributions are)zkeep=�kz(number of matching distributions to keepcCsd|_d|_d|_dS)N)�match�dist_dir�keep��self�r�=/usr/lib/python3.8/site-packages/setuptools/command/rotate.py�initialize_optionsszrotate.initialize_optionscCs�|jdkrtd��|jdkr$td��zt|j�|_Wntk
rPtd��YnXt|jtj�rxdd�|j�d�D�|_|�	dd�dS)	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 integercSsg|]}t|����qSr)r�strip)�.0�prrr�
<listcomp>*sz+rotate.finalize_options.<locals>.<listcomp>�,Zbdist)rr)
rrr
�int�
ValueError�
isinstancerZstring_types�splitZset_undefined_optionsrrrr�finalize_optionss
�

�zrotate.finalize_optionscCs�|�d�ddlm}|jD]�}|j��d|}|tj�|j|��}dd�|D�}|�	�|�
�t�dt
|�|�||jd�}|D]<\}}t�d|�|js�tj�|�r�t�|�q�t�|�q�qdS)	NZegg_infor)�glob�*cSsg|]}tj�|�|f�qSr)�os�path�getmtime)r�frrrr6szrotate.run.<locals>.<listcomp>z%d file(s) matching %szDeleting %s)Zrun_commandrrZdistributionZget_namerr �joinr�sort�reverser�info�lenr
Zdry_run�isdir�shutilZrmtree�unlink)rr�pattern�files�tr"rrr�run/s 

z
rotate.runN)
�__name__�
__module__�__qualname__�__doc__�descriptionZuser_optionsZboolean_optionsrrr.rrrrrs�r)
Zdistutils.utilrZ	distutilsrZdistutils.errorsrrr)Zsetuptools.externrZ
setuptoolsrrrrrr�<module>s

?>