
    jg	                     l    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  G d de      Zd Zy)	    N)List)
AppCommand)color_style)_make_writeablesignalcommandc                   :    e Zd ZU dZg Zee   ed<   dZe	d        Z
y)CommandzbCreates a Django jobs command directory structure for the given app name in the current directory.requires_system_checksTc                 2    t        d|j                  fi | y )Njobs_template)copy_templatepath)selfappoptionss      l/var/www/html/Stanley/venv/lib/python3.12/site-packages/django_extensions/management/commands/create_jobs.pyhandle_app_configzCommand.handle_app_config   s    osxx;7;    N)__name__
__module____qualname__helpr
   r   str__annotations__can_import_settingsr   r    r   r   r	   r	      s0    oD(*DI* < <r   r	   c           	      Z   ddl }t               }t        |dd       }t        |dd       }t        j                  j                  |j                  d   d|       }|d   }t        j                  |      D ]  \  }	}
}|	t        |      d	z   d }|rpt        j                  j                  t        j                  j                  ||            s3t        j                  t        j                  j                  ||             t        |
      D ]  \  }}|j                  d
      s|
|=  |D ]3  }|j                  d      s|j                  d      r't        j                  j                  |	|      }t        j                  j                  |||      j                  d      }t        j                  j                  |      r|d	kD  rt         |d|z               |d	kD  rt         |d|z               t!        |d      5 }t!        |d      5 }|j#                  |j%                                ddd       ddd       	 t'        j(                  ||       t+        |       6  y# 1 sw Y   :xY w# 1 sw Y   >xY w# t,        $ r& t.        j0                  j#                  d|z         Y w xY w)z=Copy the specified template directory to the copy_to locationr   NERRORc                     | S Nr   xs    r   <lambda>zcopy_template.<locals>.<lambda>   s    ar   SUCCESSc                     | S r    r   r!   s    r   r#   zcopy_template.<locals>.<lambda>    s    !r   conf	verbosity   .z.pycz	.DS_Storez.tmplz%s already existsz%srwzlNotice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.
)django_extensionsr   getattrosr   join__path__walklenexistsmkdir	enumerate
startswithendswithrstripprintopenwritereadshutilcopymoder   OSErrorsysstderr)template_namecopy_tor   r,   styler   r$   template_dirr'   dsubdirsfilesrelative_dirisubdirfpath_oldpath_newfp_origfp_news                       r   r   r      s%   MEE7K0EeY4G77<< 1 : :1 =v}UL$I  WW\27E\*Q./0rww||G\/R SHHRWW\\'<89"7+IAv  %AJ , Azz&!Q\\+%>ww||Aq)Hww||G\1=DDWMHww~~h'q=% 3h >?@1}gdXo./h$(C(FLL0 ) %](3)%  3( )( %$  ]

    "Q  T\  "\  ]]s6   =I/
 I#	*I/;!I;#I,(I//I8;+J*)J*)r.   r@   r=   typingr   django.core.management.baser   django.core.management.colorr   "django_extensions.management.utilsr   r   r	   r   r   r   r   <module>rU      s,    	 
   2 4 M
<j 
<']r   