a
    ܌xd                     @   s`   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	m
Z
 d dlmZ G dd de	ZdS )    N)join)settings)BaseCommandCommandError)signalcommandc                   @   s(   e Zd ZdZdZdd Zedd ZdS )Commandz.Compile python bytecode files for the project.Fc                 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   i/var/www/html/Ranjet/env/lib/python3.9/site-packages/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   Zrequires_system_checksr   r   r&   r   r   r   r   r      s
   r   )r   r   r   os.pathr   r   Zdjango.confr   Zdjango.core.management.baser   r   Z"django_extensions.management.utilsr   r   r   r   r   r   <module>   s   