a ˆljdã@s˜ddlZddlZddlmZddlmZmZddlmm m Z ddl m Z ddl mZmZddlmZmZddlmZeeƒZGdd „d e ƒZdS) éN)ÚValues)ÚAnyÚList)ÚCommand)ÚERRORÚSUCCESS)Ú CommandErrorÚPipError)Ú getLoggerc@seZdZdZdZdZddœdd„Zeee e dœd d „Z eee ddœd d „Z eee ddœd d„Zeee ddœdd„Zee ddœdd„Zee ddœdd„Zeee ddœdd„Zeee ddœdd„Zee e dœdd„Zeee dœdd„Zee ee d œd!d"„ZdS)#Ú CacheCommandaw Inspect and manage pip's wheel cache. Subcommands: - dir: Show the cache directory. - info: Show information about the cache. - list: List filenames of packages stored in the cache. - remove: Remove one or more package from the cache. - purge: Remove all items from the cache. ```` can be a glob expression or a package name. Tz˜ %prog dir %prog info %prog list [] [--format=[human, abspath]] %prog remove %prog purge N)ÚreturncCs,|jjddddddd|j d|j¡dS) Nz--formatÚstoreÚ list_formatÚhuman)rÚabspathz:Select the output format among: human (default) or abspath)ÚactionÚdestÚdefaultÚchoicesÚhelpr)Zcmd_optsZ add_optionÚparserZinsert_option_group)Úself©rú@/usr/lib/python3.9/site-packages/pip/_internal/commands/cache.pyÚ add_options'sú zCacheCommand.add_options)ÚoptionsÚargsr c Cs¸|j|j|j|j|jdœ}|js.t d¡tS|r>|d|vrXt dd  t |ƒ¡¡tS|d}z||||dd…ƒWn8t y²}z t |j d¡tWYd}~Sd}~00t S)N)ÚdirÚinfoÚlistÚremoveÚpurgezZformat_file_sizeÚappendr+r,)rrGÚresultsÚfilenameZwheelÚsizerrrrDs    zCacheCommand.format_for_humancCs8|sdSg}|D]}| |¡qt d t|ƒ¡¡dS)NrI)rMr)rr+r,)rrGrNrOrrrrEšs  zCacheCommand.format_for_abspathcCs¤t|ƒdkrtdƒ‚|s tdƒ‚| ||d¡}d}|ddkrP|| |¡7}n|d |d¡7}|spt |¡|D]}t |¡t  d|¡qtt  d t|ƒ¡dS) Nr"r0zPlease provide a patternrzNo matching packagesr2z for pattern "{}"z Removed %szFiles removed: %s) r:rr<r;rAr)ZwarningrJÚunlinkÚverboser)rrrrGZno_matching_msgrOrrrr&¤s    zCacheCommand.remove_cache_itemscCs|r tdƒ‚| |dg¡S)Nr0r2)rr&r1rrrr'½szCacheCommand.purge_cache)rÚsubdirr cCstj |j|¡S)N)rJrKr+r()rrrSrrrr=ÃszCacheCommand._cache_dir)rr cCs| |d¡}t |d¡S)Nr3r2©r=r>Z find_files)rrZhttp_dirrrrr;Æs zCacheCommand._find_http_files)rrFr cCs,| |d¡}|d|vrdnd}t ||¡S)Nr4ú-z*.whlz-*.whlrT)rrrFZ wheel_dirrrrr<Ês zCacheCommand._find_wheels)Ú__name__Ú __module__Ú __qualname__Ú__doc__Zignore_require_venvÚusagerrrÚstrÚintr/rr#r$r%rDrEr&r'r=r;r<rrrrr s  $  r )rJr?ZoptparserÚtypingrrZpip._internal.utils.filesystemZ _internalZutilsr>Zpip._internal.cli.base_commandrZpip._internal.cli.status_codesrrZpip._internal.exceptionsrr Zpip._internal.utils.loggingr rVr)r rrrrÚs