Viewing File: /usr/lib/python3.6/site-packages/setuptools/command/__pycache__/rotate.cpython-36.pyc

3

Xoöhtã@s`ddlmZddlmZddlmZddlZddlZddlm	Z	ddl
mZGdd„deƒZdS)	é)Úconvert_path)Úlog)ÚDistutilsOptionErrorN)Úsix)ÚCommandc@s:eZdZdZdZdddgZgZdd
„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 keepcCsd|_d|_d|_dS)N)ÚmatchÚdist_dirÚkeep)Úself©rú/usr/lib/python3.6/rotate.pyÚinitialize_optionsszrotate.initialize_optionscCsˆ|jdkrtdƒ‚|jdkr$tdƒ‚yt|jƒ|_Wntk
rPtdƒ‚YnXt|jtjƒrxdd„|jjdƒDƒ|_|j	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|jƒƒ‘qSr)rÚstrip)Ú.0Úprrrú
<listcomp>+sz+rotate.finalize_options.<locals>.<listcomp>ú,Zbdistr)rr)
rrrÚintÚ
ValueErrorÚ
isinstancerZstring_typesÚsplitZset_undefined_options)rrrrÚfinalize_optionss

zrotate.finalize_optionscCsÔ|jdƒddlm}x¸|jD]®}|jjƒd|}|tjj|j|ƒƒ}dd„|Dƒ}|j	ƒ|j
ƒtjdt
|ƒ|ƒ||jd…}xD|D]<\}}tjd|ƒ|jsŒtjj|ƒr¾tj|ƒqŒtj|ƒqŒWqWdS)	NZegg_infor)ÚglobÚ*cSsg|]}tjj|ƒ|f‘qSr)ÚosÚpathÚgetmtime)rÚfrrrr6szrotate.run.<locals>.<listcomp>z%d file(s) matching %szDeleting %s)Zrun_commandr"rZdistributionZget_namer$r%ÚjoinrÚsortÚreverserÚinfoÚlenrZdry_runÚisdirÚshutilZrmtreeÚunlink)rr"ÚpatternÚfilesÚtr'rrrÚrun/s 
z
rotate.runN)rr	r
)rrr
)rrr)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚdescriptionZuser_optionsZboolean_optionsrr!r3rrrrrsr)
Zdistutils.utilrZ	distutilsrZdistutils.errorsrr$r.Zsetuptools.externrZ
setuptoolsrrrrrrÚ<module>s
Back to Directory File Manager