U
    ad                     @   sl   d dl Z d dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZmZ d dlmZ G dd deZdS )	    N)join)List)settings)BaseCommandCommandError)signalcommandc                   @   s6   e Zd ZU dZg Zee ed< dd Ze	dd Z
dS )Commandz.Compile python bytecode files for the project.requires_system_checksc                 C   s   |j dddddd d S )Nz--pathz-pstorepathzSpecify path to recurse into)actiondesthelp)add_argument)selfparser r   U/tmp/pip-unpacked-wheel-portabvm/django_extensions/management/commands/compile_pyc.pyadd_arguments   s    zCommand.add_argumentsc           
      O   s   |d }|st tdd }|d }|s,tdt|D ]H\}}}t|dD ]0}t||}	|dkrr| j	d|	  t
|	 qLq6d S )Nr   ZBASE_DIR	verbosityz=No --path specified and settings.py does not contain BASE_DIRz*.py   zCompiling %s...
)getattrr   r   oswalkfnmatchfilter_jstdoutwrite
py_compilecompile)
r   argsoptionsZproject_rootr   rootdirs	filenamesfilename	full_pathr   r   r   handle   s    
zCommand.handleN)__name__
__module____qualname__r   r	   r   str__annotations__r   r   r(   r   r   r   r   r      s
   
r   )r   r   r   os.pathr   r   typingr   Zdjango.confr   Zdjango.core.management.baser   r   Z"django_extensions.management.utilsr   r   r   r   r   r   <module>   s   