o ¯)»aPã@sTddlmZddlmZddlmZddlZddlZddlm Z Gdd„de ƒZ dS)é)Ú convert_path)Úlog)ÚDistutilsOptionErrorN)ÚCommandc@s8eZdZdZdZgd¢ZgZdd„Zdd„Zdd „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úL/opt/alt/python310/lib/python3.10/site-packages/setuptools/command/rotate.pyÚinitialize_optionss zrotate.initialize_optionsc CsŒ|jdur tdƒ‚|jdurtdƒ‚zt|jƒ|_Wnty+}ztdƒ|‚d}~wwt|jtƒr>dd„|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Ú (s ÿz+rotate.finalize_options..ú,Zbdist)r r ) r rr ÚintÚ ValueErrorÚ isinstanceÚstrÚsplitZset_undefined_options)r ÚerrrÚfinalize_optionss" ÿ  €ÿ  ÿzrotate.finalize_optionscCsÌ| d¡ddlm}|jD]U}|j ¡d|}|tj |j|¡ƒ}dd„|Dƒ}|  ¡|  ¡t   dt |ƒ|¡||jd…}|D]\}}t   d|¡|jsbtj |¡r]t |¡qDt |¡qDqdS) NZegg_infor)ÚglobÚ*cSsg|] }tj |¡|f‘qSr)ÚosÚpathÚgetmtime)rÚfrrrr4szrotate.run..z%d file(s) matching %sz Deleting %s)Z run_commandrr Z distributionZget_namerr Újoinr ÚsortÚreverserÚinfoÚlenr Zdry_runÚisdirÚshutilZrmtreeÚunlink)r rÚpatternÚfilesÚtr"rrrÚrun-s&        €ú÷z rotate.runN) Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú descriptionZ user_optionsZboolean_optionsrrr.rrrrr s r) Zdistutils.utilrZ distutilsrZdistutils.errorsrrr)Z setuptoolsrrrrrrÚs