Viewing File: /opt/alt/python38/lib/python3.8/site-packages/setuptools/command/__pycache__/rotate.cpython-38.pyc
U
+’aP ã @ sT d dl mZ d dlmZ d dlmZ d dlZd dlZd dlm Z G dd„ de ƒZ
dS )é )Úconvert_path)Úlog)ÚDistutilsOptionErrorN)ÚCommandc @ s: e Zd ZdZdZdddgZg Zdd„ Zdd „ Zd
d„ Z dS )
Ú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 keepc C s d | _ d | _d | _d S )N)ÚmatchÚdist_dirÚkeep)Úself© r úA/tmp/pip-install-1bd_1mtk/setuptools/setuptools/command/rotate.pyÚinitialize_options s zrotate.initialize_optionsc
C s– | j d krtdƒ‚| jd kr$tdƒ‚zt| jƒ| _W n, tk
r` } ztdƒ|‚W 5 d }~X Y nX t| j tƒr†dd„ | j d¡D ƒ| _ | 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 | ¡ ƒ‘qS r )r Ústrip)Ú.0Úpr r r Ú
<listcomp>( s z+rotate.finalize_options.<locals>.<listcomp>ú,Úbdist)r r ) r
r r ÚintÚ
ValueErrorÚ
isinstanceÚstrÚsplitÚset_undefined_options)r
Úer r r Úfinalize_options s
ÿ
ÿzrotate.finalize_optionsc C sÌ | d¡ ddlm} | jD ]ª}| j ¡ d | }|tj | j|¡ƒ}dd„ |D ƒ}| ¡ |
¡ t dt
|ƒ|¡ || jd … }|D ]<\}}t d|¡ | jsˆtj |¡rºt |¡ qˆt |¡ qˆqd S ) NÚegg_infor )ÚglobÚ*c S s g | ]}t j |¡|f‘qS r )ÚosÚpathÚgetmtime)r Úfr r r r 4 s zrotate.run.<locals>.<listcomp>z%d file(s) matching %szDeleting %s)Úrun_commandr r
ÚdistributionÚget_namer"