Hacked By AnonymousFox

Current Path : /usr/lib/python3.6/site-packages/dnf/cli/commands/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dnf/cli/commands/__pycache__/clean.cpython-36.pyc

3

�ft`t�@s�ddlmZddlmZddlmZddlmZmZddlm	Z	ddlZ
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZddlZddlZddlZejd�Zdd	d
gdgd	gd
gddd	gd�Zd
d�Zdd�Zdd�Zdd�ZGdd�dej�ZdS)�)�absolute_import)�unicode_literals)�commands)�_�P_)�miscN�dnf�metadata�dbcachezexpire-cache�packages)r	rr
zexpire-cache�allccsVxPtj|�D]B\}}}tjj||�}x(|D] }tjj||�}tjj|�Vq*WqWdS)z:Traverse dirpath recursively and yield relative filenames.N)�os�walk�path�relpath�join�normpath)�dirpath�root�dirs�files�base�fr�r�/usr/lib/python3.6/clean.py�_tree1s

rcs�fdd�|D�S)z5Yield those filenames that match any of the patterns.c3s(|] }�D]}tj||�r
|Vq
qdS)N)�re�match)�.0r�p)�patternsrr�	<genexpr><sz_filter.<locals>.<genexpr>r)rr r)r r�_filter:sr"cCsLd}xB|D]:}tjj||�}tjtjjtd�|�t	j
|�|d7}q
W|S)z(Remove the given filenames from dirpath.rzRemoving file %s�)r
rr�logger�logr�loggingZDDEBUGrrZunlink_f)rr�countrrrrr�_clean?s

r(cs0tjjd��fdd�|D�}tdd�|D��S)z:Return the repo IDs that have some cached metadata around.r	c3s|]}tj�|�VqdS)N)rr)rr)�metapatrrr!Msz _cached_repos.<locals>.<genexpr>css|]}|r|jd�VqdS)ZrepoidN)�group)r�mrrrr!Ns)r�repo�CACHE_FILES�set)rZmatchesr)r)r�
_cached_reposJsr/c@s0eZdZdZd	Zed�Zedd��Zdd�Z	dS)
�CleanCommandzSA class containing methods needed by the cli to execute the
    clean command.
    �cleanzremove cached datacCs|jddtj�td�d�dS)N�type�+zMetadata type to clean)�nargs�choices�help)�add_argument�_CACHE_TYPES�keysr)�parserrrr�
set_argparserYszCleanCommand.set_argparsercCsf|jjj}tjj|d�}tjj|d�}tjj|jjjd�}�x$y�|oJ|oJ|��t	dd�|j
jD��}tt
|��}tjtddj|���d|kr�t|�}|jjjj|�|jd�tjtd��dd	�|D�}t|t||��}	tjtd
d|	�|	�dSQRXWq>tjjk
�r\}
z:|jjj�sHtd�|
j}tj|�tj d
�n|
�WYdd}
~
Xq>Xq>WdS)NTcss |]}t|D]
}|VqqdS)N)r8)r�c�trrrr!gsz#CleanCommand.run.<locals>.<genexpr>zCleaning data: � zexpire-cachezCache was expiredcSsg|]}tjj|�qSr)rr,r-)rr=rrr�
<listcomp>qsz$CleanCommand.run.<locals>.<listcomp>z%d file removedz%d files removedz*Waiting for process with pid %d to finish.�)!rZconf�cachedirr�lockZbuild_metadata_lockZbuild_download_lockZbuild_rpmdb_lockZ
persistdirr.Zoptsr2�listrr$�debugrrr/Z_repo_persistorZexpired_to_add�update�remove�infor(r"r�
exceptionsZ	LockErrorZexit_on_lock�pid�timeZsleep)�selfrAZmd_lockZ
download_lockZ
rpmdb_lock�typesrZexpiredr r'�e�msgrrr�run_s2


zCleanCommand.runN)r1)
�__name__�
__module__�__qualname__�__doc__�aliasesrZsummary�staticmethodr;rOrrrrr0Qs
r0)Z
__future__rrZdnf.clirZdnf.i18nrrZdnf.yumrrZdnf.exceptionsZdnf.lockZdnf.loggingZdnf.repor&r
rrJZ	getLoggerr$r8rr"r(r/ZCommandr0rrrr�<module>s0
	

Hacked By AnonymousFox1.0, Coded By AnonymousFox