
    09oeP                     b    d dl mZ d dlmZ d dlmZ d dlZd dlZd dlm	Z	  G d de	          Z
dS )    )convert_path)log)DistutilsOptionErrorN)Commandc                   4    e Zd ZdZdZg dZg Zd Zd Zd Z	dS )rotatezDelete older distributionsz2delete older distributions, keeping N newest files))zmatch=mzpatterns to match (required))z	dist-dir=dz%directory where the distributions are)zkeep=kz(number of matching distributions to keepc                 0    d | _         d | _        d | _        d S )N)matchdist_dirkeep)selfs    RD:\Python Project\StaffProfile\venv\Lib\site-packages\setuptools/command/rotate.pyinitialize_optionszrotate.initialize_options   s    
			    c                    | j         t          d          | j        t          d          	 t          | j                  | _        n"# t          $ r}t          d          |d }~ww xY wt          | j         t                    r)d | j                             d          D             | _         |                     dd           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                 P    g | ]#}t          |                                          $S  )r   strip).0ps     r   
<listcomp>z+rotate.finalize_options.<locals>.<listcomp>(   s5       ,-QWWYY''  r   ,bdist)r   r   )	r   r   r   int
ValueError
isinstancestrsplitset_undefined_options)r   es     r   finalize_optionszrotate.finalize_options   s    :&*   9&'MNNN	KDIDII 	K 	K 	K&'BCCJ	Kdj#&& 	 151A1A#1F1F  DJ 	""7,DEEEEEs   A 
A'A""A'c                    |                      d           ddlm} | j        D ]"}| j                                        dz   |z   } |t
          j                            | j        |                    }d |D             }|	                                 |
                                 t          j        dt          |          |           || j        d          }|D ]i\  }}t          j        d|           | j        sHt
          j                            |          rt#          j        |           Ut          j        |           j$d S )Negg_infor   )glob*c                 P    g | ]#}t           j                            |          |f$S r   )ospathgetmtime)r   fs     r   r   zrotate.run.<locals>.<listcomp>4   s-    ===!bg&&q))1-===r   z%d file(s) matching %szDeleting %s)run_commandr'   r   distributionget_namer*   r+   joinr   sortreverser   infolenr   dry_runisdirshutilrmtreeunlink)r   r'   patternfilestr-   s         r   runz
rotate.run-   sE   $$$z 	% 	%G'0022S87BGDdmW==>>E==u===EJJLLLMMOOOH-s5zz7CCC$)**%E % %A***| %w}}Q'' %a((((	!%	% 	%r   N)
__name__
__module____qualname____doc__descriptionuser_optionsboolean_optionsr   r$   r>   r   r   r   r   r   
   sg        $$FK  L O  
F F F$% % % % %r   r   )distutils.utilr   	distutilsr   distutils.errorsr   r*   r8   
setuptoolsr   r   r   r   r   <module>rJ      s    ' ' ' ' ' '       1 1 1 1 1 1 				       6% 6% 6% 6% 6%W 6% 6% 6% 6% 6%r   