
    _f                     b    d dl Z d dlZd dlmZmZ d dlmZ d dlmZm	Z	m
Z
  G d de          ZdS )    N)BaseCommandCommandError)settings)cache	get_mtimeget_mtime_cachekeyc                   $    e Zd ZdZd Zd Zd ZdS )Commandz-Add or remove all mtime values from the cachec           	         |                     dddg ddd          f |                     dd	d
dd          f |                     dddd          f |                     ddddd          f |                     ddddd          f d S )Nz-iz--ignoreappendignore_patternsPATTERNz`Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.)actiondefaultdestmetavarhelpz--no-default-ignorestore_falseuse_default_ignore_patternsTzIDon't ignore the common private glob-style patterns 'CVS', '.*' and '*~'.)r   r   r   r   z--follow-linksfollow_links
store_truezFollow symlinks when traversing the COMPRESS_ROOT (which defaults to STATIC_ROOT). Be aware that using this can lead to infinite recursion if a link points to a parent directory of itself.)r   r   r   z-cz--cleancleanzRemove all itemsz-az--addaddzAdd all items)add_argument)selfparsers     \/var/www/html/env/lib/python3.11/site-packages/compressor/management/commands/mtime_cache.pyadd_argumentszCommand.add_arguments   s   ": 	 		
 		
 		 		 	! . 	 	
 	
 	 	 	#	 	 	
 	
 	 	 	)',EW 	 	
 	
 	 	 	'l 	 	
 	
 	 	 	 	    c                 J    | j         D ]}t          j        ||          r dS dS )z
        Return True or False depending on whether the ``path`` should be
        ignored (if it matches any pattern in ``ignore_patterns``).
        TF)r   fnmatchfnmatchcase)r   pathpatterns      r   
is_ignoredzCommand.is_ignored0   s<    
 + 	 	G"411 ttur   c                 
   |d         }|d         r|g dz  }||d<   || _         |d         r|d         s|d         s|d         st          d          t          j        st          d          t	                      }t	                      }t          j        t          j        |d         	          D ]B\  }}}|D ],}|                     |          r|	                    |           -|D ]}	d

                    |                    t          j                            }
|
                    t
          j                  r!|
t          t
          j                  d          }
|                     t
          j        
                    |
|	                    rt
          j        
                    ||	          }	|                    t#          |	                     |d         r|                    |	           
D|rKt%          j        t)          |                     | j                            dt          |          z             |r@|D ]}	t/          |	           | j                            dt          |          z             d S d S )Nr   r   )CVSz.*z*~r   r   z*Please specify either "--add" or "--clean"zhmtime caching is currently disabled. Please set the COMPRESS_MTIME_DELAY setting to a number of seconds.r   )followlinks z*Deleted mtimes of %d files from the cache.z"Added mtimes of %d files to cache.)r   r   r   COMPRESS_MTIME_DELAYsetoswalkCOMPRESS_ROOTr%   removejoinsplit
startswithseplenr#   r   r   r   delete_manyliststdoutwriter   )r   optionsr   files_to_addkeys_to_deleterootdirsfilesdir_filenamecommons              r   handlezCommand.handle:   s   !"3401 	92222O)8G%&.EN 	Mww/ 	M	M'.w'7	M KLLL, 	O  
 uu!#"0G"
 "
 "
 	/ 	/D$  & &??4(( &KK%%%! 	/ 	/H,B!C!CDD$$RV,, 3#CKKMM2F??27<<#A#ABB 7<<h77""#5h#?#?@@@5> / $$X...	/  	d>22333K<s>?R?RR    	X( $ $(####KBSEVEVVWWWWW	X 	Xr   N)__name__
__module____qualname__r   r   r%   rB    r   r   r
   r
   
   sL        :D! ! !F  /X /X /X /X /Xr   r
   )r!   r,   django.core.management.baser   r   compressor.confr   compressor.cacher   r   r   r
   rF   r   r   <module>rJ      s     				 A A A A A A A A $ $ $ $ $ $ A A A A A A A A A A_X _X _X _X _Xk _X _X _X _X _Xr   